Qwt User's Guide
svn
|
#include <qwt_knob.h>
Inherits QwtAbstractSlider, and QwtAbstractScale.
Public Types | |
enum | KnobStyle { NoStyle = -1, Raised, Sunken } |
enum | MarkerStyle { NoMarker = -1, Tick, Dot, Nub, Notch } |
enum | ScrollMode { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage } |
Public Slots | |
virtual void | fitValue (double val) |
virtual void | incValue (int steps) |
virtual void | setReadOnly (bool) |
virtual void | setValue (double val) |
Signals | |
void | sliderMoved (double value) |
void | sliderPressed () |
void | sliderReleased () |
void | valueChanged (double value) |
Public Member Functions | |
bool | autoScale () const |
int | borderWidth () const |
virtual void | incPages (int) |
bool | isReadOnly () const |
bool | isValid () const |
KnobStyle | knobStyle () const |
int | knobWidth () const |
int | markerSize () const |
MarkerStyle | markerStyle () const |
virtual double | mass () const |
double | maxValue () const |
virtual QSize | minimumSizeHint () const |
double | minValue () const |
Qt::Orientation | orientation () const |
int | pageSize () const |
bool | periodic () const |
QwtKnob (QWidget *parent=NULL) | |
const QwtRoundScaleDraw * | scaleDraw () const |
QwtRoundScaleDraw * | scaleDraw () |
const QwtScaleEngine * | scaleEngine () const |
QwtScaleEngine * | scaleEngine () |
const QwtScaleMap & | scaleMap () const |
int | scaleMaxMajor () const |
int | scaleMaxMinor () const |
void | setAutoScale () |
void | setBorderWidth (int bw) |
void | setKnobStyle (KnobStyle) |
void | setKnobWidth (int w) |
void | setMarkerSize (int) |
void | setMarkerStyle (MarkerStyle) |
virtual void | setMass (double val) |
virtual void | setOrientation (Qt::Orientation o) |
void | setPeriodic (bool tf) |
void | setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1) |
void | setScale (double vmin, double vmax, double step=0.0) |
void | setScale (const QwtInterval &, double step=0.0) |
void | setScale (const QwtScaleDiv &) |
void | setScaleDraw (QwtRoundScaleDraw *) |
void | setScaleEngine (QwtScaleEngine *) |
void | setScaleMaxMajor (int ticks) |
void | setScaleMaxMinor (int ticks) |
void | setStep (double) |
void | setTotalAngle (double angle) |
void | setTracking (bool enable) |
void | setUpdateTime (int t) |
void | setValid (bool valid) |
virtual QSize | sizeHint () const |
double | step () const |
void | stopMoving () |
double | totalAngle () const |
double | value () const |
virtual | ~QwtKnob () |
Protected Member Functions | |
const QwtAbstractScaleDraw * | abstractScaleDraw () const |
QwtAbstractScaleDraw * | abstractScaleDraw () |
virtual void | changeEvent (QEvent *) |
virtual void | drawKnob (QPainter *, const QRectF &) const |
virtual void | drawMarker (QPainter *, const QRectF &, double arc) const |
double | exactPrevValue () const |
double | exactValue () const |
virtual void | getScrollMode (const QPoint &, QwtAbstractSlider::ScrollMode &, int &direction) const |
virtual double | getValue (const QPoint &p) |
virtual void | keyPressEvent (QKeyEvent *e) |
virtual void | mouseMoveEvent (QMouseEvent *e) |
double | mouseOffset () const |
virtual void | mousePressEvent (QMouseEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
virtual void | paintEvent (QPaintEvent *) |
double | prevValue () const |
void | rescale (double vmin, double vmax, double step=0.0) |
virtual void | resizeEvent (QResizeEvent *) |
int | scrollMode () const |
void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
void | setMouseOffset (double) |
virtual void | setPosition (const QPoint &) |
virtual void | stepChange () |
virtual void | timerEvent (QTimerEvent *e) |
virtual void | wheelEvent (QWheelEvent *e) |
The Knob Widget.
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.
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().
enum QwtKnob::MarkerStyle |
Marker type.
The marker indicates the current value on the knob The default setting is a Notch marker.
enum QwtAbstractSlider::ScrollMode [inherited] |
Scroll mode
QwtKnob::QwtKnob | ( | QWidget * | parent = NULL | ) | [explicit] |
Constructor
parent | Parent widget |
QwtKnob::~QwtKnob | ( | ) | [virtual] |
Destructor.
const QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw | ( | ) | const [protected, inherited] |
QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw | ( | ) | [protected, inherited] |
bool QwtAbstractScale::autoScale | ( | ) | const [inherited] |
true
if autoscaling is enabled int QwtKnob::borderWidth | ( | ) | const |
Return the border width.
void QwtKnob::changeEvent | ( | QEvent * | event | ) | [protected, virtual] |
Handle QEvent::StyleChange and QEvent::FontChange;
event | Change event |
void QwtKnob::drawKnob | ( | QPainter * | painter, |
const QRectF & | knobRect | ||
) | const [protected, virtual] |
Draw the knob.
painter | painter |
knobRect | Bounding rectangle of the knob (without scale) |
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 |
double QwtDoubleRange::exactPrevValue | ( | ) | const [protected, inherited] |
Returns the exact previous value.
double QwtDoubleRange::exactValue | ( | ) | const [protected, inherited] |
Returns the exact value.
The exact value is the value which QwtDoubleRange::value would return if the value were not adjusted to the step raster. It differs from the current value only if fitValue() or incValue() have been used before. This function is intended for internal use in derived classes.
void QwtAbstractSlider::fitValue | ( | double | value | ) | [virtual, slot, inherited] |
Set the slider's value to the nearest integer multiple of the step size.
value | Value |
Reimplemented from QwtDoubleRange.
void QwtKnob::getScrollMode | ( | const QPoint & | pos, |
QwtAbstractSlider::ScrollMode & | scrollMode, | ||
int & | direction | ||
) | const [protected, virtual] |
Set the scrolling mode and direction.
Called by QwtAbstractSlider
pos | Point in question |
scrollMode | Scrolling mode |
direction | Direction |
Implements QwtAbstractSlider.
double QwtKnob::getValue | ( | const QPoint & | pos | ) | [protected, virtual] |
Determine the value corresponding to a specified position.
Called by QwtAbstractSlider
pos | point |
Implements QwtAbstractSlider.
void QwtDoubleRange::incPages | ( | int | nPages | ) | [virtual, inherited] |
Increment the value by a specified number of pages.
nPages | Number of pages to increment. A negative number decrements the value. |
void QwtAbstractSlider::incValue | ( | int | steps | ) | [virtual, slot, inherited] |
Increment the value by a specified number of steps.
steps | number of steps |
Reimplemented from QwtDoubleRange.
bool QwtAbstractSlider::isReadOnly | ( | ) | const [inherited] |
In read only mode the slider can't be controlled by mouse or keyboard.
bool QwtAbstractSlider::isValid | ( | ) | const [inline, inherited] |
Reimplemented from QwtDoubleRange.
void QwtAbstractSlider::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual, inherited] |
Handles key events
e | Key event |
Reimplemented in QwtDial, and QwtCompass.
QwtKnob::KnobStyle QwtKnob::knobStyle | ( | ) | const |
int QwtKnob::knobWidth | ( | ) | const |
Return the width of the knob.
int QwtKnob::markerSize | ( | ) | const |
Return the marker size.
QwtKnob::MarkerStyle QwtKnob::markerStyle | ( | ) | const |
double QwtAbstractSlider::mass | ( | ) | const [virtual, inherited] |
double QwtDoubleRange::maxValue | ( | ) | const [inherited] |
Returns the value of the second border of the range.
maxValue returns the value which has been specified as the second parameter in QwtDoubleRange::setRange.
Reimplemented in QwtCounter.
QSize QwtKnob::minimumSizeHint | ( | ) | const [virtual] |
Return a minimum size hint.
double QwtDoubleRange::minValue | ( | ) | const [inherited] |
Returns the value at the first border of the range.
minValue returns the value which has been specified as the first parameter in setRange().
Reimplemented in QwtCounter.
void QwtAbstractSlider::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected, virtual, inherited] |
Mouse Move Event handler
e | Mouse event |
double QwtAbstractSlider::mouseOffset | ( | ) | const [protected, inherited] |
void QwtAbstractSlider::mousePressEvent | ( | QMouseEvent * | e | ) | [protected, virtual, inherited] |
Mouse press event handler
e | Mouse event |
void QwtAbstractSlider::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual, inherited] |
Mouse Release Event handler
e | Mouse event |
Qt::Orientation QwtAbstractSlider::orientation | ( | ) | const [inherited] |
int QwtDoubleRange::pageSize | ( | ) | const [inherited] |
Returns the page size in steps.
void QwtKnob::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
Repaint the knob
event | Paint event |
bool QwtDoubleRange::periodic | ( | ) | const [inherited] |
Returns true if the range is periodic.
double QwtDoubleRange::prevValue | ( | ) | const [protected, inherited] |
Returns the previous value.
void QwtAbstractScale::rescale | ( | double | vmin, |
double | vmax, | ||
double | stepSize = 0.0 |
||
) | [protected, inherited] |
Recalculate the scale division and update the scale draw.
vmin | Lower limit of the scale interval |
vmax | Upper limit of the scale interval |
stepSize | Major step size |
void QwtKnob::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
Qt Resize Event
event | Resize event |
const QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) | const |
QwtRoundScaleDraw * QwtKnob::scaleDraw | ( | ) |
const QwtScaleEngine * QwtAbstractScale::scaleEngine | ( | ) | const [inherited] |
QwtScaleEngine * QwtAbstractScale::scaleEngine | ( | ) | [inherited] |
const QwtScaleMap & QwtAbstractScale::scaleMap | ( | ) | const [inherited] |
int QwtAbstractScale::scaleMaxMajor | ( | ) | const [inherited] |
int QwtAbstractScale::scaleMaxMinor | ( | ) | const [inherited] |
int QwtAbstractSlider::scrollMode | ( | ) | const [protected, inherited] |
sa ScrollMode
void QwtAbstractScale::setAbstractScaleDraw | ( | QwtAbstractScaleDraw * | scaleDraw | ) | [protected, inherited] |
Set a scale draw.
scaleDraw has to be created with new and will be deleted in ~QwtAbstractScale or the next call of setAbstractScaleDraw.
void QwtAbstractScale::setAutoScale | ( | ) | [inherited] |
Advise the widget to control the scale range internally.
Autoscaling is on by default.
void QwtKnob::setBorderWidth | ( | int | borderWidth | ) |
Set the knob's border width.
borderWidth | new border width |
void QwtKnob::setKnobStyle | ( | KnobStyle | knobStyle | ) |
void QwtKnob::setKnobWidth | ( | int | width | ) |
Change the knob's width.
The specified width must be >= 5, or it will be clipped.
width | New width |
void QwtKnob::setMarkerSize | ( | int | size | ) |
Set the size of the marker.
void QwtKnob::setMarkerStyle | ( | MarkerStyle | markerStyle | ) |
Set the marker type of the knob.
markerStyle | Marker type |
void QwtAbstractSlider::setMass | ( | double | val | ) | [virtual, inherited] |
Set the slider's mass for flywheel effect.
If the slider's mass is greater then 0, it will continue to move after the mouse button has been released. Its speed decreases with time at a rate depending on the slider's mass. A large mass means that it will continue to move for a long time.
Derived widgets may overload this function to make it public.
val | New mass in kg |
Reimplemented in QwtWheel.
void QwtAbstractSlider::setMouseOffset | ( | double | offset | ) | [protected, inherited] |
void QwtAbstractSlider::setOrientation | ( | Qt::Orientation | o | ) | [virtual, inherited] |
void QwtDoubleRange::setPeriodic | ( | bool | tf | ) | [inherited] |
Make the range periodic.
When the range is periodic, the value will be set to a point inside the interval such that
point = value + n * width
if the user tries to set a new value which is outside the range. If the range is nonperiodic (the default), values outside the range will be clipped.
tf | true for a periodic range |
void QwtAbstractSlider::setPosition | ( | const QPoint & | p | ) | [protected, virtual, inherited] |
Move the slider to a specified point, adjust the value and emit signals if necessary.
void QwtDoubleRange::setRange | ( | double | vmin, |
double | vmax, | ||
double | vstep = 0.0 , |
||
int | pageSize = 1 |
||
) | [inherited] |
Specify range and step size.
vmin | lower boundary of the interval |
vmax | higher boundary of the interval |
vstep | step width |
pageSize | page size in steps |
void QwtAbstractSlider::setReadOnly | ( | bool | readOnly | ) | [virtual, slot, inherited] |
En/Disable read only mode
In read only mode the slider can't be controlled by mouse or keyboard.
readOnly | Enables in case of true |
void QwtAbstractScale::setScale | ( | double | vmin, |
double | vmax, | ||
double | stepSize = 0.0 |
||
) | [inherited] |
Specify a scale.
Disable autoscaling and define a scale by an interval and a step size
vmin | lower limit of the scale interval |
vmax | upper limit of the scale interval |
stepSize | major step size |
d_data->autoScale = false; d_data->stepSize = stepSize; rescale( vmin, vmax, stepSize ); QwtAbstractScale *xx = new QwtAbstractScale(12, "hello", this);
void QwtAbstractScale::setScale | ( | const QwtInterval & | interval, |
double | stepSize = 0.0 |
||
) | [inherited] |
Specify a scale.
Disable autoscaling and define a scale by an interval and a step size
interval | Interval |
stepSize | major step size |
void QwtAbstractScale::setScale | ( | const QwtScaleDiv & | scaleDiv | ) | [inherited] |
Specify a scale.
Disable autoscaling and define a scale by a scale division
scaleDiv | Scale division |
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().
void QwtAbstractScale::setScaleEngine | ( | QwtScaleEngine * | scaleEngine | ) | [inherited] |
Set a scale engine.
The scale engine is responsible for calculating the scale division, and in case of auto scaling how to align the scale.
scaleEngine has to be created with new and will be deleted in ~QwtAbstractScale or the next call of setScaleEngine.
void QwtAbstractScale::setScaleMaxMajor | ( | int | ticks | ) | [inherited] |
Set the maximum number of major tick intervals.
The scale's major ticks are calculated automatically such that the number of major intervals does not exceed ticks. The default value is 5.
ticks | maximal number of major ticks. |
void QwtAbstractScale::setScaleMaxMinor | ( | int | ticks | ) | [inherited] |
Set the maximum number of minor tick intervals.
The scale's minor ticks are calculated automatically such that the number of minor intervals does not exceed ticks. The default value is 3.
ticks |
void QwtDoubleRange::setStep | ( | double | vstep | ) | [inherited] |
Change the step raster.
vstep | new step width |
Reimplemented in QwtCounter.
void QwtKnob::setTotalAngle | ( | double | angle | ) |
Set the total angle by which the knob can be turned.
angle | Angle in degrees. |
The default angle is 270 degrees. It is possible to specify an angle of more than 360 degrees so that the knob can be turned several times around its axis.
void QwtAbstractSlider::setTracking | ( | bool | enable | ) | [inherited] |
Enables or disables tracking.
If tracking is enabled, the slider emits a valueChanged() signal whenever its value changes (the default behaviour). If tracking is disabled, the value changed() signal will only be emitted if:
Tracking is enabled by default.
enable | true (enable) or false (disable) tracking. |
void QwtAbstractSlider::setUpdateTime | ( | int | t | ) | [inherited] |
Specify the update interval for automatic scrolling.
t | update interval in milliseconds |
void QwtAbstractSlider::setValid | ( | bool | valid | ) | [inline, inherited] |
void QwtAbstractSlider::setValue | ( | double | val | ) | [virtual, slot, inherited] |
Move the slider to a specified value.
This function can be used to move the slider to a value which is not an integer multiple of the step size.
val | new value |
Reimplemented from QwtDoubleRange.
QSize QwtKnob::sizeHint | ( | ) | const [virtual] |
void QwtAbstractSlider::sliderMoved | ( | double | value | ) | [signal, inherited] |
This signal is emitted when the user moves the slider with the mouse.
value | new value |
void QwtAbstractSlider::sliderPressed | ( | ) | [signal, inherited] |
This signal is emitted when the user presses the movable part of the slider (start ScrMouse Mode).
void QwtAbstractSlider::sliderReleased | ( | ) | [signal, inherited] |
This signal is emitted when the user releases the movable part of the slider.
double QwtDoubleRange::step | ( | ) | const [inherited] |
void QwtDoubleRange::stepChange | ( | ) | [protected, virtual, inherited] |
Notify a change of the step size.
This virtual function is called whenever the step size changes. The default implementation does nothing.
void QwtAbstractSlider::stopMoving | ( | ) | [inherited] |
Stop updating if automatic scrolling is active.
void QwtAbstractSlider::timerEvent | ( | QTimerEvent * | e | ) | [protected, virtual, inherited] |
Qt timer event
e | Timer event |
double QwtKnob::totalAngle | ( | ) | const |
Return the total angle.
double QwtDoubleRange::value | ( | ) | const [inherited] |
Returns the current value.
Reimplemented in QwtCounter.
void QwtAbstractSlider::valueChanged | ( | double | value | ) | [signal, inherited] |
Notify a change of value.
In the default setting (tracking enabled), this signal will be emitted every time the value changes ( see setTracking() ).
value | new value |
void QwtAbstractSlider::wheelEvent | ( | QWheelEvent * | e | ) | [protected, virtual, inherited] |
Wheel Event handler
e | Whell event |