20 #include <QGraphicsLineItem>
21 #include <QGraphicsScene>
22 #include <QGraphicsSceneMouseEvent>
23 #include <QGraphicsView>
26 #include <QGraphicsEffect>
47 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter
50 #define M_DEG2RAD 0.0174532925
56 , mRemovedFromComposition( false )
57 , mBoundingResizeRectangle( 0 )
58 , mHAlignSnapItem( 0 )
59 , mVAlignSnapItem( 0 )
62 , mBackgroundColor(
QColor( 255, 255, 255, 255 ) )
63 , mFrameJoinStyle(
Qt::MiterJoin )
64 , mItemPositionLocked( false )
65 , mLastValidViewScaleFactor( -1 )
67 , mEvaluatedItemRotation( 0 )
68 , mBlendMode(
QPainter::CompositionMode_SourceOver )
69 , mEffectsEnabled( true )
71 , mExcludeFromExports( false )
72 , mEvaluatedExcludeFromExports( false )
73 , mLastUsedPositionMode( UpperLeft )
74 , mIsGroupMember( false )
75 , mCurrentExportLayer( -1 )
77 , mUuid(
QUuid::createUuid().toString() )
85 , mRemovedFromComposition( false )
86 , mBoundingResizeRectangle( 0 )
87 , mHAlignSnapItem( 0 )
88 , mVAlignSnapItem( 0 )
91 , mBackgroundColor(
QColor( 255, 255, 255, 255 ) )
92 , mFrameJoinStyle(
Qt::MiterJoin )
93 , mItemPositionLocked( false )
94 , mLastValidViewScaleFactor( -1 )
96 , mEvaluatedItemRotation( 0 )
97 , mBlendMode(
QPainter::CompositionMode_SourceOver )
98 , mEffectsEnabled( true )
100 , mExcludeFromExports( false )
101 , mEvaluatedExcludeFromExports( false )
102 , mLastUsedPositionMode( UpperLeft )
103 , mIsGroupMember( false )
104 , mCurrentExportLayer( -1 )
106 , mUuid(
QUuid::createUuid().toString() )
108 init( manageZValue );
112 void QgsComposerItem::init(
const bool manageZValue )
114 setFlag( QGraphicsItem::ItemIsSelectable,
true );
118 defaultPen.setWidthF( 0.3 );
124 mCompositionManagesZValue =
true;
129 mCompositionManagesZValue =
false;
222 composerItemElem.
setAttribute(
"positionLock",
"true" );
226 composerItemElem.
setAttribute(
"positionLock",
"false" );
280 mTemplateUuid = itemElem.
attribute(
"templateUuid" );
288 if ( frame.
compare(
"true", Qt::CaseInsensitive ) == 0 )
299 if ( background.
compare(
"true", Qt::CaseInsensitive ) == 0 )
310 if ( positionLock.
compare(
"true", Qt::CaseInsensitive ) == 0 )
324 double x,
y, pagex, pagey, width, height;
325 bool xOk, yOk, pageOk, pagexOk, pageyOk, widthOk, heightOk, positionModeOK;
335 if ( !positionModeOK )
339 if ( pageOk && pagexOk && pageyOk )
347 if ( !xOk || !yOk || !widthOk || !heightOk )
358 if ( frameColorList.size() > 0 )
361 bool redOk, greenOk, blueOk, alphaOk, widthOk;
362 int penRed, penGreen, penBlue, penAlpha;
372 if ( redOk && greenOk && blueOk && alphaOk && widthOk )
374 QPen framePen(
QColor( penRed, penGreen, penBlue, penAlpha ) );
383 if ( bgColorList.
size() > 0 )
386 bool redOk, greenOk, blueOk, alphaOk;
387 int bgRed, bgGreen, bgBlue, bgAlpha;
392 if ( redOk && greenOk && blueOk && alphaOk )
394 QColor brushColor( bgRed, bgGreen, bgBlue, bgAlpha );
416 if ( drawFrame ==
mFrame )
429 if ( itemPen.
color() == color )
442 if ( itemPen.
widthF() == outlineWidth )
480 return rect().
adjusted( -frameBleed, -frameBleed, frameBleed, frameBleed );
530 selectedItemPen.
setStyle( Qt::DotLine );
532 p->
setPen( selectedItemPen );
584 double y =
pos().
y();
587 while ( y - h >= 0. )
599 p.
ry() -= (
page() - 1 ) * h;
605 Q_UNUSED( newPageWidth )
607 int curPage =
page() - 1;
625 double upperLeftX =
x;
626 double upperLeftY =
y;
631 upperLeftY += ( page - 1 ) * h;
640 upperLeftX -= width / 2.0;
650 upperLeftY -= height / 2.0;
654 upperLeftY -= height;
657 if ( posIncludesFrame )
671 upperLeftX += lineToItemOrigin.
x2();
672 upperLeftY += lineToItemOrigin.
y2();
688 double newWidth = rectangle.
width();
689 double newHeight = rectangle.
height();
690 double xTranslation = rectangle.
x();
691 double yTranslation = rectangle.
y();
694 if ( rectangle.
width() < 0 )
696 newWidth = - rectangle.
width();
697 xTranslation -= newWidth;
700 if ( rectangle.
height() < 0 )
702 newHeight = - rectangle.
height();
703 yTranslation -= newHeight;
723 evalContext = scopedContext.
data();
732 double width = exprVal.
toDouble( &ok );
734 if ( ok && !exprVal.
isNull() )
742 double height = exprVal.
toDouble( &ok );
744 if ( ok && !exprVal.
isNull() )
750 double x = result.
left();
757 x += newRect.
width() / 2.0;
761 x += newRect.
width();
778 double positionX = exprVal.
toDouble( &ok );
780 if ( ok && !exprVal.
isNull() )
786 double y = result.
top();
793 y += newRect.
height() / 2.0;
814 double positionY = exprVal.
toDouble( &ok );
816 if ( ok && !exprVal.
isNull() )
825 x -= result.
width() / 2.0;
835 y -= result.
height() / 2.0;
901 refreshBlendMode( *context.
data() );
916 blendMode = blendModeD;
927 refreshTransparency(
true, *context.
data() );
930 void QgsComposerItem::refreshTransparency(
const bool updateItem,
const QgsExpressionContext& context )
939 int transparencyD = exprVal.
toInt( &ok );
941 if ( ok && !exprVal.
isNull() )
943 transparency = transparencyD;
1013 if ( viewList.
size() > 0 )
1030 double rectHandlerSize = 10.0 / viewScaleFactor;
1033 if ( rectHandlerSize > (
rect().width() / 3 ) )
1037 if ( rectHandlerSize > (
rect().height() / 3 ) )
1041 return rectHandlerSize;
1048 if ( lockSymbolSize > (
rect().width() / 3 ) )
1052 if ( lockSymbolSize > (
rect().height() / 3 ) )
1078 refreshRotation(
true, adjustPosition, *context.
data() );
1081 void QgsComposerItem::refreshRotation(
const bool updateItem,
const bool adjustPosition,
const QgsExpressionContext& context )
1090 double rotD = exprVal.
toDouble( &ok );
1092 if ( ok && !exprVal.
isNull() )
1103 if ( adjustPosition )
1111 QPointF rotatedReferencePoint = refLine.
p2();
1112 setPos( rotatedReferencePoint );
1142 if ( qAbs( rotation ) <= 0.0 )
1163 double midX = width / 2.0;
1164 double midY = height / 2.0;
1187 double distM1 = sqrt(( x1 - midX ) * ( x1 - midX ) + ( y1 - midY ) * ( y1 - midY ) );
1190 if ( p2.
x() < width && p2.
x() > 0 && p2.
y() < height && p2.
y() > 0 )
1192 width = sqrt(( p2.
x() - x1 ) * ( p2.
x() - x1 ) + ( p2.
y() - y1 ) * ( p2.
y() - y1 ) );
1193 height = sqrt(( x3 - p2.
x() ) * ( x3 - p2.
x() ) + ( y3 - p2.
y() ) * ( y3 - p2.
y() ) );
1198 double distM2 = sqrt(( x2 - midX ) * ( x2 - midX ) + ( y2 - midY ) * ( y2 - midY ) );
1201 width = sqrt(( x2 - p1.
x() ) * ( x2 - p1.
x() ) + ( y2 - p1.
y() ) * ( y2 - p1.
y() ) );
1202 height = sqrt(( p3.
x() - x2 ) * ( p3.
x() - x2 ) + ( p3.
y() - y2 ) * ( p3.
y() - y2 ) );
1222 double rotToRad = rotation *
M_PI / 180.0;
1223 QPointF midpoint( width / 2.0, height / 2.0 );
1224 double xVector = x - midpoint.
x();
1225 double yVector = y - midpoint.
y();
1228 double xRotated = cos( rotToRad ) * xVector - sin( rotToRad ) * yVector;
1229 double yRotated = sin( rotToRad ) * xVector + cos( rotToRad ) * yVector;
1232 QLineF line( midpoint.
x(), midpoint.
y(), midpoint.
x() + xRotated, midpoint.
y() + yRotated );
1236 borders <<
QLineF( 0, 0, width, 0 );
1237 borders << QLineF( width, 0, width, height );
1238 borders << QLineF( width, height, 0, height );
1239 borders << QLineF( 0, height, 0, 0 );
1244 for ( ; it != borders.constEnd(); ++it )
1246 if ( line.intersect( *it, &intersectionPoint ) == QLineF::BoundedIntersection )
1248 x = intersectionPoint.
x();
1249 y = intersectionPoint.
y();
1266 if ( rotation == 0.0 )
1272 double x1 = -width / 2.0;
1273 double y1 = -height / 2.0;
1276 double x2 = width / 2.0;
1277 double y2 = -height / 2.0;
1280 double x3 = width / 2.0;
1281 double y3 = height / 2.0;
1284 double x4 = -width / 2.0;
1285 double y4 = height / 2.0;
1289 QPointF midpoint( width / 2.0, height / 2.0 );
1292 rotatedRectPoly <<
QPointF( midpoint.
x() + x1, midpoint.
y() + y1 );
1293 rotatedRectPoly <<
QPointF( midpoint.
x() + x2, midpoint.
y() + y2 );
1294 rotatedRectPoly <<
QPointF( midpoint.
x() + x3, midpoint.
y() + y3 );
1295 rotatedRectPoly <<
QPointF( midpoint.
x() + x4, midpoint.
y() + y4 );
1297 width = boundingRect.
width();
1298 height = boundingRect.height();
1370 evalContext = scopedContext.
data();
1380 if ( evaluatedRect != beforeRect )
1387 refreshRotation(
false,
true, *evalContext );
1391 refreshTransparency(
false, *evalContext );
1395 refreshBlendMode( *evalContext );
1404 exclude = exprVal.
toBool();
1434 setFlag( QGraphicsItem::ItemIsSelectable, !isGroupMember );
1440 if ( !
id().isEmpty() )
1450 return tr(
"<arrow>" );
1452 return tr(
"<group>" );
1454 return tr(
"<label>" );
1456 return tr(
"<legend>" );
1458 return tr(
"<map>" );
1460 return tr(
"<picture>" );
1462 return tr(
"<scale bar>" );
1464 return tr(
"<shape>" );
1466 return tr(
"<table>" );
1468 return tr(
"<attribute table>" );
1470 return tr(
"<text table>" );
1472 return tr(
"<frame>" );
1475 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)
virtual void refreshDataDefinedProperty(const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties, const QgsExpressionContext *context=0) override
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
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 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 Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
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 ...
DataDefinedProperty
Data defined properties for different item types.
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.
virtual QgsExpressionContext * createExpressionContext() const override
Creates an expression context relating to the objects's current state.
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.
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.
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects's current state.
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)
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.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual void setFrameOutlineColor(const QColor &color)
Sets frame outline color.
QRectF evalItemRect(const QRectF &newRect, const bool resizeOnly=false, const QgsExpressionContext *context=0)
Evaluates an item's bounding rect to consider data defined position and size of item and reference po...
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
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.
void setWidthF(qreal width)
void setBrush(const QBrush &brush)
double mEvaluatedItemRotation
Temporary evaluated item rotation in degrees, clockwise.
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
virtual ~QgsComposerItem()
void beginCommand(const QString &commandText, QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown)
Starts new composer undo command.
bool shouldDrawItem() const
Returns whether the item should be drawn in the current context.
void setOpacity(qreal opacity)
void setColor(const QColor &color)
static QgsExpressionContextScope * composerItemScope(const QgsComposerItem *composerItem)
Creates a new scope which contains variables and functions relating to a QgsComposerItem.
Graphics scene for map printing.
Q_DECL_DEPRECATED QRectF largestRotatedRectWithinBounds(const QRectF &originalRect, const 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 setPen(const QPen &pen)
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer...
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.
bool dataDefinedEvaluate(const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue, const QgsExpressionContext &context=QgsExpressionContext()) const
Evaluate a data defined property and return the calculated value.
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...
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.
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.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
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)
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)