|
QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
|
The Slider Widget 更多...
#include <qwt_slider.h>
类 | |
| class | PrivateData |
Public 类型 | |
| enum | ScalePosition { NoScale , LeadingScale , TrailingScale } |
| Position of the scale 更多... | |
Public 成员函数 | |
| QwtSlider (QWidget *parent=nullptr) | |
| Constructor | |
| QwtSlider (Qt::Orientation, QWidget *parent=nullptr) | |
| Constructor with orientation | |
| ~QwtSlider () override | |
| Destructor | |
| void | setOrientation (Qt::Orientation) |
| Set orientation | |
| Qt::Orientation | orientation () const |
| Return orientation | |
| void | setScalePosition (ScalePosition) |
| Set scale position | |
| ScalePosition | scalePosition () const |
| Return scale position | |
| void | setTrough (bool) |
| Enable/disable trough | |
| bool | hasTrough () const |
| Check if has trough | |
| void | setGroove (bool) |
| Enable/disable groove | |
| bool | hasGroove () const |
| Check if has groove | |
| void | setHandleSize (const QSize &) |
| Set handle size | |
| QSize | handleSize () const |
| Return handle size | |
| void | setBorderWidth (int) |
| Set border width | |
| int | borderWidth () const |
| Return border width | |
| void | setSpacing (int) |
| Set spacing | |
| int | spacing () const |
| Return spacing | |
| void | setFlatStyle (bool) |
| Set flat style | |
| bool | flatStyle () const |
| Return flat style | |
| virtual QSize | sizeHint () const override |
| Return size hint | |
| virtual QSize | minimumSizeHint () const override |
| Return minimum size hint | |
| void | setScaleDraw (QwtScaleDraw *) |
| Set scale draw | |
| const QwtScaleDraw * | scaleDraw () const |
| Return scale draw (const version) | |
| void | setUpdateInterval (int) |
| Set update interval | |
| int | updateInterval () const |
| Return update interval | |
Public 成员函数 继承自 QwtAbstractSlider | |
| QwtAbstractSlider (QWidget *parent=nullptr) | |
| Constructor for QwtAbstractSlider (English only) | |
| ~QwtAbstractSlider () override | |
| Destructor for QwtAbstractSlider (English only) | |
| void | setValid (bool) |
| Set whether the slider is valid (English only) | |
| bool | isValid () const |
| Return whether the slider is valid (English only) | |
| double | value () const |
| Return the current value (English only) | |
| void | setWrapping (bool) |
| Set whether wrapping is enabled (English only) | |
| bool | wrapping () const |
| Return whether wrapping is enabled (English only) | |
| void | setTotalSteps (uint) |
| Set the total number of steps (English only) | |
| uint | totalSteps () const |
| Return the total number of steps (English only) | |
| void | setSingleSteps (uint) |
| Set the number of single steps (English only) | |
| uint | singleSteps () const |
| Return the number of single steps (English only) | |
| void | setPageSteps (uint) |
| Set the number of page steps (English only) | |
| uint | pageSteps () const |
| Return the number of page steps (English only) | |
| void | setStepAlignment (bool) |
| Set whether step alignment is enabled (English only) | |
| bool | stepAlignment () const |
| Return whether step alignment is enabled (English only) | |
| void | setTracking (bool) |
| Set whether tracking is enabled (English only) | |
| bool | isTracking () const |
| Return whether tracking is enabled (English only) | |
| void | setReadOnly (bool) |
| Set whether the slider is read-only (English only) | |
| bool | isReadOnly () const |
| Return whether the slider is read-only (English only) | |
| void | setInvertedControls (bool) |
| Set whether controls are inverted (English only) | |
| bool | invertedControls () const |
| Return whether controls are inverted (English only) | |
Public 成员函数 继承自 QwtAbstractScale | |
| QwtAbstractScale (QWidget *parent=nullptr) | |
| Constructor for QwtAbstractScale | |
| void | setScale (double lowerBound, double upperBound) |
| Specify a scale by interval bounds | |
| void | setScale (const QwtInterval &) |
| Specify a scale by interval | |
| void | setScale (const QwtScaleDiv &) |
| Specify a scale by scale division | |
| const QwtScaleDiv & | scaleDiv () const |
| Return the scale division | |
| void | setLowerBound (double value) |
| Set the lower bound of the scale | |
| double | lowerBound () const |
| Return the lower bound of the scale | |
| void | setUpperBound (double value) |
| Set the upper bound of the scale | |
| double | upperBound () const |
| Return the upper bound of the scale | |
| void | setScaleStepSize (double stepSize) |
| Set the step size used for calculating scale division | |
| double | scaleStepSize () const |
| Return the step size hint | |
| void | setScaleMaxMajor (int ticks) |
| Set the maximum number of major tick intervals | |
| int | scaleMaxMinor () const |
| Return the maximum number of minor tick intervals | |
| void | setScaleMaxMinor (int ticks) |
| Set the maximum number of minor tick intervals | |
| int | scaleMaxMajor () const |
| Return the maximum number of major tick intervals | |
| void | setScaleEngine (QwtScaleEngine *) |
| Set the scale engine | |
| const QwtScaleEngine * | scaleEngine () const |
| Return the scale engine (const version) | |
| QwtScaleEngine * | scaleEngine () |
| Return the scale engine (non-const version) | |
| int | transform (double) const |
| Transform a scale value to widget coordinates | |
| double | invTransform (int) const |
| Transform a widget coordinate to scale value | |
| bool | isInverted () const |
| Check if scale is inverted | |
| double | minimum () const |
| Return the minimum boundary | |
| double | maximum () const |
| Return the maximum boundary | |
| const QwtScaleMap & | scaleMap () const |
| Return the scale map | |
Protected 成员函数 | |
| virtual double | scrolledTo (const QPoint &) const override |
| Calculate scrolled position | |
| virtual bool | isScrollPosition (const QPoint &) const override |
| Check if position is scroll position | |
| virtual void | drawSlider (QPainter *, const QRect &) const |
| Draw slider | |
| virtual void | drawHandle (QPainter *, const QRect &, int pos) const |
| Draw handle | |
| virtual void | mousePressEvent (QMouseEvent *) override |
| Mouse press event | |
| virtual void | mouseReleaseEvent (QMouseEvent *) override |
| Mouse release event | |
| virtual void | resizeEvent (QResizeEvent *) override |
| Resize event | |
| virtual void | paintEvent (QPaintEvent *) override |
| Paint event | |
| virtual void | changeEvent (QEvent *) override |
| Change event | |
| virtual void | timerEvent (QTimerEvent *) override |
| Timer event | |
| virtual bool | event (QEvent *) override |
| Event handler | |
| virtual void | scaleChange () override |
| Scale change notification | |
| QRect | sliderRect () const |
| Return slider rectangle | |
| QRect | handleRect () const |
| Return handle rectangle | |
Protected 成员函数 继承自 QwtAbstractSlider | |
| virtual void | mouseMoveEvent (QMouseEvent *) override |
| Handle mouse move events (English only) | |
| virtual void | keyPressEvent (QKeyEvent *) override |
| Handle key press events (English only) | |
| virtual void | wheelEvent (QWheelEvent *) override |
| Handle wheel events (English only) | |
| void | incrementValue (int stepCount) |
| Increment the value by a number of steps (English only) | |
| virtual void | sliderChange () |
| Handle slider changes (English only) | |
| double | incrementedValue (double value, int stepCount) const |
| Calculate incremented value (English only) | |
Protected 成员函数 继承自 QwtAbstractScale | |
| void | rescale (double lowerBound, double upperBound, double stepSize) |
| Recalculate scale and update scale draw (English only) | |
| void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
| Set the scale draw object (English only) | |
| const QwtAbstractScaleDraw * | abstractScaleDraw () const |
| Return the scale draw (const version) (English only) | |
| QwtAbstractScaleDraw * | abstractScaleDraw () |
| Return the scale draw (non-const version) (English only) | |
| void | updateScaleDraw () |
| Update the scale draw (English only) | |
属性 | |
| Qt::Orientation | orientation |
| ScalePosition | scalePosition |
| bool | trough |
| bool | groove |
| QSize | handleSize |
| int | borderWidth |
| int | spacing |
| bool | flatStyle |
属性 继承自 QwtAbstractSlider | |
| double | value |
| uint | totalSteps |
| uint | singleSteps |
| uint | pageSteps |
| bool | stepAlignment |
| bool | readOnly |
| bool | tracking |
| bool | wrapping |
| bool | invertedControls |
属性 继承自 QwtAbstractScale | |
| double | lowerBound |
| double | upperBound |
| int | scaleMaxMajor |
| int | scaleMaxMinor |
| double | scaleStepSize |
额外继承的成员函数 | |
Public 槽 继承自 QwtAbstractSlider | |
| void | setValue (double value) |
| Set the slider value (English only) | |
信号 继承自 QwtAbstractSlider | |
| void | valueChanged (double value) |
| Notify a change of value | |
| void | sliderPressed () |
| Signal emitted when the user presses the movable part of the slider | |
| void | sliderReleased () |
| Signal emitted when the user releases the movable part of the slider | |
| void | sliderMoved (double value) |
| Signal emitted when the user moves the slider with the mouse | |
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.
|
explicit |
Constructor
Construct vertical slider in QwtSlider::Trough style
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 |
|
explicit |
Constructor with orientation
Construct a slider in QwtSlider::Trough style
Construct a slider in QwtSlider::Trough style. When orientation is Qt::Vertical the scale will be aligned to the left, otherwise at 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 |
|
override |
Destructor
| int QwtSlider::borderWidth | ( | ) | const |
|
overrideprotectedvirtual |
Change event
重载 QwtAbstractScale .
| bool QwtSlider::flatStyle | ( | ) | const |
| QSize QwtSlider::handleSize | ( | ) | const |
| bool QwtSlider::hasGroove | ( | ) | const |
| bool QwtSlider::hasTrough | ( | ) | const |
|
overrideprotectedvirtual |
Check if position is scroll position
实现了 QwtAbstractSlider.
|
overridevirtual |
Return minimum size hint
|
overrideprotectedvirtual |
Mouse press event
重载 QwtAbstractSlider .
|
overrideprotectedvirtual |
Mouse release event
重载 QwtAbstractSlider .
| Qt::Orientation QwtSlider::orientation | ( | ) | const |
Return orientation
|
overrideprotectedvirtual |
Scale change notification
重载 QwtAbstractSlider .
| const QwtScaleDraw * QwtSlider::scaleDraw | ( | ) | const |
Return scale draw (const version)
Return the scale draw of the slider (const version)
| QwtSlider::ScalePosition QwtSlider::scalePosition | ( | ) | const |
|
overrideprotectedvirtual |
Calculate scrolled position
实现了 QwtAbstractSlider.
| void QwtSlider::setBorderWidth | ( | int | width | ) |
Set border width
Change the slider's border width
The border width is used for drawing the slider handle and the trough.
| width | Border width |
| void QwtSlider::setFlatStyle | ( | bool | on | ) |
Set flat style
When enabled (default), the slider is drawn with flat colors instead of 3D embossed effects (qDrawShadePanel/qDrawShadeLine).
| on | true for flat style, false for classic 3D style |
| void QwtSlider::setGroove | ( | bool | on | ) |
Enable/disable groove
En/Disable the groove
The slider can be customized by showing a groove for the handle.
| on | When true, the groove is visible |
| void QwtSlider::setHandleSize | ( | const QSize & | size | ) |
Set handle 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().
| size | New size |
| void QwtSlider::setOrientation | ( | Qt::Orientation | orientation | ) |
Set orientation
Set the orientation
| orientation | Allowed values are Qt::Horizontal and Qt::Vertical |
| void QwtSlider::setScaleDraw | ( | QwtScaleDraw * | scaleDraw | ) |
Set scale draw
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() |
| void QwtSlider::setScalePosition | ( | ScalePosition | scalePosition | ) |
Set scale position
Change the position of the scale
| scalePosition | Position of the scale |
| void QwtSlider::setSpacing | ( | int | spacing | ) |
Set 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 |
| void QwtSlider::setTrough | ( | bool | on | ) |
Enable/disable trough
En/Disable the trough
The slider can be customized by showing a trough for the handle.
| on | When true, the trough is visible |
| void QwtSlider::setUpdateInterval | ( | int | interval | ) |
Set update interval
Specify the update interval for automatic scrolling
The minimal accepted value is 50 ms.
| interval | Update interval in milliseconds |
|
overridevirtual |
| int QwtSlider::spacing | ( | ) | const |
| int QwtSlider::updateInterval | ( | ) | const |
Return update interval
Return update interval in milliseconds for automatic scrolling