QGIS/python/core/composer/qgscomposershape.sip

86 lines
3.1 KiB
Plaintext
Raw Normal View History

2015-07-29 11:52:14 +02:00
/** A composer items that draws common shapes (ellipse, triangle, rectangle)*/
class QgsComposerShape: QgsComposerItem
{
%TypeHeaderCode
#include "qgscomposershape.h"
%End
public:
enum Shape
{
Ellipse,
Rectangle,
Triangle
};
QgsComposerShape( QgsComposition *composition /TransferThis/ );
QgsComposerShape( qreal x, qreal y, qreal width, qreal height, QgsComposition *composition /TransferThis/);
~QgsComposerShape();
2015-07-29 11:52:14 +02:00
/** Return correct graphics item type. Added in v1.7 */
virtual int type() const;
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
2015-07-29 11:52:14 +02:00
/** Stores state in Dom element
* @param elem is Dom element corresponding to 'Composer' tag
* @param doc write template file
*/
bool writeXml( QDomElement &elem, QDomDocument &doc ) const;
2015-07-29 11:52:14 +02:00
/** Sets state from Dom document
* @param itemElem is Dom node corresponding to item tag
* @param doc is Dom document
*/
bool readXml( const QDomElement &itemElem, const QDomDocument &doc );
//setters and getters
QgsComposerShape::Shape shapeType() const;
void setShapeType( QgsComposerShape::Shape s );
/** Sets radius for rounded rectangle corners. Added in 2.1 */
void setCornerRadius( double radius );
2015-07-29 11:52:14 +02:00
/** Returns the radius for rounded rectangle corners*/
double cornerRadius() const;
2014-01-26 18:35:21 +01:00
2016-08-06 11:01:42 +02:00
/** Sets the QgsFillSymbol used to draw the shape. Must also call setUseSymbol( true ) to
* enable drawing with a symbol.
* Note: added in version 2.1*/
void setShapeStyleSymbol( QgsFillSymbol *symbol );
2016-08-06 11:01:42 +02:00
/** Returns the QgsFillSymbol used to draw the shape.
* Note: added in version 2.1*/
QgsFillSymbol *shapeStyleSymbol();
2016-08-06 11:01:42 +02:00
/** Controls whether the shape should be drawn using a QgsFillSymbol.
* Note: Added in 2.1 */
void setUseSymbol( bool useSymbol );
2014-05-27 23:22:50 +02:00
2015-07-29 11:52:14 +02:00
/** Depending on the symbol style, the bounding rectangle can be larger than the shape
2014-05-27 23:22:50 +02:00
@note this function was added in version 2.3*/
QRectF boundingRect() const;
2015-07-29 11:52:14 +02:00
/** Sets new scene rectangle bounds and recalculates hight and extent. Reimplemented from
2014-04-11 13:04:39 +10:00
* QgsComposerItem as it needs to call updateBoundingRect after the shape's size changes
2016-02-14 03:50:23 +01:00
*/
void setSceneRect( const QRectF &rectangle );
2014-08-17 13:37:26 +02:00
2015-10-04 23:54:21 +02:00
//Overridden to return shape type
virtual QString displayName() const;
2013-06-23 16:00:16 +02:00
protected:
/* reimplement drawFrame, since it's not a rect, but a custom shape */
virtual void drawFrame( QPainter *p );
2013-06-23 16:00:16 +02:00
/* reimplement drawBackground, since it's not a rect, but a custom shape */
virtual void drawBackground( QPainter *p );
2015-07-29 11:52:14 +02:00
/** Reimplement estimatedFrameBleed, since frames on shapes are drawn using symbology
* rather than the item's pen */
virtual double estimatedFrameBleed() const;
2014-05-27 23:22:50 +02:00
public slots:
2015-07-29 11:52:14 +02:00
/** Should be called after the shape's symbol is changed. Redraws the shape and recalculates
* its selection bounds.
* Note: added in version 2.1*/
void refreshSymbol();
};