17 #ifndef QGSCOMPOSERITEM_H
18 #define QGSCOMPOSERITEM_H
24 #include <QGraphicsRectItem>
30 class QGraphicsLineItem;
46 ComposerItem = UserType + 100,
119 virtual int type()
const override {
return ComposerItem; }
128 virtual bool isRemoved()
const {
return mRemovedFromComposition; }
137 void setIsRemoved(
const bool removed ) { mRemovedFromComposition = removed; }
140 virtual void setSelected(
bool s );
143 virtual bool selected()
const {
return QGraphicsRectItem::isSelected(); }
146 void move(
double dx,
double dy );
151 virtual void moveContent(
double dx,
double dy ) { Q_UNUSED( dx ); Q_UNUSED( dy ); }
159 Q_DECL_DEPRECATED
virtual void zoomContent(
int delta,
double x,
double y ) { Q_UNUSED( delta ); Q_UNUSED( x ); Q_UNUSED( y ); }
183 QPointF pagePos()
const;
193 void updatePagePos(
double newPageWidth,
double newPageHeight );
196 void setItemPosition(
double x,
double y, ItemPositionMode itemPoint = UpperLeft,
int page = -1 );
207 void setItemPosition(
double x,
double y,
double width,
double height, ItemPositionMode itemPoint = UpperLeft,
bool posIncludesFrame =
false,
int page = -1 );
215 virtual void setSceneRect(
const QRectF& rectangle );
218 bool _writeXML( QDomElement& itemElem, QDomDocument& doc )
const;
221 bool _readXML(
const QDomElement& itemElem,
const QDomDocument& doc );
239 virtual void setFrameEnabled(
const bool drawFrame );
249 virtual void setFrameOutlineColor(
const QColor& color );
269 virtual void setFrameOutlineWidth(
const double outlineWidth );
299 void setFrameJoinStyle(
const Qt::PenJoinStyle style );
308 virtual double estimatedFrameBleed()
const;
318 virtual QRectF rectWithFrame()
const;
348 void setBackgroundColor(
const QColor& backgroundColor );
354 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
360 void setBlendMode(
const QPainter::CompositionMode blendMode );
372 void setTransparency(
const int transparency );
388 void setEffectsEnabled(
const bool effectsEnabled );
404 void cancelCommand();
413 Q_DECL_DEPRECATED
void drawText( QPainter* p,
double x,
double y,
const QString& text,
const QFont& font,
const QColor& c = QColor() )
const;
425 Q_DECL_DEPRECATED
void drawText( QPainter* p,
const QRectF& rect,
const QString& text,
const QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop,
int flags = Qt::TextWordWrap )
const;
430 Q_DECL_DEPRECATED
double textWidthMillimeters(
const QFont& font,
const QString& text )
const;
435 Q_DECL_DEPRECATED
double fontHeightCharacterMM(
const QFont& font,
const QChar& c )
const;
440 Q_DECL_DEPRECATED
double fontAscentMillimeters(
const QFont& font )
const;
445 Q_DECL_DEPRECATED
double fontDescentMillimeters(
const QFont& font )
const;
452 Q_DECL_DEPRECATED
double fontHeightMillimeters(
const QFont& font )
const;
457 Q_DECL_DEPRECATED
double pixelFontSize(
double pointSize )
const;
462 Q_DECL_DEPRECATED QFont scaledFontPixelSize(
const QFont& font )
const;
468 void setPositionLock(
const bool lock );
490 Q_DECL_DEPRECATED
double rotation()
const {
return mEvaluatedItemRotation; }
499 QString
id()
const {
return mId; }
505 virtual void setId(
const QString&
id );
513 QString
uuid()
const {
return mUuid; }
522 virtual QString displayName()
const;
531 virtual void setVisibility(
const bool visible );
547 virtual void setExcludeFromExports(
const bool exclude );
561 void setIsGroupMember(
const bool isGroupMember );
582 virtual void setRotation(
double r );
591 virtual void setItemRotation(
const double r,
const bool adjustPosition =
false );
671 virtual void drawSelectionBoxes( QPainter* p );
674 virtual void drawFrame( QPainter* p );
677 virtual void drawBackground( QPainter* p );
682 Q_DECL_DEPRECATED
void drawArrowHead( QPainter* p,
double x,
double y,
double angle,
double arrowHeadWidth )
const;
685 Q_DECL_DEPRECATED
double angle(
const QPointF& p1,
const QPointF& p2 )
const;
689 double rectHandlerBorderTolerance()
const;
694 Q_DECL_DEPRECATED
double lockSymbolSize()
const;
699 double horizontalViewScaleFactor()
const;
706 Q_DECL_DEPRECATED
bool imageSizeConsideringRotation(
double& width,
double& height,
double rotation )
const;
711 Q_DECL_DEPRECATED
bool imageSizeConsideringRotation(
double& width,
double& height )
const;
720 Q_DECL_DEPRECATED QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boundsRect,
double rotation )
const;
725 Q_DECL_DEPRECATED
bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height,
double rotation )
const;
730 Q_DECL_DEPRECATED
bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height )
const;
735 Q_DECL_DEPRECATED
void sizeChangedByRotation(
double& width,
double& height,
double rotation );
740 Q_DECL_DEPRECATED
void sizeChangedByRotation(
double& width,
double& height );
748 Q_DECL_DEPRECATED
void rotate(
double angle,
double& x,
double& y )
const;
751 QGraphicsLineItem* hAlignSnapItem();
752 void deleteHAlignSnapItem();
754 QGraphicsLineItem* vAlignSnapItem();
755 void deleteVAlignSnapItem();
756 void deleteAlignItems();
768 QRectF evalItemRect(
const QRectF &newRect,
const bool resizeOnly =
false );
774 bool shouldDrawItem()
const;
778 void itemRotationChanged(
double newRotation );
796 QString mTemplateUuid;
798 bool mCompositionManagesZValue;
806 void refreshRotation(
const bool updateItem =
true,
const bool rotateAroundCenter =
false );
813 void refreshTransparency(
const bool updateItem =
true );
818 void refreshBlendMode();
820 void init(
const bool manageZValue );