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 #include <QPainterPath>
28 
29 #include "RCoordinateListener.h"
30 #include "RPaletteListener.h"
31 #include "RRuler.h"
32 #include "RVector.h"
33 
34 class RGraphicsView;
35 class RDocumentInterface;
36 
44 class QCADGUI_EXPORT RRulerQt: public QFrame, public RRuler, public RCoordinateListener, public RPaletteListener {
45 
46 Q_OBJECT
47 Q_PROPERTY(Qt::Orientation orientation READ getOrientation WRITE setOrientation);
48 
49 public:
50  RRulerQt(QWidget* parent=0);
51  virtual ~RRulerQt();
52 
53  virtual void setOrientation(Qt::Orientation orientation);
54 
55  virtual QSize sizeHint() const;
56 
57  virtual void paintTick(int pos, bool major, const QString& label);
58 
59  virtual QFont getFont() const;
60 
61  virtual void updateViewport();
62 
63  virtual void updateCoordinate(RDocumentInterface* documentInterface);
64 
65  virtual void updatePalette() {
66  lastSize = QSize(0,0);
67  darkGuiBackground = -1;
68  }
69 
70 protected:
71  void paintEvent(QPaintEvent *);
72 
73 private:
74  QPainter *painter;
75  QImage buffer;
76  QSize lastSize;
78  QPainterPath cursorArrow;
81  mutable QSize hint;
82 };
83 
85 
86 #endif
RRuler::setOrientation
void setOrientation(Qt::Orientation orientation)
Definition: RRuler.h:55
RRulerQt::cursorPosition
RVector cursorPosition
Definition: RRulerQt.h:79
gui_global.h
RRulerQt::painter
QPainter * painter
Definition: RRulerQt.h:74
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RCoordinateListener.h
RRulerQt::updatePalette
virtual void updatePalette()
This method is called whenever the current palette has changed.
Definition: RRulerQt.h:65
RRuler::paintTick
virtual void paintTick(int pos, bool major, const QString &label)=0
RCoordinateListener::updateCoordinate
virtual void updateCoordinate(RDocumentInterface *documentInterface)=0
RPaletteListener
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPaletteListener.h:33
RRuler::updateViewport
virtual void updateViewport()=0
RGraphicsView
Graphics view.
Definition: RGraphicsView.h:58
RVector.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RRuler
Abstract base class for widgets that display a ruler, usually shown at the top and left of a graphics...
Definition: RRuler.h:37
RRulerQt::viewportChanged
bool viewportChanged
Definition: RRulerQt.h:77
RRulerQt::cursorArrow
QPainterPath cursorArrow
Definition: RRulerQt.h:78
RRulerQt
Widget that displays the current mouse position.
Definition: RRulerQt.h:44
RPaletteListener.h
QCADGUI_EXPORT
#define QCADGUI_EXPORT
Definition: gui_global.h:10
RRulerQt::buffer
QImage buffer
Definition: RRulerQt.h:75
RRuler::getFont
virtual QFont getFont() const =0
RRulerQt::darkGuiBackground
int darkGuiBackground
Definition: RRulerQt.h:80
RRulerQt::lastSize
QSize lastSize
Definition: RRulerQt.h:76
RRulerQt::hint
QSize hint
Definition: RRulerQt.h:81
RRuler.h
RDocumentInterface
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:85
RCoordinateListener
Abstract base class for classes that are interested in the current coordinate of the mouse cursor.
Definition: RCoordinateListener.h:38