Qwt User's Guide 6.3.0
|
The Knob Widget. More...
#include <qwt_knob.h>
Public Types | |
enum | KnobStyle { Flat , Raised , Sunken , Styled } |
Style of the knob surface. More... | |
enum | MarkerStyle { NoMarker = -1 , Tick , Triangle , Dot , Nub , Notch } |
Marker type. More... | |
Public Member Functions | |
QwtKnob (QWidget *parent=NULL) | |
Constructor. | |
virtual | ~QwtKnob () |
Destructor. | |
void | setAlignment (Qt::Alignment) |
Set the alignment of the knob. | |
Qt::Alignment | alignment () const |
void | setKnobWidth (int) |
Change the knob's width. | |
int | knobWidth () const |
Return the width of the knob. | |
void | setNumTurns (int) |
Set the number of turns. | |
int | numTurns () const |
void | setTotalAngle (double angle) |
Set the total angle by which the knob can be turned. | |
double | totalAngle () const |
void | setKnobStyle (KnobStyle) |
Set the knob type. | |
KnobStyle | knobStyle () const |
void | setBorderWidth (int) |
Set the knob's border width. | |
int | borderWidth () const |
Return the border width. | |
void | setMarkerStyle (MarkerStyle) |
Set the marker type of the knob. | |
MarkerStyle | markerStyle () const |
void | setMarkerSize (int) |
Set the size of the marker. | |
int | markerSize () const |
virtual QSize | sizeHint () const override |
virtual QSize | minimumSizeHint () const override |
void | setScaleDraw (QwtRoundScaleDraw *) |
const QwtRoundScaleDraw * | scaleDraw () const |
QwtRoundScaleDraw * | scaleDraw () |
QRect | knobRect () const |
Public Member Functions inherited from QwtAbstractSlider | |
QwtAbstractSlider (QWidget *parent=NULL) | |
Constructor. | |
virtual | ~QwtAbstractSlider () |
Destructor. | |
void | setValid (bool) |
bool | isValid () const |
double | value () const |
Returns the current value. | |
void | setWrapping (bool) |
bool | wrapping () const |
void | setTotalSteps (uint) |
Set the number of steps. | |
uint | totalSteps () const |
void | setSingleSteps (uint) |
Set the number of steps for a single increment. | |
uint | singleSteps () const |
void | setPageSteps (uint) |
Set the number of steps for a page increment. | |
uint | pageSteps () const |
void | setStepAlignment (bool) |
Enable step alignment. | |
bool | stepAlignment () const |
void | setTracking (bool) |
Enables or disables tracking. | |
bool | isTracking () const |
void | setReadOnly (bool) |
bool | isReadOnly () const |
void | setInvertedControls (bool) |
bool | invertedControls () const |
Public Member Functions inherited from QwtAbstractScale | |
QwtAbstractScale (QWidget *parent=NULL) | |
virtual | ~QwtAbstractScale () |
Destructor. | |
void | setScale (double lowerBound, double upperBound) |
Specify a scale. | |
void | setScale (const QwtInterval &) |
Specify a scale. | |
void | setScale (const QwtScaleDiv &) |
Specify a scale. | |
const QwtScaleDiv & | scaleDiv () const |
void | setLowerBound (double value) |
double | lowerBound () const |
void | setUpperBound (double value) |
double | upperBound () const |
void | setScaleStepSize (double stepSize) |
Set the step size used for calculating a scale division. | |
double | scaleStepSize () const |
void | setScaleMaxMajor (int ticks) |
Set the maximum number of major tick intervals. | |
int | scaleMaxMinor () const |
void | setScaleMaxMinor (int ticks) |
Set the maximum number of minor tick intervals. | |
int | scaleMaxMajor () const |
void | setScaleEngine (QwtScaleEngine *) |
Set a scale engine. | |
const QwtScaleEngine * | scaleEngine () const |
QwtScaleEngine * | scaleEngine () |
int | transform (double) const |
double | invTransform (int) const |
bool | isInverted () const |
double | minimum () const |
double | maximum () const |
const QwtScaleMap & | scaleMap () const |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *) override |
virtual void | changeEvent (QEvent *) override |
virtual void | drawKnob (QPainter *, const QRectF &) const |
Draw the knob. | |
virtual void | drawFocusIndicator (QPainter *) const |
virtual void | drawMarker (QPainter *, const QRectF &, double angle) const |
Draw the marker at the knob's front. | |
virtual double | scrolledTo (const QPoint &) const override |
Determine the value for a new position of the mouse. | |
virtual bool | isScrollPosition (const QPoint &) const override |
Determine what to do when the user presses a mouse button. | |
Protected Member Functions inherited from QwtAbstractSlider | |
virtual void | mousePressEvent (QMouseEvent *) override |
virtual void | mouseReleaseEvent (QMouseEvent *) override |
virtual void | mouseMoveEvent (QMouseEvent *) override |
virtual void | keyPressEvent (QKeyEvent *) override |
virtual void | wheelEvent (QWheelEvent *) override |
void | incrementValue (int stepCount) |
virtual void | scaleChange () override |
virtual void | sliderChange () |
Calling update() | |
double | incrementedValue (double value, int stepCount) const |
Protected Member Functions inherited from QwtAbstractScale | |
void | rescale (double lowerBound, double upperBound, double stepSize) |
void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
Set a scale draw. | |
const QwtAbstractScaleDraw * | abstractScaleDraw () const |
QwtAbstractScaleDraw * | abstractScaleDraw () |
void | updateScaleDraw () |
Additional Inherited Members | |
Public Slots inherited from QwtAbstractSlider | |
void | setValue (double value) |
Signals inherited from QwtAbstractSlider | |
void | valueChanged (double value) |
Notify a change of value. | |
void | sliderPressed () |
void | sliderReleased () |
void | sliderMoved (double value) |
The Knob Widget.
The QwtKnob widget imitates look and behavior of a volume knob on a radio. It looks similar to QDial - not to QwtDial.
The value range of a knob might be divided into several turns.
The layout of the knob depends on the knobWidth().
Setting a fixed knobWidth() is helpful to align several knobs with different scale labels.
Definition at line 42 of file qwt_knob.h.
enum QwtKnob::KnobStyle |
Style of the knob surface.
Depending on the KnobStyle the surface of the knob is filled from the brushes of the widget palette().
Definition at line 66 of file qwt_knob.h.
enum QwtKnob::MarkerStyle |
Marker type.
The marker indicates the current value on the knob The default setting is a Notch marker.
Definition at line 95 of file qwt_knob.h.
|
explicit |
Constructor.
Construct a knob with an angle of 270°. The style is QwtKnob::Raised and the marker style is QwtKnob::Notch. The width of the knob is set to 50 pixels.
parent | Parent widget |
Definition at line 103 of file qwt_knob.cpp.
|
virtual |
Destructor.
Definition at line 120 of file qwt_knob.cpp.
Qt::Alignment QwtKnob::alignment | ( | ) | const |
Definition at line 743 of file qwt_knob.cpp.
int QwtKnob::borderWidth | ( | ) | const |
Return the border width.
Definition at line 799 of file qwt_knob.cpp.
|
overrideprotectedvirtual |
Handle QEvent::StyleChange and QEvent::FontChange;
event | Change event |
Reimplemented from QwtAbstractScale.
Definition at line 431 of file qwt_knob.cpp.
|
protectedvirtual |
|
protectedvirtual |
Draw the knob.
painter | painter |
knobRect | Bounding rectangle of the knob (without scale) |
Definition at line 489 of file qwt_knob.cpp.
|
protectedvirtual |
Draw the marker at the knob's front.
painter | Painter |
rect | Bounding rectangle of the knob without scale |
angle | Angle of the marker in degrees ( clockwise, 0 at the 12 o'clock position ) |
Definition at line 576 of file qwt_knob.cpp.
|
overrideprotectedvirtual |
Determine what to do when the user presses a mouse button.
pos | Mouse position |
True,when | pos is inside the circle of the knob. |
Implements QwtAbstractSlider.
Definition at line 347 of file qwt_knob.cpp.
QRect QwtKnob::knobRect | ( | ) | const |
Calculate the bounding rectangle of the knob without the scale
Definition at line 292 of file qwt_knob.cpp.
QwtKnob::KnobStyle QwtKnob::knobStyle | ( | ) | const |
Definition at line 144 of file qwt_knob.cpp.
int QwtKnob::knobWidth | ( | ) | const |
Return the width of the knob.
Definition at line 781 of file qwt_knob.cpp.
int QwtKnob::markerSize | ( | ) | const |
QwtKnob::MarkerStyle QwtKnob::markerStyle | ( | ) | const |
Definition at line 168 of file qwt_knob.cpp.
|
overridevirtual |
int QwtKnob::numTurns | ( | ) | const |
When the total angle is below 360° numTurns() is ceiled to 1.
Definition at line 245 of file qwt_knob.cpp.
|
overrideprotectedvirtual |
QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) |
Definition at line 281 of file qwt_knob.cpp.
const QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) | const |
Definition at line 272 of file qwt_knob.cpp.
|
overrideprotectedvirtual |
Determine the value for a new position of the mouse.
pos | Mouse position |
Implements QwtAbstractSlider.
Definition at line 373 of file qwt_knob.cpp.
void QwtKnob::setAlignment | ( | Qt::Alignment | alignment | ) |
Set the alignment of the knob.
Similar to a QLabel::alignment() the flags decide how to align the knob inside of contentsRect().
The default setting is Qt::AlignCenter
alignment | Or'd alignment flags |
Definition at line 730 of file qwt_knob.cpp.
void QwtKnob::setBorderWidth | ( | int | borderWidth | ) |
Set the knob's border width.
borderWidth | new border width |
Definition at line 790 of file qwt_knob.cpp.
void QwtKnob::setKnobStyle | ( | KnobStyle | knobStyle | ) |
Set the knob type.
knobStyle | Knob type |
Definition at line 131 of file qwt_knob.cpp.
void QwtKnob::setKnobWidth | ( | int | width | ) |
Change the knob's width.
Setting a fixed value for the diameter of the knob is helpful for aligning several knobs in a row.
width | New width |
Definition at line 759 of file qwt_knob.cpp.
void QwtKnob::setMarkerSize | ( | int | size | ) |
Set the size of the marker.
When setting a size <= 0 the marker will automatically scaled to 40% of the radius of the knob.
Definition at line 812 of file qwt_knob.cpp.
void QwtKnob::setMarkerStyle | ( | MarkerStyle | markerStyle | ) |
Set the marker type of the knob.
markerStyle | Marker type |
Definition at line 155 of file qwt_knob.cpp.
void QwtKnob::setNumTurns | ( | int | numTurns | ) |
Set the number of turns.
When numTurns > 1 the knob can be turned several times around its axis
Definition at line 219 of file qwt_knob.cpp.
void QwtKnob::setScaleDraw | ( | QwtRoundScaleDraw * | scaleDraw | ) |
Change the scale draw of the knob
For changing the labels of the scales, it is necessary to derive from QwtRoundScaleDraw and overload QwtRoundScaleDraw::label().
Definition at line 259 of file qwt_knob.cpp.
void QwtKnob::setTotalAngle | ( | double | angle | ) |
Set the total angle by which the knob can be turned.
angle | Angle in degrees. |
The angle has to be between [10, 360] degrees. Angles above 360 ( so that the knob can be turned several times around its axis ) have to be set using setNumTurns().
The default angle is 270 degrees.
Definition at line 185 of file qwt_knob.cpp.
|
overridevirtual |
Definition at line 833 of file qwt_knob.cpp.
double QwtKnob::totalAngle | ( | ) | const |
Definition at line 205 of file qwt_knob.cpp.