QCAD
Open Source 2D CAD
RRulerQt.h
Go to the documentation of this file.
1 
20 #ifndef RRULERQT_H
21 #define RRULERQT_H
22 
23 #include "gui_global.h"
24 
25 #include <QFrame>
26 #include <QMetaType>
27 
28 #include "RCoordinateListener.h"
29 #include "RRuler.h"
30 #include "RVector.h"
31 
32 class RGraphicsView;
33 class RDocumentInterface;
34 
42 class QCADGUI_EXPORT RRulerQt: public QFrame, public RRuler, public RCoordinateListener {
43 
44 Q_OBJECT
45 Q_PROPERTY(Qt::Orientation orientation READ getOrientation WRITE setOrientation);
46 
47 public:
48  RRulerQt(QWidget* parent=0);
49  virtual ~RRulerQt();
50 
51  virtual void setOrientation(Qt::Orientation orientation);
52 
53  virtual QSize sizeHint() const;
54 
55  virtual void paintTick(int pos, bool major, const QString& label);
56 
57  virtual QFont getFont() const;
58 
59  void updateViewport();
60 
61  virtual void updateCoordinate(RDocumentInterface* documentInterface);
62 
63 protected:
64  void paintEvent(QPaintEvent *);
65 
66 private:
67  QPainter *painter;
68  QImage buffer;
69  QSize lastSize;
71  QPainterPath cursorArrow;
73  mutable QSize hint;
74 };
75 
77 
78 #endif
virtual void paintTick(int pos, bool major, const QString &label)=0
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RVector cursorPosition
Definition: RRulerQt.h:72
#define QCADGUI_EXPORT
Definition: gui_global.h:10
void setOrientation(Qt::Orientation orientation)
Definition: RRuler.h:54
QPainter * painter
Definition: RRulerQt.h:67
Widget that displays the current mouse position.
Definition: RRulerQt.h:42
virtual void updateCoordinate(RDocumentInterface *documentInterface)=0
virtual QFont getFont() const =0
Q_DECLARE_METATYPE(RMath *)
QPainterPath cursorArrow
Definition: RRulerQt.h:71
bool viewportChanged
Definition: RRulerQt.h:70
QSize hint
Definition: RRulerQt.h:73
Abstract base class for classes that are interested in the current coordinate of the mouse cursor...
Definition: RCoordinateListener.h:38
QSize lastSize
Definition: RRulerQt.h:69
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:82
QImage buffer
Definition: RRulerQt.h:68
Abstract base class for widgets that display a ruler, usually shown at the top and left of a graphics...
Definition: RRuler.h:37
Graphics view.
Definition: RGraphicsView.h:58