1 #ifndef QGSCOMPOSERRULER_H
2 #define QGSCOMPOSERRULER_H
7 class QGraphicsLineItem;
24 QSize minimumSizeHint()
const override;
26 void setSceneTransform(
const QTransform& transform );
27 void updateMarker(
const QPointF& pos ) { mMarkerPos = pos; repaint(); }
35 void paintEvent( QPaintEvent* event )
override;
36 void mouseMoveEvent( QMouseEvent* event )
override;
37 void mouseReleaseEvent( QMouseEvent* event )
override;
38 void mousePressEvent( QMouseEvent* event )
override;
41 static const int validScaleMultiples[];
42 static const int validScaleMagnitudes[];
45 QTransform mTransform;
48 QGraphicsLineItem* mLineSnapItem;
50 QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > > mSnappedItems;
53 QFontMetrics * mRulerFontMetrics;
54 double mScaleMinPixelsWidth;
56 int mMinPixelsPerDivision;
57 int mPixelsBetweenLineAndText;
59 int mMinSpacingVerticalLabels;
61 void setSnapLinePosition(
const QPointF& pos );
64 int optimumScale(
double minPixelDiff,
int &magnitude,
int &multiple );
67 int optimumNumberDivisions(
double rulerScale,
int scaleMultiple );
70 void drawRotatedText( QPainter *painter, QPointF pos,
const QString &text );
76 void drawSmallDivisions( QPainter *painter,
double startPos,
int numDivisions,
double rulerScale,
double maxPos = 0 );
79 void drawMarkerPos( QPainter *painter );
83 void cursorPosChanged( QPointF );
87 #endif // QGSCOMPOSERRULER_H