1 /***************************************************************************
2 * Copyright (C) 2007 by Jorge Cuadrado *
3 * kuadrosxx@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef YAMF_ITEMPOLYGON_H
22 #define YAMF_ITEMPOLYGON_H
24 #include <QAbstractGraphicsShapeItem>
26 #include <common/abstractserializable.h>
27 #include <yamf/common/yamf_exports.h>
36 * @brief Esta clase implementa un ítem para representar un poligono dentro de un escena.
37 * @author Jorge Cuadrado <kuadrosxx@gmail.com>
39 class YAMF_EXPORT Polygon
: public Common::AbstractSerializable
, public QAbstractGraphicsShapeItem
42 Polygon(QGraphicsItem
* parent
= 0, QGraphicsScene
* scene
= 0);
43 Polygon(int corners
, QGraphicsItem
* parent
= 0, QGraphicsScene
* scene
= 0);
44 Polygon(int corners
, double start
, const QRectF
& rect
, QGraphicsItem
* parent
= 0, QGraphicsScene
* scene
= 0);
48 virtual void fromXml(const QString
&xml
);
49 virtual QDomElement
toXml(QDomDocument
&doc
) const;
51 QRectF
boundingRect () const;
52 void paint ( QPainter
* painter
, const QStyleOptionGraphicsItem
* option
, QWidget
* widget
= 0 );
54 void setRect(const QRectF
& rect
);
57 void setStart(double start
);
58 QPainterPath
shape () const;
60 void setCorners(int corners
);
63 enum { Type
= UserType
+ 4 };
64 int type() const { return Type
; }