The Knob Widget. More...
#include <qwt_knob.h>
Classes | |
class | PrivateData |
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 | |
Qt::Alignment | alignment () const |
int | borderWidth () const |
QRect | knobRect () const |
KnobStyle | knobStyle () const |
int | knobWidth () const |
int | markerSize () const |
MarkerStyle | markerStyle () const |
virtual QSize | minimumSizeHint () const |
int | numTurns () const |
QwtKnob (QWidget *parent=NULL) | |
Constructor. | |
const QwtRoundScaleDraw * | scaleDraw () const |
QwtRoundScaleDraw * | scaleDraw () |
void | setAlignment (Qt::Alignment) |
Set the alignment of the knob. | |
void | setBorderWidth (int bw) |
Set the knob's border width. | |
void | setKnobStyle (KnobStyle) |
Set the knob type. | |
void | setKnobWidth (int) |
Change the knob's width. | |
void | setMarkerSize (int) |
Set the size of the marker. | |
void | setMarkerStyle (MarkerStyle) |
Set the marker type of the knob. | |
void | setNumTurns (int) |
Set the number of turns. | |
void | setScaleDraw (QwtRoundScaleDraw *) |
void | setTotalAngle (double angle) |
Set the total angle by which the knob can be turned. | |
virtual QSize | sizeHint () const |
double | totalAngle () const |
virtual | ~QwtKnob () |
Destructor. | |
Protected Member Functions | |
virtual void | changeEvent (QEvent *) |
virtual void | drawFocusIndicator (QPainter *) const |
virtual void | drawKnob (QPainter *, const QRectF &) const |
Draw the knob. | |
virtual void | drawMarker (QPainter *, const QRectF &, double arc) const |
Draw the marker at the knob's front. | |
virtual bool | isScrollPosition (const QPoint &) const |
Determine what to do when the user presses a mouse button. | |
virtual void | paintEvent (QPaintEvent *) |
virtual double | scrolledTo (const QPoint &) const |
Determine the value for a new position of the mouse. | |
Properties | |
Qt::Alignment | alignment |
int | borderWidth |
Return the border width. | |
KnobStyle | knobStyle |
int | knobWidth |
Return the width of the knob. | |
int | markerSize |
MarkerStyle | markerStyle |
int | numTurns |
double | totalAngle |
Private Attributes | |
PrivateData * | d_data |
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.
QwtKnob::QwtKnob | ( | QWidget * | parent = NULL | ) | [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 110 of file qwt_knob.cpp.
QwtKnob::~QwtKnob | ( | ) | [virtual] |
Destructor.
Definition at line 127 of file qwt_knob.cpp.
Qt::Alignment QwtKnob::alignment | ( | ) | const |
int QwtKnob::borderWidth | ( | ) | const |
void QwtKnob::changeEvent | ( | QEvent * | event | ) | [protected, virtual] |
Handle QEvent::StyleChange and QEvent::FontChange;
event | Change event |
Reimplemented from QwtAbstractScale.
Definition at line 438 of file qwt_knob.cpp.
void QwtKnob::drawFocusIndicator | ( | QPainter * | painter | ) | const [protected, virtual] |
void QwtKnob::drawKnob | ( | QPainter * | painter, |
const QRectF & | knobRect | ||
) | const [protected, virtual] |
Draw the knob.
painter | painter |
knobRect | Bounding rectangle of the knob (without scale) |
Definition at line 496 of file qwt_knob.cpp.
void QwtKnob::drawMarker | ( | QPainter * | painter, |
const QRectF & | rect, | ||
double | angle | ||
) | const [protected, virtual] |
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 583 of file qwt_knob.cpp.
bool QwtKnob::isScrollPosition | ( | const QPoint & | pos | ) | const [protected, virtual] |
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 354 of file qwt_knob.cpp.
QRect QwtKnob::knobRect | ( | ) | const |
Calculate the bounding rectangle of the knob without the scale
Definition at line 299 of file qwt_knob.cpp.
KnobStyle QwtKnob::knobStyle | ( | ) | const |
int QwtKnob::knobWidth | ( | ) | const |
int QwtKnob::markerSize | ( | ) | const |
MarkerStyle QwtKnob::markerStyle | ( | ) | const |
QSize QwtKnob::minimumSizeHint | ( | ) | const [virtual] |
int QwtKnob::numTurns | ( | ) | const |
void QwtKnob::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
const QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) | const |
Definition at line 279 of file qwt_knob.cpp.
Definition at line 288 of file qwt_knob.cpp.
double QwtKnob::scrolledTo | ( | const QPoint & | pos | ) | const [protected, virtual] |
Determine the value for a new position of the mouse.
pos | Mouse position |
Implements QwtAbstractSlider.
Definition at line 380 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 739 of file qwt_knob.cpp.
void QwtKnob::setBorderWidth | ( | int | borderWidth | ) |
Set the knob's border width.
borderWidth | new border width |
Definition at line 799 of file qwt_knob.cpp.
void QwtKnob::setKnobStyle | ( | KnobStyle | knobStyle | ) |
Set the knob type.
knobStyle | Knob type |
Definition at line 138 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 768 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 821 of file qwt_knob.cpp.
void QwtKnob::setMarkerStyle | ( | MarkerStyle | markerStyle | ) |
Set the marker type of the knob.
markerStyle | Marker type |
Definition at line 162 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 226 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 266 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 192 of file qwt_knob.cpp.
QSize QwtKnob::sizeHint | ( | ) | const [virtual] |
Definition at line 842 of file qwt_knob.cpp.
double QwtKnob::totalAngle | ( | ) | const |
PrivateData* QwtKnob::d_data [private] |
Reimplemented from QwtAbstractSlider.
Definition at line 174 of file qwt_knob.h.
Qt::Alignment QwtKnob::alignment [read, write] |
Definition at line 50 of file qwt_knob.h.
int QwtKnob::borderWidth [read, write] |
Return the border width.
Definition at line 55 of file qwt_knob.h.
QwtKnob::KnobStyle QwtKnob::knobStyle [read, write] |
Definition at line 48 of file qwt_knob.h.
int QwtKnob::knobWidth [read, write] |
Return the width of the knob.
Definition at line 49 of file qwt_knob.h.
int QwtKnob::markerSize [read, write] |
QwtKnob::MarkerStyle QwtKnob::markerStyle [read, write] |
Definition at line 53 of file qwt_knob.h.
int QwtKnob::numTurns [read, write] |
When the total angle is below 360° numTurns() is ceiled to 1.
Definition at line 52 of file qwt_knob.h.
double QwtKnob::totalAngle [read, write] |
Definition at line 51 of file qwt_knob.h.