17 #ifndef QGSCOMPOSERITEM_H
18 #define QGSCOMPOSERITEM_H
24 #include <QGraphicsRectItem>
30 class QGraphicsLineItem;
46 ComposerItem = UserType + 100,
119 virtual int type()
const {
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 );
241 void setFrameEnabled(
const bool drawFrame );
251 virtual void setFrameOutlineColor(
const QColor& color );
271 virtual void setFrameOutlineWidth(
const double outlineWidth );
301 void setFrameJoinStyle(
const Qt::PenJoinStyle style );
310 virtual double estimatedFrameBleed()
const;
320 virtual QRectF rectWithFrame()
const;
354 void setBackgroundColor(
const QColor& backgroundColor );
360 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
366 void setBlendMode(
const QPainter::CompositionMode blendMode );
378 void setTransparency(
const int transparency );
396 void setEffectsEnabled(
const bool effectsEnabled );
412 void cancelCommand();
421 Q_DECL_DEPRECATED
void drawText( QPainter* p,
double x,
double y,
const QString& text,
const QFont& font,
const QColor& c = QColor() )
const;
433 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;
438 Q_DECL_DEPRECATED
double textWidthMillimeters(
const QFont& font,
const QString& text )
const;
443 Q_DECL_DEPRECATED
double fontHeightCharacterMM(
const QFont& font,
const QChar& c )
const;
448 Q_DECL_DEPRECATED
double fontAscentMillimeters(
const QFont& font )
const;
453 Q_DECL_DEPRECATED
double fontDescentMillimeters(
const QFont& font )
const;
460 Q_DECL_DEPRECATED
double fontHeightMillimeters(
const QFont& font )
const;
465 Q_DECL_DEPRECATED
double pixelFontSize(
double pointSize )
const;
470 Q_DECL_DEPRECATED QFont scaledFontPixelSize(
const QFont& font )
const;
476 void setPositionLock(
const bool lock );
498 Q_DECL_DEPRECATED
double rotation()
const {
return mEvaluatedItemRotation; }
507 QString
id()
const {
return mId; }
513 virtual void setId(
const QString&
id );
521 QString
uuid()
const {
return mUuid; }
530 virtual QString displayName()
const;
539 virtual void setVisibility(
const bool visible );
555 virtual void setExcludeFromExports(
const bool exclude );
569 void setIsGroupMember(
const bool isGroupMember );
590 virtual void setRotation(
double r );
599 virtual void setItemRotation(
const double r,
const bool adjustPosition =
false );
679 virtual void drawSelectionBoxes( QPainter* p );
682 virtual void drawFrame( QPainter* p );
685 virtual void drawBackground( QPainter* p );
690 Q_DECL_DEPRECATED
void drawArrowHead( QPainter* p,
double x,
double y,
double angle,
double arrowHeadWidth )
const;
695 Q_DECL_DEPRECATED
double angle(
const QPointF& p1,
const QPointF& p2 )
const;
699 double rectHandlerBorderTolerance()
const;
704 Q_DECL_DEPRECATED
double lockSymbolSize()
const;
709 double horizontalViewScaleFactor()
const;
716 Q_DECL_DEPRECATED
bool imageSizeConsideringRotation(
double& width,
double& height,
double rotation )
const;
721 Q_DECL_DEPRECATED
bool imageSizeConsideringRotation(
double& width,
double& height )
const;
730 Q_DECL_DEPRECATED QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boundsRect,
double rotation )
const;
735 Q_DECL_DEPRECATED
bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height,
double rotation )
const;
740 Q_DECL_DEPRECATED
bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height )
const;
745 Q_DECL_DEPRECATED
void sizeChangedByRotation(
double& width,
double& height,
double rotation );
750 Q_DECL_DEPRECATED
void sizeChangedByRotation(
double& width,
double& height );
758 Q_DECL_DEPRECATED
void rotate(
double angle,
double& x,
double& y )
const;
761 QGraphicsLineItem* hAlignSnapItem();
762 void deleteHAlignSnapItem();
764 QGraphicsLineItem* vAlignSnapItem();
765 void deleteVAlignSnapItem();
766 void deleteAlignItems();
778 QRectF evalItemRect(
const QRectF &newRect,
const bool resizeOnly =
false );
784 bool shouldDrawItem()
const;
788 void itemRotationChanged(
double newRotation );
806 QString mTemplateUuid;
808 bool mCompositionManagesZValue;
816 void refreshRotation(
const bool updateItem =
true,
const bool rotateAroundCenter =
false );
823 void refreshTransparency(
const bool updateItem =
true );
828 void refreshBlendMode();
830 void init(
const bool manageZValue );