20 #include <QGraphicsLineItem>
21 #include <QGraphicsScene>
22 #include <QGraphicsSceneMouseEvent>
23 #include <QGraphicsView>
26 #include <QGraphicsEffect>
46 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter
49 #define M_DEG2RAD 0.0174532925
55 , mRemovedFromComposition( false )
56 , mBoundingResizeRectangle( 0 )
57 , mHAlignSnapItem( 0 )
58 , mVAlignSnapItem( 0 )
61 , mBackgroundColor(
QColor( 255, 255, 255, 255 ) )
62 , mFrameJoinStyle( Qt::MiterJoin )
63 , mItemPositionLocked( false )
64 , mLastValidViewScaleFactor( -1 )
66 , mEvaluatedItemRotation( 0 )
67 , mBlendMode(
QPainter::CompositionMode_SourceOver )
68 , mEffectsEnabled( true )
70 , mExcludeFromExports( false )
71 , mEvaluatedExcludeFromExports( false )
72 , mLastUsedPositionMode( UpperLeft )
73 , mIsGroupMember( false )
74 , mCurrentExportLayer( -1 )
76 , mUuid(
QUuid::createUuid().toString() )
84 , mRemovedFromComposition( false )
85 , mBoundingResizeRectangle( 0 )
86 , mHAlignSnapItem( 0 )
87 , mVAlignSnapItem( 0 )
90 , mBackgroundColor(
QColor( 255, 255, 255, 255 ) )
91 , mFrameJoinStyle( Qt::MiterJoin )
92 , mItemPositionLocked( false )
93 , mLastValidViewScaleFactor( -1 )
95 , mEvaluatedItemRotation( 0 )
96 , mBlendMode(
QPainter::CompositionMode_SourceOver )
97 , mEffectsEnabled( true )
99 , mExcludeFromExports( false )
100 , mEvaluatedExcludeFromExports( false )
101 , mLastUsedPositionMode( UpperLeft )
102 , mIsGroupMember( false )
103 , mCurrentExportLayer( -1 )
105 , mUuid(
QUuid::createUuid().toString() )
107 init( manageZValue );
111 void QgsComposerItem::init(
const bool manageZValue )
113 setFlag( QGraphicsItem::ItemIsSelectable,
true );
117 defaultPen.setWidthF( 0.3 );
123 mCompositionManagesZValue =
true;
128 mCompositionManagesZValue =
false;
221 composerItemElem.
setAttribute(
"positionLock",
"true" );
225 composerItemElem.
setAttribute(
"positionLock",
"false" );
279 mTemplateUuid = itemElem.
attribute(
"templateUuid" );
287 if ( frame.
compare(
"true", Qt::CaseInsensitive ) == 0 )
298 if ( background.
compare(
"true", Qt::CaseInsensitive ) == 0 )
309 if ( positionLock.
compare(
"true", Qt::CaseInsensitive ) == 0 )
323 double x,
y, pagex, pagey, width, height;
324 bool xOk, yOk, pageOk, pagexOk, pageyOk, widthOk, heightOk, positionModeOK;
334 if ( !positionModeOK )
338 if ( pageOk && pagexOk && pageyOk )
346 if ( !xOk || !yOk || !widthOk || !heightOk )
357 if ( frameColorList.size() > 0 )
360 bool redOk, greenOk, blueOk, alphaOk, widthOk;
361 int penRed, penGreen, penBlue, penAlpha;
371 if ( redOk && greenOk && blueOk && alphaOk && widthOk )
373 QPen framePen(
QColor( penRed, penGreen, penBlue, penAlpha ) );
382 if ( bgColorList.
size() > 0 )
385 bool redOk, greenOk, blueOk, alphaOk;
386 int bgRed, bgGreen, bgBlue, bgAlpha;
391 if ( redOk && greenOk && blueOk && alphaOk )
393 QColor brushColor( bgRed, bgGreen, bgBlue, bgAlpha );
415 if ( drawFrame ==
mFrame )
428 if ( itemPen.
color() == color )
441 if ( itemPen.
widthF() == outlineWidth )
479 return rect().
adjusted( -frameBleed, -frameBleed, frameBleed, frameBleed );
529 selectedItemPen.
setStyle( Qt::DotLine );
531 p->
setPen( selectedItemPen );
583 double y =
pos().
y();
586 while ( y - h >= 0. )
598 p.
ry() -= (
page() - 1 ) * h;
604 Q_UNUSED( newPageWidth )
606 int curPage =
page() - 1;
624 double upperLeftX =
x;
625 double upperLeftY =
y;
630 upperLeftY += ( page - 1 ) * h;
639 upperLeftX -= width / 2.0;
649 upperLeftY -= height / 2.0;
653 upperLeftY -= height;
656 if ( posIncludesFrame )
670 upperLeftX += lineToItemOrigin.
x2();
671 upperLeftY += lineToItemOrigin.
y2();
687 double newWidth = rectangle.
width();
688 double newHeight = rectangle.
height();
689 double xTranslation = rectangle.
x();
690 double yTranslation = rectangle.
y();
693 if ( rectangle.
width() < 0 )
695 newWidth = - rectangle.
width();
696 xTranslation -= newWidth;
699 if ( rectangle.
height() < 0 )
701 newHeight = - rectangle.
height();
702 yTranslation -= newHeight;
721 double width = exprVal.
toDouble( &ok );
723 if ( ok && !exprVal.
isNull() )
731 double height = exprVal.
toDouble( &ok );
733 if ( ok && !exprVal.
isNull() )
739 double x = result.
left();
746 x += newRect.
width() / 2.0;
750 x += newRect.
width();
767 double positionX = exprVal.
toDouble( &ok );
769 if ( ok && !exprVal.
isNull() )
775 double y = result.
top();
782 y += newRect.
height() / 2.0;
803 double positionY = exprVal.
toDouble( &ok );
805 if ( ok && !exprVal.
isNull() )
814 x -= result.
width() / 2.0;
824 y -= result.
height() / 2.0;
885 void QgsComposerItem::refreshBlendMode()
897 blendMode = blendModeD;
907 refreshTransparency(
true );
910 void QgsComposerItem::refreshTransparency(
const bool updateItem )
919 int transparencyD = exprVal.
toInt( &ok );
921 if ( ok && !exprVal.
isNull() )
923 transparency = transparencyD;
993 if ( viewList.
size() > 0 )
1010 double rectHandlerSize = 10.0 / viewScaleFactor;
1013 if ( rectHandlerSize > (
rect().width() / 3 ) )
1017 if ( rectHandlerSize > (
rect().height() / 3 ) )
1021 return rectHandlerSize;
1028 if ( lockSymbolSize > (
rect().width() / 3 ) )
1032 if ( lockSymbolSize > (
rect().height() / 3 ) )
1057 refreshRotation(
true, adjustPosition );
1060 void QgsComposerItem::refreshRotation(
const bool updateItem,
const bool adjustPosition )
1069 double rotD = exprVal.
toDouble( &ok );
1071 if ( ok && !exprVal.
isNull() )
1082 if ( adjustPosition )
1090 QPointF rotatedReferencePoint = refLine.
p2();
1091 setPos( rotatedReferencePoint );
1121 if ( qAbs( rotation ) <= 0.0 )
1142 double midX = width / 2.0;
1143 double midY = height / 2.0;
1166 double distM1 = sqrt(( x1 - midX ) * ( x1 - midX ) + ( y1 - midY ) * ( y1 - midY ) );
1169 if ( p2.
x() < width && p2.
x() > 0 && p2.
y() < height && p2.
y() > 0 )
1171 width = sqrt(( p2.
x() - x1 ) * ( p2.
x() - x1 ) + ( p2.
y() - y1 ) * ( p2.
y() - y1 ) );
1172 height = sqrt(( x3 - p2.
x() ) * ( x3 - p2.
x() ) + ( y3 - p2.
y() ) * ( y3 - p2.
y() ) );
1177 double distM2 = sqrt(( x2 - midX ) * ( x2 - midX ) + ( y2 - midY ) * ( y2 - midY ) );
1180 width = sqrt(( x2 - p1.
x() ) * ( x2 - p1.
x() ) + ( y2 - p1.
y() ) * ( y2 - p1.
y() ) );
1181 height = sqrt(( p3.
x() - x2 ) * ( p3.
x() - x2 ) + ( p3.
y() - y2 ) * ( p3.
y() - y2 ) );
1201 double rotToRad = rotation *
M_PI / 180.0;
1202 QPointF midpoint( width / 2.0, height / 2.0 );
1203 double xVector = x - midpoint.
x();
1204 double yVector = y - midpoint.
y();
1207 double xRotated = cos( rotToRad ) * xVector - sin( rotToRad ) * yVector;
1208 double yRotated = sin( rotToRad ) * xVector + cos( rotToRad ) * yVector;
1211 QLineF line( midpoint.
x(), midpoint.
y(), midpoint.
x() + xRotated, midpoint.
y() + yRotated );
1215 borders <<
QLineF( 0, 0, width, 0 );
1216 borders << QLineF( width, 0, width, height );
1217 borders << QLineF( width, height, 0, height );
1218 borders << QLineF( 0, height, 0, 0 );
1223 for ( ; it != borders.constEnd(); ++it )
1225 if ( line.intersect( *it, &intersectionPoint ) == QLineF::BoundedIntersection )
1227 x = intersectionPoint.
x();
1228 y = intersectionPoint.
y();
1245 if ( rotation == 0.0 )
1251 double x1 = -width / 2.0;
1252 double y1 = -height / 2.0;
1255 double x2 = width / 2.0;
1256 double y2 = -height / 2.0;
1259 double x3 = width / 2.0;
1260 double y3 = height / 2.0;
1263 double x4 = -width / 2.0;
1264 double y4 = height / 2.0;
1268 QPointF midpoint( width / 2.0, height / 2.0 );
1271 rotatedRectPoly <<
QPointF( midpoint.
x() + x1, midpoint.
y() + y1 );
1272 rotatedRectPoly <<
QPointF( midpoint.
x() + x2, midpoint.
y() + y2 );
1273 rotatedRectPoly <<
QPointF( midpoint.
x() + x3, midpoint.
y() + y3 );
1274 rotatedRectPoly <<
QPointF( midpoint.
x() + x4, midpoint.
y() + y4 );
1276 width = boundingRect.
width();
1277 height = boundingRect.height();
1349 if ( evaluatedRect != beforeRect )
1356 refreshRotation(
false,
true );
1360 refreshTransparency(
false );
1373 exclude = exprVal.
toBool();
1403 setFlag( QGraphicsItem::ItemIsSelectable, !isGroupMember );
1409 if ( !
id().isEmpty() )
1419 return tr(
"<arrow>" );
1421 return tr(
"<group>" );
1423 return tr(
"<label>" );
1425 return tr(
"<legend>" );
1427 return tr(
"<map>" );
1429 return tr(
"<picture>" );
1431 return tr(
"<scale bar>" );
1433 return tr(
"<shape>" );
1435 return tr(
"<table>" );
1437 return tr(
"<attribute table>" );
1439 return tr(
"<text table>" );
1441 return tr(
"<frame>" );
1444 return tr(
"<item>" );
bool positionLock() const
Returns whether position lock for mouse drags is enabled returns true if item is locked for mouse mov...
bool mExcludeFromExports
Whether item should be excluded in exports.
QDomNodeList elementsByTagName(const QString &tagname) const
void setSelected(bool selected)
bool effectsEnabled() const
Returns whether effects (eg blend modes) are enabled for the item.
Q_DECL_DEPRECATED bool imageSizeConsideringRotation(double &width, double &height, double rotation) const
Calculates width and hight of the picture (in mm) such that it fits into the item frame with the give...
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
void setStyle(Qt::PenStyle style)
int mTransparency
Item transparency.
A base class for objects which belong to a map composition.
Q_DECL_DEPRECATED double fontHeightCharacterMM(const QFont &font, const QChar &c) const
Returns the font height of a character in millimeters.
void itemRotationChanged(double newRotation)
Is emitted on item rotation change.
Q_DECL_DEPRECATED double pixelFontSize(double pointSize) const
Calculates font size in mm from a font point size.
void setCompositionMode(CompositionMode mode)
void setRenderHint(RenderHint hint, bool on)
void setGraphicsEffect(QGraphicsEffect *effect)
QDomNode appendChild(const QDomNode &newChild)
void addItemToZList(QgsComposerItem *item)
Adds item to z list.
virtual void setRotation(double r)
Sets the item rotation.
void setFlag(GraphicsItemFlag flag, bool enabled)
virtual double estimatedFrameBleed() const
Returns the estimated amount the item's frame bleeds outside the item's actual rectangle.
QString attribute(const QString &name, const QString &defValue) const
QgsComposerModel * itemsModel()
Returns the items model attached to the composition.
void itemChanged()
Emitted when the item changes.
Q_DECL_DEPRECATED double lockSymbolSize() const
Returns the size of the lock symbol depending on the composer zoom level and the item size...
QPointF pagePos() const
Returns the item's position relative to its current page.
const T & at(int i) const
QMap< QgsComposerObject::DataDefinedProperty, QString > mDataDefinedNames
Map of data defined properties for the item to string name to use when exporting item to xml...
#define Q_NOWARN_DEPRECATED_PUSH
void removeItemFromZList(QgsComposerItem *item)
Removes item from z list.
static QRectF largestRotatedRectWithinBounds(const QRectF originalRect, const QRectF boundsRect, const double rotation)
Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by a specified amount.
static void drawText(QPainter *painter, const QPointF &pos, const QString &text, const QFont &font, const QColor &color=QColor())
Draws text on a painter at a specific position, taking care of composer specific issues (calculation ...
double mLastValidViewScaleFactor
Backup to restore item appearance if no view scale factor is available.
ItemPositionMode mLastUsedPositionMode
The item's position mode.
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
void updateBounds()
Updates the scene bounds of the composition.
void setJoinStyle(Qt::PenJoinStyle style)
void updateItemVisibility(QgsComposerItem *item)
Must be called when an item's visibility changes.
virtual void setSelected(bool s)
Set selected, selected item should be highlighted.
static double fontAscentMM(const QFont &font)
Calculate font ascent in millimeters, including workarounds for QT font rendering issues...
virtual void drawFrame(QPainter *p)
Draw black frame around item.
virtual void setFrameEnabled(const bool drawFrame)
Set whether this item has a frame drawn around it or not.
static QFont scaledFontPixelSize(const QFont &font)
Returns a font where size is set in pixels and the size has been upscaled with FONT_WORKAROUND_SCALE ...
QColor backgroundColor() const
Gets the background color for this item.
QPainter::CompositionMode mBlendMode
Composition blend mode for item.
void setCompositionMode(const QPainter::CompositionMode &compositionMode)
QGraphicsScene * scene() const
bool excludeFromExports(const QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue)
Returns whether the item should be excluded from composer exports and prints.
double toDouble(bool *ok) const
double spaceBetweenPages() const
Returns the vertical space between pages in a composer view.
static double fontDescentMM(const QFont &font)
Calculate font descent in millimeters, including workarounds for QT font rendering issues...
double itemRotation(const QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) const
Returns the current rotation for the composer item.
QString tr(const char *sourceText, const char *disambiguation, int n)
void setEnabled(bool enable)
void setBlendMode(const QPainter::CompositionMode blendMode)
Sets the item's composition blending mode.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
void update(const QRectF &rect)
void updateItemDisplayName(QgsComposerItem *item)
Must be called when an item's display name is modified.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer...
DataDefinedProperty
Data defined properties for different item types.
bool dataDefinedEvaluate(const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue)
Evaluate a data defined property and return the calculated value.
void setRect(const QRectF &rectangle)
void setHeight(qreal height)
void setItemPosition(double x, double y, ItemPositionMode itemPoint=UpperLeft, int page=-1)
Moves the item to a new position (in canvas coordinates)
bool _readXML(const QDomElement &itemElem, const QDomDocument &doc)
Reads parameter that are not subclass specific in document.
Q_DECL_DEPRECATED double fontDescentMillimeters(const QFont &font) const
Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCA...
const QColor & color() const
void deleteHAlignSnapItem()
QDomElement toElement() const
void updateItemLockStatus(QgsComposerItem *item)
Must be called when an item's lock status changes.
void drawRect(const QRectF &rectangle)
virtual QRectF boundingRect() const
static void drawArrowHead(QPainter *p, const double x, const double y, const double angle, const double arrowHeadWidth)
Draws an arrow head on to a QPainter.
void frameChanged()
Emitted if the item's frame style changes.
static QPainter::CompositionMode decodeBlendMode(const QString &s)
QString number(int n, int base)
double horizontalViewScaleFactor() const
Returns the zoom factor of the graphics view.
void setFrameJoinStyle(const Qt::PenJoinStyle style)
Sets join style used when drawing the item's frame.
int toInt(bool *ok) const
void removeItem(QGraphicsItem *item)
void cancelCommand()
Deletes current command.
Q_DECL_DEPRECATED QFont scaledFontPixelSize(const QFont &font) const
Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE.
int transparency() const
Returns the item's transparency.
virtual void updateItem()
Updates item, with the possibility to do custom update for subclasses.
static double fontHeightCharacterMM(const QFont &font, const QChar &character)
Calculate font height in millimeters of a single character, including workarounds for QT font renderi...
virtual void drawSelectionBoxes(QPainter *p)
Draws additional graphics on selected items.
Q_DECL_DEPRECATED double textWidthMillimeters(const QFont &font, const QString &text) const
Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE...
Q_DECL_DEPRECATED void rotate(double angle, double &x, double &y) const
Rotates a point / vector.
void endCommand()
Saves end state of item and pushes command to the undo history.
QGraphicsRectItem * mBoundingResizeRectangle
Rectangle used during move and resize actions.
void setPen(const QColor &color)
Q_DECL_DEPRECATED QRectF largestRotatedRectWithinBounds(QRectF originalRect, QRectF boundsRect, double rotation) const
Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by a specified amount.
void updatePagePos(double newPageWidth, double newPageHeight)
Moves the item so that it retains its relative position on the page when the paper size changes...
bool mFrame
True if item fram needs to be painted.
void setAttribute(const QString &name, const QString &value)
void setPos(const QPointF &pos)
const QgsComposition * composition() const
Returns the composition the item is attached to.
QList< QGraphicsView * > views() const
int toInt(bool *ok, int base) const
void setAngle(qreal angle)
void endCommand()
Finish current command and push it onto the undo stack.
virtual void setFrameOutlineColor(const QColor &color)
Sets frame outline color.
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
void setWidthF(qreal width)
void setBrush(const QBrush &brush)
double mEvaluatedItemRotation
Temporary evaluated item rotation in degrees, clockwise.
virtual ~QgsComposerItem()
void beginCommand(const QString &commandText, QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown)
Starts new composer undo command.
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
bool shouldDrawItem() const
Returns whether the item should be drawn in the current context.
void setOpacity(qreal opacity)
void setColor(const QColor &color)
Graphics scene for map printing.
void setPen(const QPen &pen)
static void rotate(const double angle, double &x, double &y)
Rotates a point / vector around the origin.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
virtual void setExcludeFromExports(const bool exclude)
Sets whether the item should be excluded from composer exports and prints.
virtual QString displayName() const
Get item display name.
virtual QRectF rectWithFrame() const
Returns the item's rectangular bounds, including any bleed caused by the item's frame.
QGraphicsLineItem * hAlignSnapItem()
Return horizontal align snap item.
static QPainter::CompositionMode getCompositionMode(const QgsMapRenderer::BlendMode &blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
void setPositionLock(const bool lock)
Locks / unlocks the item position for mouse drags.
virtual void setFrameOutlineWidth(const double outlineWidth)
Sets frame outline width.
Q_DECL_DEPRECATED double rotation() const
Returns the rotation for the composer item.
#define Q_NOWARN_DEPRECATED_POP
static double textWidthMM(const QFont &font, const QString &text)
Calculate font width in millimeters for a string, including workarounds for QT font rendering issues...
QgsComposition * mComposition
Qt::PenJoinStyle mFrameJoinStyle
Frame join style.
QColor mBackgroundColor
Background color.
QGraphicsLineItem * mVAlignSnapItem
static double fontHeightMM(const QFont &font)
Calculate font height in millimeters, including workarounds for QT font rendering issues The font hei...
QRectF evalItemRect(const QRectF &newRect, const bool resizeOnly=false)
Evaluates an item's bounding rect to consider data defined position and size of item and reference po...
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect(double &x, double &y, double width, double height, double rotation) const
Calculates corner point after rotation and scaling.
QGraphicsLineItem * mHAlignSnapItem
QRectF boundingRect() const
QPointF mapToScene(const QPointF &point) const
void setBackgroundColor(const QColor &backgroundColor)
Sets the background color for this item.
bool _writeXML(QDomElement &itemElem, QDomDocument &doc) const
Writes parameter that are not subclass specific in document.
virtual void refreshDataDefinedProperty(const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties) override
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
void setPen(const QPen &pen)
bool mItemPositionLocked
True if item position and size cannot be changed with mouse move.
QPainter::CompositionMode blendMode() const
Returns the item's composition blending mode.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
virtual void setItemRotation(const double r, const bool adjustPosition=false)
Sets the item rotation.
void setWidth(qreal width)
virtual void drawBackground(QPainter *p)
Draw background.
void deleteVAlignSnapItem()
bool hasFrame() const
Whether this item has a frame or not.
virtual void setId(const QString &id)
Set item's id (which is not necessarly unique)
Q_DECL_DEPRECATED double fontHeightMillimeters(const QFont &font) const
Returns the font height in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...
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...
Q_DECL_DEPRECATED double angle(const QPointF &p1, const QPointF &p2) const
Returns angle of the line from p1 to p2 (clockwise, starting at N)
void sizeChanged()
Emitted if the rectangle changes.
double paperHeight() const
Height of paper item.
void setIsGroupMember(const bool isGroupMember)
Sets whether this item is part of a group.
static double pointsToMM(const double pointSize)
Returns the size in mm corresponding to a font point size.
int page() const
Gets the page the item is currently on.
void setVisible(bool visible)
static Qt::PenJoinStyle decodePenJoinStyle(QString str)
void setEffectsEnabled(const bool effectsEnabled)
Sets whether effects (eg blend modes) are enabled for the item.
void updateItemSelectStatus(QgsComposerItem *item)
Must be called when an item's selection status changes.
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const
void setRotation(qreal angle)
double toDouble(bool *ok) const
iterator insert(const Key &key, const T &value)
static QgsMapRenderer::BlendMode getBlendModeEnum(const QPainter::CompositionMode &blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
void setBrush(const QBrush &brush)
QgsComposerEffect * mEffect
Q_DECL_DEPRECATED void drawArrowHead(QPainter *p, double x, double y, double angle, double arrowHeadWidth) const
Draws arrowhead.
QgsComposerItem(QgsComposition *composition, bool manageZValue=true)
Constructor.
static double angle(const QPointF &p1, const QPointF &p2)
Calculates the angle of the line from p1 to p2 (counter clockwise, starting from a line from north to...
QDomElement createElement(const QString &tagName)
void lockChanged()
Emitted if the item's lock status changes.
void addItem(QGraphicsItem *item)
QgsComposition::PlotStyle plotStyle() const
double rectHandlerBorderTolerance() const
Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to t...
static QPointF pointOnLineWithDistance(const QPointF &startPoint, const QPointF &directionPoint, double distance)
Returns a point on the line from startPoint to directionPoint that is a certain distance away from th...
int compare(const QString &other) const
bool mBackground
True if item background needs to be painted.
void move(double dx, double dy)
Moves item in canvas coordinates.
bool isGroupMember() const
Returns whether this item is part of a group.
virtual void setVisibility(const bool visible)
Sets visibility for item.
bool mIsGroupMember
Whether or not this item is part of a group.
Q_DECL_DEPRECATED void drawText(QPainter *p, double x, double y, const QString &text, const QFont &font, const QColor &c=QColor()) const
Draws Text.
double mItemRotation
Item rotation in degrees, clockwise.
QGraphicsLineItem * vAlignSnapItem()
Return vertical align snap item.
Q_DECL_DEPRECATED double fontAscentMillimeters(const QFont &font) const
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...
bool mEvaluatedExcludeFromExports
Temporary evaluated item exclusion.
void setTransparency(const int transparency)
Sets the item's transparency.
Q_DECL_DEPRECATED void sizeChangedByRotation(double &width, double &height, double rotation)
Calculates width / height of the bounding box of a rotated rectangle.
virtual int type() const override
return correct graphics item type.
QDomNode at(int index) const
uint toUInt(bool *ok, int base) const
void beginCommand(QgsComposerItem *item, const QString &commandText, const QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown)
Allocates new item command and saves initial state in it.
QString id() const
Get item's id (which is not necessarly unique)