The Slider Widget. More...
#include <qwt_slider.h>
Classes | |
class | PrivateData |
Public Types | |
enum | ScalePosition { NoScale, LeadingScale, TrailingScale } |
Public Member Functions | |
int | borderWidth () const |
QSize | handleSize () const |
bool | hasGroove () const |
bool | hasTrough () const |
virtual QSize | minimumSizeHint () const QWT_OVERRIDE |
Qt::Orientation | orientation () const |
QwtSlider (Qt::Orientation, QWidget *parent=NULL) | |
QwtSlider (QWidget *parent=NULL) | |
const QwtScaleDraw * | scaleDraw () const |
ScalePosition | scalePosition () const |
void | setBorderWidth (int) |
Change the slider's border width. More... | |
void | setGroove (bool) |
void | setHandleSize (const QSize &) |
Set the slider's handle size. More... | |
void | setOrientation (Qt::Orientation) |
Set the orientation. More... | |
void | setScaleDraw (QwtScaleDraw *) |
Set a scale draw. More... | |
void | setScalePosition (ScalePosition) |
Change the position of the scale. More... | |
void | setSpacing (int) |
Change the spacing between trough and scale. More... | |
void | setTrough (bool) |
void | setUpdateInterval (int) |
Specify the update interval for automatic scrolling. More... | |
virtual QSize | sizeHint () const QWT_OVERRIDE |
int | spacing () const |
int | updateInterval () const |
virtual | ~QwtSlider () |
Destructor. More... | |
Public Member Functions inherited from QwtAbstractSlider | |
bool | invertedControls () const |
bool | isReadOnly () const |
bool | isTracking () const |
bool | isValid () const |
uint | pageSteps () const |
QwtAbstractSlider (QWidget *parent=NULL) | |
Constructor. More... | |
void | setInvertedControls (bool) |
void | setPageSteps (uint) |
Set the number of steps for a page increment. More... | |
void | setReadOnly (bool) |
void | setSingleSteps (uint) |
Set the number of steps for a single increment. More... | |
void | setStepAlignment (bool) |
Enable step alignment. More... | |
void | setTotalSteps (uint) |
Set the number of steps. More... | |
void | setTracking (bool) |
Enables or disables tracking. More... | |
void | setValid (bool) |
void | setWrapping (bool) |
uint | singleSteps () const |
bool | stepAlignment () const |
uint | totalSteps () const |
double | value () const |
bool | wrapping () const |
virtual | ~QwtAbstractSlider () |
Destructor. More... | |
Public Member Functions inherited from QwtAbstractScale | |
double | invTransform (int) const |
bool | isInverted () const |
double | lowerBound () const |
double | maximum () const |
double | minimum () const |
QwtAbstractScale (QWidget *parent=NULL) | |
const QwtScaleDiv & | scaleDiv () const |
QwtScaleEngine * | scaleEngine () |
const QwtScaleEngine * | scaleEngine () const |
const QwtScaleMap & | scaleMap () const |
int | scaleMaxMajor () const |
int | scaleMaxMinor () const |
double | scaleStepSize () const |
void | setLowerBound (double value) |
void | setScale (const QwtInterval &) |
Specify a scale. More... | |
void | setScale (const QwtScaleDiv &) |
Specify a scale. More... | |
void | setScale (double lowerBound, double upperBound) |
Specify a scale. More... | |
void | setScaleEngine (QwtScaleEngine *) |
Set a scale engine. More... | |
void | setScaleMaxMajor (int ticks) |
Set the maximum number of major tick intervals. More... | |
void | setScaleMaxMinor (int ticks) |
Set the maximum number of minor tick intervals. More... | |
void | setScaleStepSize (double stepSize) |
Set the step size used for calculating a scale division. More... | |
void | setUpperBound (double value) |
int | transform (double) const |
double | upperBound () const |
virtual | ~QwtAbstractScale () |
Destructor. More... | |
Protected Member Functions | |
virtual void | changeEvent (QEvent *) QWT_OVERRIDE |
virtual void | drawHandle (QPainter *, const QRect &, int pos) const |
virtual void | drawSlider (QPainter *, const QRect &) const |
virtual bool | event (QEvent *) QWT_OVERRIDE |
QRect | handleRect () const |
virtual bool | isScrollPosition (const QPoint &) const QWT_OVERRIDE |
Determine what to do when the user presses a mouse button. More... | |
virtual void | mousePressEvent (QMouseEvent *) QWT_OVERRIDE |
virtual void | mouseReleaseEvent (QMouseEvent *) QWT_OVERRIDE |
virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
virtual void | resizeEvent (QResizeEvent *) QWT_OVERRIDE |
virtual void | scaleChange () QWT_OVERRIDE |
Notify changed scale. More... | |
virtual double | scrolledTo (const QPoint &) const QWT_OVERRIDE |
Determine the value for a new position of the slider handle. More... | |
QRect | sliderRect () const |
virtual void | timerEvent (QTimerEvent *) QWT_OVERRIDE |
Protected Member Functions inherited from QwtAbstractSlider | |
double | incrementedValue (double value, int stepCount) const |
void | incrementValue (int stepCount) |
virtual void | keyPressEvent (QKeyEvent *) QWT_OVERRIDE |
virtual void | mouseMoveEvent (QMouseEvent *) QWT_OVERRIDE |
virtual void | sliderChange () |
Calling update() More... | |
virtual void | wheelEvent (QWheelEvent *) QWT_OVERRIDE |
Protected Member Functions inherited from QwtAbstractScale | |
QwtAbstractScaleDraw * | abstractScaleDraw () |
const QwtAbstractScaleDraw * | abstractScaleDraw () const |
void | rescale (double lowerBound, double upperBound, double stepSize) |
void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
Set a scale draw. More... | |
void | updateScaleDraw () |
Properties | |
int | borderWidth |
bool | groove |
QSize | handleSize |
Qt::Orientation | orientation |
ScalePosition | scalePosition |
int | spacing |
bool | trough |
Properties inherited from QwtAbstractSlider | |
bool | invertedControls |
uint | pageSteps |
bool | readOnly |
uint | singleSteps |
bool | stepAlignment |
uint | totalSteps |
bool | tracking |
double | value |
Returns the current value. More... | |
bool | wrapping |
Properties inherited from QwtAbstractScale | |
double | lowerBound |
int | scaleMaxMajor |
int | scaleMaxMinor |
double | scaleStepSize |
double | upperBound |
Private Member Functions | |
void | initSlider (Qt::Orientation) |
void | layoutSlider (bool) |
QwtScaleDraw * | scaleDraw () |
Private Attributes | |
PrivateData * | m_data |
Additional Inherited Members | |
Public Slots inherited from QwtAbstractSlider | |
void | setValue (double value) |
Signals inherited from QwtAbstractSlider | |
void | sliderMoved (double value) |
void | sliderPressed () |
void | sliderReleased () |
void | valueChanged (double value) |
Notify a change of value. More... | |
The Slider Widget.
QwtSlider is a slider widget which operates on an interval of type double. Its position is related to a scale showing the current value.
The slider can be customized by having a through, a groove - or both.
Definition at line 30 of file qwt_slider.h.
Position of the scale
Enumerator | |
---|---|
NoScale | The slider has no scale. |
LeadingScale | The scale is right of a vertical or below a horizontal slider. |
TrailingScale | The scale is left of a vertical or above a horizontal slider. |
Definition at line 54 of file qwt_slider.h.
|
explicit |
Construct vertical slider in QwtSlider::Trough style with a scale to the left.
The scale is initialized to [0.0, 100.0] and the value set to 0.0.
parent | Parent widget |
Definition at line 119 of file qwt_slider.cpp.
|
explicit |
Construct a slider in QwtSlider::Trough style
When orientation is Qt::Vertical the scale will be aligned to the left - otherwise at the the top of the slider.
The scale is initialized to [0.0, 100.0] and the value set to 0.0.
parent | Parent widget |
orientation | Orientation of the slider. |
Definition at line 136 of file qwt_slider.cpp.
|
virtual |
Destructor.
Definition at line 143 of file qwt_slider.cpp.
int QwtSlider::borderWidth | ( | ) | const |
|
protectedvirtual |
Handles QEvent::StyleChange and QEvent::FontChange events
event | Change event |
Reimplemented from QwtAbstractScale.
Definition at line 724 of file qwt_slider.cpp.
|
protectedvirtual |
Draw the thumb at a position
painter | Painter |
handleRect | Bounding rectangle of the handle |
pos | Position of the handle marker in widget coordinates |
Definition at line 473 of file qwt_slider.cpp.
|
protectedvirtual |
Draw the slider into the specified rectangle.
painter | Painter |
sliderRect | Bounding rectangle of the slider |
Definition at line 415 of file qwt_slider.cpp.
|
protectedvirtual |
Qt event handler
event | Event |
Definition at line 712 of file qwt_slider.cpp.
|
protected |
Definition at line 990 of file qwt_slider.cpp.
QSize QwtSlider::handleSize | ( | ) | const |
bool QwtSlider::hasGroove | ( | ) | const |
Definition at line 904 of file qwt_slider.cpp.
bool QwtSlider::hasTrough | ( | ) | const |
Definition at line 875 of file qwt_slider.cpp.
|
private |
Definition at line 148 of file qwt_slider.cpp.
|
protectedvirtual |
Determine what to do when the user presses a mouse button.
pos | Mouse position |
True,when | handleRect() contains pos |
Implements QwtAbstractSlider.
Definition at line 503 of file qwt_slider.cpp.
|
private |
Recalculate the slider's geometry and layout based on the current geometry and fonts.
update_geometry | notify the layout system and call update to redraw the scale |
Definition at line 743 of file qwt_slider.cpp.
|
virtual |
|
protectedvirtual |
Mouse press event handler
event | Mouse event |
Reimplemented from QwtAbstractSlider.
Definition at line 547 of file qwt_slider.cpp.
|
protectedvirtual |
Mouse release event handler
event | Mouse event |
Reimplemented from QwtAbstractSlider.
Definition at line 606 of file qwt_slider.cpp.
Qt::Orientation QwtSlider::orientation | ( | ) | const |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Notify changed scale.
Reimplemented from QwtAbstractSlider.
Definition at line 378 of file qwt_slider.cpp.
|
private |
QwtScaleDraw * QwtSlider::scaleDraw | ( | ) | const |
Definition at line 363 of file qwt_slider.cpp.
ScalePosition QwtSlider::scalePosition | ( | ) | const |
|
protectedvirtual |
Determine the value for a new position of the slider handle.
pos | Mouse position |
Implements QwtAbstractSlider.
Definition at line 526 of file qwt_slider.cpp.
void QwtSlider::setBorderWidth | ( | int | width | ) |
Change the slider's border width.
The border width is used for drawing the slider handle and the trough.
width | Border width |
Definition at line 244 of file qwt_slider.cpp.
void QwtSlider::setGroove | ( | bool | on | ) |
En/Disable the groove
The slider can be customized by showing a groove for the handle.
on | When true, the groove is visible |
Definition at line 889 of file qwt_slider.cpp.
void QwtSlider::setHandleSize | ( | const QSize & | size | ) |
Set the slider's handle size.
When the size is empty the slider handle will be painted with a default size depending on its orientation() and backgroundStyle().
size | New size |
Definition at line 311 of file qwt_slider.cpp.
void QwtSlider::setOrientation | ( | Qt::Orientation | orientation | ) |
Set the orientation.
orientation | Allowed values are Qt::Horizontal and Qt::Vertical. |
Definition at line 175 of file qwt_slider.cpp.
void QwtSlider::setScaleDraw | ( | QwtScaleDraw * | scaleDraw | ) |
Set a scale draw.
For changing the labels of the scales, it is necessary to derive from QwtScaleDraw and overload QwtScaleDraw::label().
scaleDraw | ScaleDraw object, that has to be created with new and will be deleted in ~QwtSlider() or the next call of setScaleDraw(). |
Definition at line 344 of file qwt_slider.cpp.
void QwtSlider::setScalePosition | ( | ScalePosition | scalePosition | ) |
Change the position of the scale.
scalePosition | Position of the scale. |
Definition at line 213 of file qwt_slider.cpp.
void QwtSlider::setSpacing | ( | int | spacing | ) |
Change the spacing between trough and scale.
A spacing of 0 means, that the backbone of the scale is covered by the trough.
The default setting is 4 pixels.
spacing | Number of pixels |
Definition at line 278 of file qwt_slider.cpp.
void QwtSlider::setTrough | ( | bool | on | ) |
En/Disable the trough
The slider can be customized by showing a trough for the handle.
on | When true, the groove is visible |
Definition at line 860 of file qwt_slider.cpp.
void QwtSlider::setUpdateInterval | ( | int | interval | ) |
Specify the update interval for automatic scrolling.
The minimal accepted value is 50 ms.
interval | Update interval in milliseconds |
Definition at line 395 of file qwt_slider.cpp.
|
virtual |
Definition at line 912 of file qwt_slider.cpp.
|
protected |
Definition at line 1014 of file qwt_slider.cpp.
int QwtSlider::spacing | ( | ) | const |
|
protectedvirtual |
Timer event handler
Handles the timer, when the mouse stays pressed inside the sliderRect().
event | Mouse event |
Definition at line 633 of file qwt_slider.cpp.
int QwtSlider::updateInterval | ( | ) | const |
Definition at line 404 of file qwt_slider.cpp.
|
private |
Definition at line 128 of file qwt_slider.h.
|
readwrite |
|
readwrite |
Definition at line 42 of file qwt_slider.h.
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
Definition at line 46 of file qwt_slider.h.
|
readwrite |
Definition at line 41 of file qwt_slider.h.