The Wheel Widget. More...
#include <qwt_wheel.h>
Classes | |
class | PrivateData |
Public Slots | |
void | setMass (double) |
Set the slider's mass for flywheel effect. More... | |
void | setTotalAngle (double) |
Set the total angle which the wheel can be turned. More... | |
void | setValue (double) |
Set a new value without adjusting to the step raster. More... | |
void | setViewAngle (double) |
Specify the visible portion of the wheel. More... | |
Signals | |
void | valueChanged (double value) |
Notify a change of value. More... | |
void | wheelMoved (double value) |
void | wheelPressed () |
void | wheelReleased () |
Public Member Functions | |
int | borderWidth () const |
bool | isInverted () const |
bool | isTracking () const |
double | mass () const |
double | maximum () const |
double | minimum () const |
Qt::Orientation | orientation () const |
int | pageStepCount () const |
QwtWheel (QWidget *parent=NULL) | |
Constructor. More... | |
void | setBorderWidth (int) |
Set the border width. More... | |
void | setInverted (bool) |
En/Disable inverted appearance. More... | |
void | setMaximum (double) |
void | setMinimum (double) |
void | setOrientation (Qt::Orientation) |
Set the wheel's orientation. More... | |
void | setPageStepCount (int) |
Set the page step count. More... | |
void | setRange (double min, double max) |
Set the minimum and maximum values. More... | |
void | setSingleStep (double) |
Set the step size of the counter. More... | |
void | setStepAlignment (bool on) |
En/Disable step alignment. More... | |
void | setTickCount (int) |
Adjust the number of grooves in the wheel's surface. More... | |
void | setTracking (bool) |
En/Disable tracking. More... | |
void | setUpdateInterval (int) |
Specify the update interval when the wheel is flying. More... | |
void | setWheelBorderWidth (int) |
Set the wheel border width of the wheel. More... | |
void | setWheelWidth (int) |
Set the width of the wheel. More... | |
void | setWrapping (bool) |
En/Disable wrapping. More... | |
double | singleStep () const |
bool | stepAlignment () const |
int | tickCount () const |
double | totalAngle () const |
int | updateInterval () const |
double | value () const |
double | viewAngle () const |
int | wheelBorderWidth () const |
int | wheelWidth () const |
bool | wrapping () const |
virtual | ~QwtWheel () |
Destructor. More... | |
Protected Member Functions | |
virtual void | drawTicks (QPainter *, const QRectF &) |
virtual void | drawWheelBackground (QPainter *, const QRectF &) |
virtual void | keyPressEvent (QKeyEvent *) QWT_OVERRIDE |
virtual QSize | minimumSizeHint () const QWT_OVERRIDE |
virtual void | mouseMoveEvent (QMouseEvent *) QWT_OVERRIDE |
Mouse Move Event handler. More... | |
virtual void | mousePressEvent (QMouseEvent *) QWT_OVERRIDE |
Mouse press event handler. More... | |
virtual void | mouseReleaseEvent (QMouseEvent *) QWT_OVERRIDE |
Mouse Release Event handler. More... | |
virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
Qt Paint Event. More... | |
virtual QSize | sizeHint () const QWT_OVERRIDE |
void | stopFlying () |
Stop the flying movement of the wheel. More... | |
virtual void | timerEvent (QTimerEvent *) QWT_OVERRIDE |
Qt timer event. More... | |
virtual double | valueAt (const QPoint &) const |
virtual void | wheelEvent (QWheelEvent *) QWT_OVERRIDE |
Handle wheel events. More... | |
QRect | wheelRect () const |
Properties | |
int | borderWidth |
bool | inverted |
double | mass |
double | maximum |
double | minimum |
Qt::Orientation | orientation |
int | pageStepCount |
double | singleStep |
bool | stepAlignment |
int | tickCount |
double | totalAngle |
bool | tracking |
int | updateInterval |
double | value |
double | viewAngle |
int | wheelBorderWidth |
int | wheelWidth |
bool | wrapping |
Private Member Functions | |
double | alignedValue (double) const |
double | boundedValue (double) const |
Private Attributes | |
PrivateData * | m_data |
The Wheel Widget.
The wheel widget can be used to change values over a very large range in very small steps. Using the setMass() member, it can be configured as a flying wheel.
The default range of the wheel is [0.0, 100.0]
Definition at line 27 of file qwt_wheel.h.
|
explicit |
Constructor.
Definition at line 92 of file qwt_wheel.cpp.
|
virtual |
Destructor.
Definition at line 103 of file qwt_wheel.cpp.
|
private |
Definition at line 1279 of file qwt_wheel.cpp.
int QwtWheel::borderWidth | ( | ) | const |
|
private |
Definition at line 1256 of file qwt_wheel.cpp.
|
protectedvirtual |
Draw the Wheel's ticks
painter | Painter |
rect | Geometry for the wheel |
Definition at line 817 of file qwt_wheel.cpp.
|
protectedvirtual |
Draw the Wheel's background gradient
painter | Painter |
rect | Geometry for the wheel |
Definition at line 761 of file qwt_wheel.cpp.
bool QwtWheel::isInverted | ( | ) | const |
Definition at line 1176 of file qwt_wheel.cpp.
bool QwtWheel::isTracking | ( | ) | const |
Definition at line 129 of file qwt_wheel.cpp.
|
protectedvirtual |
Handle key events
event | Key event |
Definition at line 409 of file qwt_wheel.cpp.
double QwtWheel::mass | ( | ) | const |
double QwtWheel::maximum | ( | ) | const |
double QwtWheel::minimum | ( | ) | const |
|
protectedvirtual |
Definition at line 962 of file qwt_wheel.cpp.
|
protectedvirtual |
Mouse Move Event handler.
Turn the wheel according to the mouse position
event | Mouse event |
Definition at line 188 of file qwt_wheel.cpp.
|
protectedvirtual |
Mouse press event handler.
Start movement of the wheel.
event | Mouse event |
Definition at line 163 of file qwt_wheel.cpp.
|
protectedvirtual |
Mouse Release Event handler.
When the wheel has no mass the movement of the wheel stops, otherwise it starts flying.
event | Mouse event |
Definition at line 237 of file qwt_wheel.cpp.
Qt::Orientation QwtWheel::orientation | ( | ) | const |
int QwtWheel::pageStepCount | ( | ) | const |
|
protectedvirtual |
void QwtWheel::setBorderWidth | ( | int | width | ) |
Set the border width.
The border defaults to 2.
width | Border width |
Definition at line 576 of file qwt_wheel.cpp.
void QwtWheel::setInverted | ( | bool | on | ) |
En/Disable inverted appearance.
An inverted wheel increases its values in the opposite direction. The direction of an inverted horizontal wheel will be from right to left an inverted vertical wheel will increase from bottom to top.
on | En/Disable inverted appearance |
Definition at line 1163 of file qwt_wheel.cpp.
|
slot |
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.
mass | New mass in kg |
Definition at line 1221 of file qwt_wheel.cpp.
void QwtWheel::setMaximum | ( | double | value | ) |
Set the maximum value of the range
value | Maximum value |
Definition at line 1105 of file qwt_wheel.cpp.
void QwtWheel::setMinimum | ( | double | value | ) |
Set the minimum value of the range
value | Minimum value |
Definition at line 1085 of file qwt_wheel.cpp.
void QwtWheel::setOrientation | ( | Qt::Orientation | orientation | ) |
Set the wheel's orientation.
The default orientation is Qt::Horizontal.
orientation | Qt::Horizontal or Qt::Vertical. |
Definition at line 639 of file qwt_wheel.cpp.
void QwtWheel::setPageStepCount | ( | int | count | ) |
Set the page step count.
pageStepCount is a multiplicator for the single step size that typically corresponds to the user pressing PageUp or PageDown.
A value of 0 disables page stepping.
The default value is 1.
count | Multiplicator for the single step size |
Definition at line 1034 of file qwt_wheel.cpp.
void QwtWheel::setRange | ( | double | min, |
double | max | ||
) |
Set the minimum and maximum values.
The maximum is adjusted if necessary to ensure that the range remains valid. The value might be modified to be inside of the range.
min | Minimum value |
max | Maximum value |
Definition at line 1059 of file qwt_wheel.cpp.
void QwtWheel::setSingleStep | ( | double | stepSize | ) |
Set the step size of the counter.
A value <= 0.0 disables stepping
stepSize | Single step size |
Definition at line 980 of file qwt_wheel.cpp.
void QwtWheel::setStepAlignment | ( | bool | on | ) |
En/Disable step alignment.
When step alignment is enabled value changes initiated by user input ( mouse, keyboard, wheel ) are aligned to the multiples of the single step.
on | On/Off |
Definition at line 1004 of file qwt_wheel.cpp.
void QwtWheel::setTickCount | ( | int | count | ) |
Adjust the number of grooves in the wheel's surface.
The number of grooves is limited to 6 <= count <= 50. Values outside this range will be clipped. The default value is 10.
count | Number of grooves per 360 degrees |
Definition at line 519 of file qwt_wheel.cpp.
|
slot |
Set the total angle which the wheel can be turned.
One full turn of the wheel corresponds to an angle of 360 degrees. A total angle of n*360 degrees means that the wheel has to be turned n times around its axis to get from the minimum value to the maximum value.
The default setting of the total angle is 360 degrees.
angle | total angle in degrees |
Definition at line 613 of file qwt_wheel.cpp.
void QwtWheel::setTracking | ( | bool | enable | ) |
En/Disable tracking.
If tracking is enabled (the default), the wheel emits the valueChanged() signal while the wheel is moving. If tracking is disabled, the wheel emits the valueChanged() signal only when the wheel movement is terminated.
The wheelMoved() signal is emitted regardless id tracking is enabled or not.
enable | On/Off |
Definition at line 120 of file qwt_wheel.cpp.
void QwtWheel::setUpdateInterval | ( | int | interval | ) |
Specify the update interval when the wheel is flying.
Default and minimum value is 50 ms.
interval | Interval in milliseconds |
Definition at line 142 of file qwt_wheel.cpp.
|
slot |
Set a new value without adjusting to the step raster.
value | New value |
Definition at line 1127 of file qwt_wheel.cpp.
|
slot |
Specify the visible portion of the wheel.
You may use this function for fine-tuning the appearance of the wheel. The default value is 175 degrees. The value is limited from 10 to 175 degrees.
angle | Visible angle in degrees |
Definition at line 676 of file qwt_wheel.cpp.
void QwtWheel::setWheelBorderWidth | ( | int | borderWidth | ) |
Set the wheel border width of the wheel.
The wheel border must not be smaller than 1 and is limited in dependence on the wheel's size. Values outside the allowed range will be clipped.
The wheel border defaults to 2.
borderWidth | Border width |
Definition at line 551 of file qwt_wheel.cpp.
void QwtWheel::setWheelWidth | ( | int | width | ) |
Set the width of the wheel.
Corresponds to the wheel height for horizontal orientation, and the wheel width for vertical orientation.
width | the wheel's width |
Definition at line 934 of file qwt_wheel.cpp.
void QwtWheel::setWrapping | ( | bool | on | ) |
En/Disable wrapping.
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vice versa.
on | En/Disable wrapping |
Definition at line 1190 of file qwt_wheel.cpp.
double QwtWheel::singleStep | ( | ) | const |
|
protectedvirtual |
Definition at line 952 of file qwt_wheel.cpp.
bool QwtWheel::stepAlignment | ( | ) | const |
|
protected |
Stop the flying movement of the wheel.
Definition at line 1246 of file qwt_wheel.cpp.
int QwtWheel::tickCount | ( | ) | const |
|
protectedvirtual |
Qt timer event.
The flying wheel effect is implemented using a timer
event | Timer event |
Definition at line 283 of file qwt_wheel.cpp.
double QwtWheel::totalAngle | ( | ) | const |
int QwtWheel::updateInterval | ( | ) | const |
double QwtWheel::value | ( | ) | const |
|
protectedvirtual |
Determine the value corresponding to a specified point
pos | Position |
Definition at line 697 of file qwt_wheel.cpp.
|
signal |
Notify a change of value.
When tracking is enabled this signal will be emitted every time the value changes.
value | new value |
double QwtWheel::viewAngle | ( | ) | const |
int QwtWheel::wheelBorderWidth | ( | ) | const |
|
protectedvirtual |
Handle wheel events.
In/Decrement the value
event | Wheel event |
Definition at line 324 of file qwt_wheel.cpp.
|
signal |
This signal is emitted when the user moves the wheel with the mouse.
value | new value |
|
signal |
This signal is emitted when the user presses the the wheel with the mouse
|
protected |
Definition at line 594 of file qwt_wheel.cpp.
|
signal |
This signal is emitted when the user releases the mouse
int QwtWheel::wheelWidth | ( | ) | const |
bool QwtWheel::wrapping | ( | ) | const |
|
private |
Definition at line 182 of file qwt_wheel.h.
|
readwrite |
|
readwrite |
Definition at line 52 of file qwt_wheel.h.
|
readwrite |
|
readwrite |
Definition at line 44 of file qwt_wheel.h.
|
readwrite |
Definition at line 43 of file qwt_wheel.h.
|
readwrite |
|
readwrite |
Definition at line 47 of file qwt_wheel.h.
|
readwrite |
|
readwrite |
Definition at line 48 of file qwt_wheel.h.
|
readwrite |
Definition at line 59 of file qwt_wheel.h.
|
readwrite |
Definition at line 57 of file qwt_wheel.h.
|
readwrite |
Definition at line 50 of file qwt_wheel.h.
|
readwrite |
Definition at line 55 of file qwt_wheel.h.
|
readwrite |
Definition at line 41 of file qwt_wheel.h.
|
readwrite |
Definition at line 58 of file qwt_wheel.h.
|
readwrite |
|
readwrite |
|
readwrite |