Qwt User's Guide: qwt_dial.h Source File

Qwt User's Guide 6.1.5

qwt_dial.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 1
12
13 #include "qwt_global.h"
14 #include "qwt_abstract_slider.h"
15 #include "qwt_abstract_scale_draw.h"
16 #include <qframe.h>
17 #include <qpalette.h>
18
19 class QwtDialNeedle;
20 class QwtRoundScaleDraw;
21
49 class QWT_EXPORT QwtDial: public QwtAbstractSlider
50 {
51 Q_OBJECT
52
53 Q_ENUMS( Shadow Mode Direction )
54
55 Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
56 Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
57 Q_PROPERTY( Mode mode READ mode WRITE setMode )
58 Q_PROPERTY( double origin READ origin WRITE setOrigin )
59 Q_PROPERTY( double minScaleArc READ minScaleArc WRITE setMinScaleArc )
60 Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc )
61
62 public:
63
72 enum Shadow
73 {
75 Plain = QFrame::Plain,
76
78 Raised = QFrame::Raised,
79
81 Sunken = QFrame::Sunken
82 };
83
85 enum Mode
86 {
88 RotateNeedle,
89
91 RotateScale
92 };
93
94 explicit QwtDial( QWidget *parent = NULL );
95 virtual ~QwtDial();
96
97 void setFrameShadow( Shadow );
98 Shadow frameShadow() const;
99
100 void setLineWidth( int );
101 int lineWidth() const;
102
103 void setMode( Mode );
104 Mode mode() const;
105
106 void setScaleArc( double minArc, double maxArc );
107
108 void setMinScaleArc( double );
109 double minScaleArc() const;
110
111 void setMaxScaleArc( double );
112 double maxScaleArc() const;
113
114 virtual void setOrigin( double );
115 double origin() const;
116
117 void setNeedle( QwtDialNeedle * );
118 const QwtDialNeedle *needle() const;
119 QwtDialNeedle *needle();
120
121 QRect boundingRect() const;
122 QRect innerRect() const;
123
124 virtual QRect scaleInnerRect() const;
125
126 virtual QSize sizeHint() const;
127 virtual QSize minimumSizeHint() const;
128
129 void setScaleDraw( QwtRoundScaleDraw * );
130
131 QwtRoundScaleDraw *scaleDraw();
132 const QwtRoundScaleDraw *scaleDraw() const;
133
134 protected:
135 virtual void wheelEvent( QWheelEvent * );
136 virtual void paintEvent( QPaintEvent * );
137 virtual void changeEvent( QEvent * );
138
139 virtual void drawFrame( QPainter * );
140 virtual void drawContents( QPainter * ) const;
141 virtual void drawFocusIndicator( QPainter * ) const;
142
143 void invalidateCache();
144
145 virtual void drawScale( QPainter *,
146 const QPointF &center, double radius ) const;
147
148 virtual void drawScaleContents( QPainter *painter,
149 const QPointF &center, double radius ) const;
150
151 virtual void drawNeedle( QPainter *, const QPointF &,
152 double radius, double direction, QPalette::ColorGroup ) const;
153
154 virtual double scrolledTo( const QPoint & ) const;
155 virtual bool isScrollPosition( const QPoint & ) const;
156
157 virtual void sliderChange();
158 virtual void scaleChange();
159
160 private:
161 void setAngleRange( double angle, double span );
162 void drawNeedle( QPainter * ) const;
163
164 class PrivateData;
165 PrivateData *d_data;
166 };
167
168 #endif
QwtDial::Shadow
Shadow
Frame shadow.
Definition: qwt_dial.h:72
QwtAbstractSlider::isScrollPosition
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:32
QwtAbstractSlider::wheelEvent
virtual void wheelEvent(QWheelEvent *)
Definition: qwt_abstract_slider.cpp:299
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:28
QwtDial::Mode
Mode
Mode controlling whether the needle or the scale is rotating.
Definition: qwt_dial.h:85
QwtDial::RotateNeedle
The needle is rotating.
Definition: qwt_dial.h:88
QwtDial
QwtDial class provides a rounded range control.
Definition: qwt_dial.h:49
QwtAbstractSlider::scrolledTo
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:30
QwtAbstractSlider::sliderChange
virtual void sliderChange()
Calling update()
Definition: qwt_abstract_slider.cpp:819
QwtAbstractSlider::scaleChange
virtual void scaleChange()
Definition: qwt_abstract_slider.cpp:801