Qwt User's Guide 6.2.0

qwt_dial.h
1 /******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_DIAL_H
11 #define QWT_DIAL_H
12
13 #include "qwt_global.h"
14 #include "qwt_abstract_slider.h"
15
16 #include <qframe.h>
17 #include <qpalette.h>
18
19 class QwtDialNeedle;
20 class QwtRoundScaleDraw;
21 class QwtAbstractScaleDraw;
22
50 class QWT_EXPORT QwtDial : public QwtAbstractSlider
51 {
52 Q_OBJECT
53
54 Q_ENUMS( Shadow Mode Direction )
55
56 Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
57 Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
58 Q_PROPERTY( Mode mode READ mode WRITE setMode )
59 Q_PROPERTY( double origin READ origin WRITE setOrigin )
60 Q_PROPERTY( double minScaleArc READ minScaleArc WRITE setMinScaleArc )
61 Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc )
62
63 public:
64
73 enum Shadow
74 {
76 Plain = QFrame::Plain,
77
79 Raised = QFrame::Raised,
80
82 Sunken = QFrame::Sunken
83 };
84
86 enum Mode
87 {
89 RotateNeedle,
90
92 RotateScale
93 };
94
95 explicit QwtDial( QWidget* parent = NULL );
96 virtual ~QwtDial();
97
98 void setFrameShadow( Shadow );
99 Shadow frameShadow() const;
100
101 void setLineWidth( int );
102 int lineWidth() const;
103
104 void setMode( Mode );
105 Mode mode() const;
106
107 void setScaleArc( double minArc, double maxArc );
108
109 void setMinScaleArc( double );
110 double minScaleArc() const;
111
112 void setMaxScaleArc( double );
113 double maxScaleArc() const;
114
115 virtual void setOrigin( double );
116 double origin() const;
117
118 void setNeedle( QwtDialNeedle* );
119 const QwtDialNeedle* needle() const;
120 QwtDialNeedle* needle();
121
122 QRect boundingRect() const;
123 QRect innerRect() const;
124
125 virtual QRect scaleInnerRect() const;
126
127 virtual QSize sizeHint() const QWT_OVERRIDE;
128 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
129
130 void setScaleDraw( QwtRoundScaleDraw* );
131
132 QwtRoundScaleDraw* scaleDraw();
133 const QwtRoundScaleDraw* scaleDraw() const;
134
135 protected:
136 virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
137 virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
138 virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
139
140 virtual void drawFrame( QPainter* );
141 virtual void drawContents( QPainter* ) const;
142 virtual void drawFocusIndicator( QPainter* ) const;
143
144 void invalidateCache();
145
146 virtual void drawScale( QPainter*,
147 const QPointF& center, double radius ) const;
148
149 virtual void drawScaleContents( QPainter* painter,
150 const QPointF& center, double radius ) const;
151
152 virtual void drawNeedle( QPainter*, const QPointF&,
153 double radius, double direction, QPalette::ColorGroup ) const;
154
155 virtual double scrolledTo( const QPoint& ) const QWT_OVERRIDE;
156 virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
157
158 virtual void sliderChange() QWT_OVERRIDE;
159 virtual void scaleChange() QWT_OVERRIDE;
160
161 private:
162 void setAngleRange( double angle, double span );
163 void drawNeedle( QPainter* ) const;
164
165 class PrivateData;
166 PrivateData* m_data;
167 };
168
169 #endif
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition: qwt_abstract_scale_draw.h:32
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:33
QwtDial
QwtDial class provides a rounded range control.
Definition: qwt_dial.h:51
QwtDial::Mode
Mode
Mode controlling whether the needle or the scale is rotating.
Definition: qwt_dial.h:87
QwtDial::RotateNeedle
@ RotateNeedle
The needle is rotating.
Definition: qwt_dial.h:89
QwtDial::Shadow
Shadow
Frame shadow.
Definition: qwt_dial.h:74
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:28
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:32