Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_knob.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_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 QWT_OVERRIDE;
150 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
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* ) QWT_OVERRIDE;
161 virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
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 QWT_OVERRIDE;
171 virtual bool isScrollPosition( const QPoint& ) const QWT_OVERRIDE;
172
173 private:
174 class PrivateData;
175 PrivateData* m_data;
176};
177
178#endif
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition qwt_abstract_slider.h:33
QwtKnob
The Knob Widget.
Definition qwt_knob.h:43
QwtKnob::MarkerStyle
MarkerStyle
Marker type.
Definition qwt_knob.h:96
QwtKnob::Nub
@ Nub
Definition qwt_knob.h:113
QwtKnob::Dot
@ Dot
Paint a circle in QPalette::ButtonText color.
Definition qwt_knob.h:107
QwtKnob::Tick
@ Tick
Paint a single tick in QPalette::ButtonText color.
Definition qwt_knob.h:101
QwtKnob::Triangle
@ 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:67
QwtKnob::Flat
@ Flat
Fill the knob with a brush from QPalette::Button.
Definition qwt_knob.h:69
QwtKnob::Sunken
@ Sunken
Definition qwt_knob.h:78
QwtKnob::Raised
@ Raised
Build a gradient from QPalette::Midlight and QPalette::Button.
Definition qwt_knob.h:72
QwtRoundScaleDraw
A class for drawing round scales.
Definition qwt_round_scale_draw.h:32