39 Q_UNUSED( itemStyle );
59 p->setRenderHint( QPainter::Antialiasing );
61 p->translate( rect().width() / 2.0, rect().height() / 2.0 );
63 p->translate( -rect().width() / 2.0, -rect().height() / 2.0 );
68 p->drawEllipse( QRectF( 0, 0 , rect().width(), rect().height() ) );
71 p->drawRect( QRectF( 0, 0 , rect().width(), rect().height() ) );
75 triangle << QPointF( 0, rect().height() );
76 triangle << QPointF( rect().width() , rect().height() );
77 triangle << QPointF( rect().width() / 2.0, 0 );
78 p->drawPolygon( triangle );
91 p->setBrush( Qt::NoBrush );
92 p->setRenderHint( QPainter::Antialiasing,
true );
101 p->setBrush( brush() );
102 p->setPen( Qt::NoPen );
103 p->setRenderHint( QPainter::Antialiasing,
true );
111 QDomElement composerShapeElem = doc.createElement(
"ComposerShape" );
112 composerShapeElem.setAttribute(
"shapeType",
mShape );
113 elem.appendChild( composerShapeElem );
114 return _writeXML( composerShapeElem, doc );
122 QDomNodeList composerItemList = itemElem.elementsByTagName(
"ComposerItem" );
123 if ( composerItemList.size() > 0 )
125 QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
136 double width = rect().width();
137 double height = rect().height();
141 double x = transform().dx() + rect().width() / 2.0 - width / 2.0;
142 double y = transform().dy() + rect().height() / 2.0 - height / 2.0;
153 if ( rectangle.width() != rect().width() || rectangle.height() != rect().height() )
155 double newShapeWidth = rectangle.width();
156 double newShapeHeight = rectangle.height();
Shape mShape
Ellipse, rectangle or triangle.
virtual void setRotation(double r)
virtual void drawFrame(QPainter *p)
Draw black frame around item.
A item that forms part of a map composition.
double mRotation
Item rotation in degrees, clockwise.
bool writeXML(QDomElement &elem, QDomDocument &doc) const
stores state in Dom element
void itemChanged()
Used e.g.
bool _readXML(const QDomElement &itemElem, const QDomDocument &doc)
Reads parameter that are not subclass specific in document.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget)
Reimplementation of QCanvasItem::paint - draw on canvas.
virtual void drawSelectionBoxes(QPainter *p)
Draw selection boxes around item.
bool mFrame
True if item fram needs to be painted.
void drawShape(QPainter *p)
Graphics scene for map printing.
void sizeChangedByRotation(double &width, double &height)
Calculates width / height of the bounding box of a rotated rectangle (mRotation)
bool _writeXML(QDomElement &itemElem, QDomDocument &doc) const
Writes parameter that are not subclass specific in document.
virtual void setRotation(double r)
Sets item rotation and resizes item bounds such that the shape always has the same size...
virtual void drawBackground(QPainter *p)
Draw background.
bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
sets state from Dom document
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
bool imageSizeConsideringRotation(double &width, double &height) const
Calculates width and hight of the picture (in mm) such that it fits into the item frame with the give...
void setFrameEnabled(bool drawFrame)
Set whether this item has a frame drawn around it or not.
bool mBackground
True if item background needs to be painted.
QgsComposerShape(QgsComposition *composition)
void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...