The QwtKnob widget imitates look and behaviour of a volume knob on a radio. It contains a scale around the knob which is set up automatically or can be configured manually (see QwtAbstractScale). Automatic scrolling is enabled when the user presses a mouse button on the scale. For a description of signals, slots and other members, see QwtAbstractSlider.
Definition at line 34 of file qwt_knob.h.
Public Types | |
enum | Symbol { Line, Dot } |
Public Member Functions | |
QwtKnob (QWidget *parent=NULL) | |
virtual | ~QwtKnob () |
void | setKnobWidth (int w) |
int | knobWidth () const |
void | setTotalAngle (double angle) |
double | totalAngle () const |
void | setBorderWidth (int bw) |
int | borderWidth () const |
void | setSymbol (Symbol) |
Symbol | symbol () const |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
void | setScaleDraw (QwtRoundScaleDraw *) |
const QwtRoundScaleDraw * | scaleDraw () const |
QwtRoundScaleDraw * | scaleDraw () |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
void | draw (QPainter *p, const QRect &ur) |
void | drawKnob (QPainter *p, const QRect &r) |
void | drawMarker (QPainter *p, double arc, const QColor &c) |
enum QwtKnob::Symbol |
QwtKnob::QwtKnob | ( | QWidget * | parent = NULL |
) | [explicit] |
QwtKnob::~QwtKnob | ( | ) | [virtual] |
void QwtKnob::setKnobWidth | ( | int | w | ) |
Change the knob's width.
The specified width must be >= 5, or it will be clipped.
w | New width |
Definition at line 453 of file qwt_knob.cpp.
int QwtKnob::knobWidth | ( | ) | const |
void QwtKnob::setTotalAngle | ( | double | angle | ) |
Set the total angle by which the knob can be turned.
angle | Angle in degrees. |
Definition at line 134 of file qwt_knob.cpp.
References scaleDraw(), and QwtRoundScaleDraw::setAngleRange().
Referenced by setScaleDraw().
double QwtKnob::totalAngle | ( | ) | const |
void QwtKnob::setBorderWidth | ( | int | bw | ) |
Set the knob's border width.
bw | new border width |
Definition at line 469 of file qwt_knob.cpp.
int QwtKnob::borderWidth | ( | ) | const |
void QwtKnob::setSymbol | ( | QwtKnob::Symbol | s | ) |
QwtKnob::Symbol QwtKnob::symbol | ( | ) | const |
QSize QwtKnob::sizeHint | ( | ) | const [virtual] |
Definition at line 527 of file qwt_knob.cpp.
References minimumSizeHint().
QSize QwtKnob::minimumSizeHint | ( | ) | const [virtual] |
Return a minimum size hint.
Definition at line 537 of file qwt_knob.cpp.
References QwtRoundScaleDraw::extent(), and scaleDraw().
Referenced by sizeHint().
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 161 of file qwt_knob.cpp.
References QwtAbstractScale::setAbstractScaleDraw(), and setTotalAngle().
const QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) | const |
Definition at line 171 of file qwt_knob.cpp.
References QwtAbstractScale::abstractScaleDraw().
Referenced by draw(), minimumSizeHint(), and setTotalAngle().
QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) |
Definition at line 180 of file qwt_knob.cpp.
References QwtAbstractScale::abstractScaleDraw().
void QwtKnob::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
void QwtKnob::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
void QwtKnob::draw | ( | QPainter * | p, | |
const QRect & | ur | |||
) | [protected] |
Repaint the knob.
Definition at line 383 of file qwt_knob.cpp.
References QwtAbstractScaleDraw::draw(), drawKnob(), and scaleDraw().
Referenced by paintEvent().
void QwtKnob::drawKnob | ( | QPainter * | painter, | |
const QRect & | r | |||
) | [protected] |
Draw the knob.
painter | painter | |
r | Bounding rectangle of the knob (without scale) |
Definition at line 190 of file qwt_knob.cpp.
References drawMarker(), and QwtAbstractSlider::isValid().
Referenced by draw().
void QwtKnob::drawMarker | ( | QPainter * | p, | |
double | arc, | |||
const QColor & | c | |||
) | [protected] |
Draw the marker at the knob's front.
p | Painter | |
arc | Angle of the marker | |
c | Marker color |
Definition at line 406 of file qwt_knob.cpp.
Referenced by drawKnob().