2009-11-19 09:04:33 +00:00
|
|
|
/**A composer items that draws common shapes (ellipse, triangle, rectangle)*/
|
2010-02-09 14:34:17 +00:00
|
|
|
class QgsComposerShape: QgsComposerItem
|
2009-11-19 09:04:33 +00:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposershape.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Shape
|
|
|
|
{
|
|
|
|
Ellipse,
|
|
|
|
Rectangle,
|
|
|
|
Triangle
|
|
|
|
};
|
|
|
|
|
|
|
|
QgsComposerShape( QgsComposition* composition /TransferThis/);
|
2010-02-11 20:11:48 +00:00
|
|
|
QgsComposerShape( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition /TransferThis/);
|
2009-11-19 09:04:33 +00:00
|
|
|
~QgsComposerShape();
|
|
|
|
|
2010-11-25 21:45:52 +00:00
|
|
|
/** return correct graphics item type. Added in v1.7 */
|
|
|
|
virtual int type() const;
|
|
|
|
|
2009-11-19 09:04:33 +00:00
|
|
|
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
|
|
|
|
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
/** stores state in Dom element
|
|
|
|
* @param elem is Dom element corresponding to 'Composer' tag
|
|
|
|
* @param doc write template file
|
2009-11-19 09:04:33 +00:00
|
|
|
*/
|
|
|
|
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
|
|
|
|
|
|
|
|
/** sets state from Dom document
|
|
|
|
* @param itemElem is Dom node corresponding to item tag
|
2012-09-24 02:28:15 +02:00
|
|
|
* @param doc is Dom document
|
2009-11-19 09:04:33 +00:00
|
|
|
*/
|
|
|
|
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
|
|
|
|
|
|
|
|
//setters and getters
|
|
|
|
QgsComposerShape::Shape shapeType() const;
|
|
|
|
void setShapeType( QgsComposerShape::Shape s );
|
2012-03-02 08:14:26 +02:00
|
|
|
|
|
|
|
/**Sets this items bound in scene coordinates such that 1 item size units
|
|
|
|
corresponds to 1 scene size unit. Also, the shape is scaled*/
|
|
|
|
void setSceneRect( const QRectF& rectangle );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2012-03-02 08:14:26 +02:00
|
|
|
public slots:
|
|
|
|
/**Sets item rotation and resizes item bounds such that the shape always has the same size*/
|
|
|
|
virtual void setRotation( double r );
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|