Qwt User's Guide 6.1.5

qwt_knob.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_KNOB_H
11 #define QWT_KNOB_H
12
13 #include "qwt_global.h"
14 #include "qwt_abstract_slider.h"
15
16 class QwtRoundScaleDraw;
17
42 class QWT_EXPORT QwtKnob: public QwtAbstractSlider
43 {
44 Q_OBJECT
45
46 Q_ENUMS ( KnobStyle MarkerStyle )
47
48 Q_PROPERTY( KnobStyle knobStyle READ knobStyle WRITE setKnobStyle )
49 Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth )
50 Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment )
51 Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
52 Q_PROPERTY( int numTurns READ numTurns WRITE setNumTurns )
53 Q_PROPERTY( MarkerStyle markerStyle READ markerStyle WRITE setMarkerStyle )
54 Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize )
55 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
56
57 public:
66 enum KnobStyle
67 {
69 Flat,
70
72 Raised,
73
78 Sunken,
79
84 Styled
85 };
86
95 enum MarkerStyle
96 {
98 NoMarker = -1,
99
101 Tick,
102
104 Triangle,
105
107 Dot,
108
113 Nub,
114
119 Notch
120 };
121
122 explicit QwtKnob( QWidget* parent = NULL );
123 virtual ~QwtKnob();
124
125 void setAlignment( Qt::Alignment );
126 Qt::Alignment alignment() const;
127
128 void setKnobWidth( int );
129 int knobWidth() const;
130
131 void setNumTurns( int );
132 int numTurns() const;
133
134 void setTotalAngle ( double angle );
135 double totalAngle() const;
136
137 void setKnobStyle( KnobStyle );
138 KnobStyle knobStyle() const;
139
140 void setBorderWidth( int );
141 int borderWidth() const;
142
143 void setMarkerStyle( MarkerStyle );
144 MarkerStyle markerStyle() const;
145
146 void setMarkerSize( int );
147 int markerSize() const;
148
149 virtual QSize sizeHint() const;
150 virtual QSize minimumSizeHint() const;
151
152 void setScaleDraw( QwtRoundScaleDraw * );
153
154 const QwtRoundScaleDraw *scaleDraw() const;
155 QwtRoundScaleDraw *scaleDraw();
156
157 QRect knobRect() const;
158
159 protected:
160 virtual void paintEvent( QPaintEvent * );
161 virtual void changeEvent( QEvent * );
162
163 virtual void drawKnob( QPainter *, const QRectF & ) const;
164
165 virtual void drawFocusIndicator( QPainter * ) const;
166
167 virtual void drawMarker( QPainter *,
168 const QRectF &, double angle ) const;
169
170 virtual double scrolledTo( const QPoint & ) const;
171 virtual bool isScrollPosition( const QPoint & ) const;
172
173 private:
174 class PrivateData;
175 PrivateData *d_data;
176 };
177
178 #endif
QwtKnob::Dot
Paint a circle in QPalette::ButtonText color.
Definition: qwt_knob.h:107
QwtKnob::Raised
Build a gradient from QPalette::Midlight and QPalette::Button.
Definition: qwt_knob.h:72
QwtKnob::MarkerStyle
MarkerStyle
Marker type.
Definition: qwt_knob.h:95
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
QwtKnob::Sunken
Definition: qwt_knob.h:78
QwtKnob::Nub
Definition: qwt_knob.h:113
QwtKnob::Triangle
Paint a triangle in QPalette::ButtonText color.
Definition: qwt_knob.h:104
QwtKnob::KnobStyle
KnobStyle
Style of the knob surface.
Definition: qwt_knob.h:66
QwtAbstractSlider::scrolledTo
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
QwtKnob::Flat
Fill the knob with a brush from QPalette::Button.
Definition: qwt_knob.h:69
QwtKnob
The Knob Widget.
Definition: qwt_knob.h:42
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:30
QwtKnob::Tick
Paint a single tick in QPalette::ButtonText color.
Definition: qwt_knob.h:101