QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposerruler.h
Go to the documentation of this file.
1 #ifndef QGSCOMPOSERRULER_H
2 #define QGSCOMPOSERRULER_H
3 
4 #include "qgscomposeritem.h"
5 #include <QWidget>
6 class QgsComposition;
7 class QGraphicsLineItem;
8 
10 class GUI_EXPORT QgsComposerRuler: public QWidget
11 {
12  public:
13  enum Direction
14  {
15  Horizontal = 0,
16  Vertical
17  };
18 
21 
22  QSize minimumSizeHint() const;
23 
24  void setSceneTransform( const QTransform& transform );
25  void updateMarker( const QPointF& pos ) { mMarkerPos = pos; repaint(); }
26 
27  void setComposition( QgsComposition* c ) { mComposition = c; }
28  QgsComposition* composition() { return mComposition; }
29 
30  protected:
31  void paintEvent( QPaintEvent* event );
32  void mouseMoveEvent( QMouseEvent* event );
33  void mouseReleaseEvent( QMouseEvent* event );
34  void mousePressEvent( QMouseEvent* event );
35 
36  private:
38  QTransform mTransform;
39  QPointF mMarkerPos;
40  QgsComposition* mComposition; //reference to composition for paper size, nPages
41  QGraphicsLineItem* mLineSnapItem;
42  //items snapped to the current snap line
43  QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > > mSnappedItems;
44 
45  void setSnapLinePosition( const QPointF& pos );
46 };
47 
48 #endif // QGSCOMPOSERRULER_H