QtBase
v6.3.1
|
The QAbstractSlider class provides an integer value within a range. More...
#include <qabstractslider.h>
Public Types | |
enum | SliderAction { SliderNoAction , SliderSingleStepAdd , SliderSingleStepSub , SliderPageStepAdd , SliderPageStepSub , SliderToMinimum , SliderToMaximum , SliderMove } |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Slots | |
void | setValue (int) |
void | setOrientation (Qt::Orientation) |
void | setRange (int min, int max) |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
virtual void | setVisible (bool visible) |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | valueChanged (int value) |
void | sliderPressed () |
void | sliderMoved (int position) |
void | sliderReleased () |
void | rangeChanged (int min, int max) |
void | actionTriggered (int action) |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Protected Types | |
enum | SliderChange { SliderRangeChange , SliderOrientationChange , SliderStepsChange , SliderValueChange } |
Properties | |
int | minimum |
the sliders's minimum value More... | |
int | maximum |
the slider's maximum value More... | |
int | singleStep |
the single step. More... | |
int | pageStep |
the page step. More... | |
int | value |
the slider's current value More... | |
int | sliderPosition |
the current slider position More... | |
bool | tracking |
whether slider tracking is enabled More... | |
Qt::Orientation | orientation |
the orientation of the slider More... | |
bool | invertedAppearance |
whether or not a slider shows its values inverted. More... | |
bool | invertedControls |
whether or not the slider inverts its wheel and key events. More... | |
bool | sliderDown |
whether the slider is pressed down. More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QAbstractSlider class provides an integer value within a range.
\inmodule QtWidgets
The class is designed as a common super class for widgets like QScrollBar, QSlider and QDial.
Here are the main properties of the class:
\list 1
\endlist
Unity (1) may be viewed as a third step size. setValue() lets you set the current value to any integer in the allowed range, not just minimum() + n * singleStep() for integer values of n. Some widgets may allow the user to set any value at all; others may just provide multiples of singleStep() or pageStep().
QAbstractSlider emits a comprehensive set of signals:
\table \header
QAbstractSlider provides a virtual sliderChange() function that is well suited for updating the on-screen representation of sliders. By calling triggerAction(), subclasses trigger slider actions. Two helper functions QStyle::sliderPositionFromValue() and QStyle::sliderValueFromPosition() help subclasses and styles to map screen coordinates to logical range values.
Definition at line 53 of file qabstractslider.h.
\value SliderNoAction \value SliderSingleStepAdd \value SliderSingleStepSub \value SliderPageStepAdd \value SliderPageStepSub \value SliderToMinimum \value SliderToMaximum \value SliderMove
Enumerator | |
---|---|
SliderNoAction | |
SliderSingleStepAdd | |
SliderSingleStepSub | |
SliderPageStepAdd | |
SliderPageStepSub | |
SliderToMinimum | |
SliderToMaximum | |
SliderMove |
Definition at line 102 of file qabstractslider.h.
|
protected |
\value SliderRangeChange \value SliderOrientationChange \value SliderStepsChange \value SliderValueChange
Enumerator | |
---|---|
SliderRangeChange | |
SliderOrientationChange | |
SliderStepsChange | |
SliderValueChange |
Definition at line 139 of file qabstractslider.h.
Constructs an abstract slider.
The parent argument is sent to the QWidget constructor.
The \l minimum defaults to 0, the \l maximum to 99, with a \l singleStep size of 1 and a \l pageStep size of 10, and an initial \l value of 0.
Definition at line 275 of file qabstractslider.cpp.
QAbstractSlider::~QAbstractSlider | ( | ) |
Destroys the slider.
Definition at line 289 of file qabstractslider.cpp.
|
protected |
Definition at line 281 of file qabstractslider.cpp.
|
signal |
This signal is emitted when the slider action action is triggered. Actions are \l SliderSingleStepAdd, \l SliderSingleStepSub, \l SliderPageStepAdd, \l SliderPageStepSub, \l SliderToMinimum, \l SliderToMaximum, and \l SliderMove.
When the signal is emitted, the \l sliderPosition has been adjusted according to the action, but the \l value has not yet been propagated (meaning the valueChanged() signal was not yet emitted), and the visual display has not been updated. In slots connected to this signal you can thus safely adjust any action by calling setSliderPosition() yourself, based on both the action and the slider's value.
\reimp
Reimplemented from QWidget.
Definition at line 922 of file qabstractslider.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Reimplemented in QSlider, QScrollBar, Slider, and QDial.
Definition at line 940 of file qabstractslider.cpp.
bool QAbstractSlider::hasTracking | ( | ) | const |
Definition at line 443 of file qabstractslider.cpp.
bool QAbstractSlider::invertedAppearance | ( | ) | const |
Definition at line 565 of file qabstractslider.cpp.
bool QAbstractSlider::invertedControls | ( | ) | const |
Definition at line 589 of file qabstractslider.cpp.
bool QAbstractSlider::isSliderDown | ( | ) | const |
Definition at line 479 of file qabstractslider.cpp.
\reimp
\reimp
Reimplemented from QWidget.
Definition at line 777 of file qabstractslider.cpp.
int QAbstractSlider::maximum | ( | ) | const |
Definition at line 362 of file qabstractslider.cpp.
int QAbstractSlider::minimum | ( | ) | const |
Definition at line 338 of file qabstractslider.cpp.
Qt::Orientation QAbstractSlider::orientation | ( | ) | const |
Definition at line 315 of file qabstractslider.cpp.
int QAbstractSlider::pageStep | ( | ) | const |
Definition at line 420 of file qabstractslider.cpp.
|
signal |
|
protected |
Returns the current repeat action.
Definition at line 660 of file qabstractslider.cpp.
void QAbstractSlider::setInvertedAppearance | ( | bool | invert | ) |
Definition at line 571 of file qabstractslider.cpp.
void QAbstractSlider::setInvertedControls | ( | bool | invert | ) |
void QAbstractSlider::setMaximum | ( | int | max | ) |
Definition at line 356 of file qabstractslider.cpp.
void QAbstractSlider::setMinimum | ( | int | min | ) |
Definition at line 332 of file qabstractslider.cpp.
|
slot |
Definition at line 300 of file qabstractslider.cpp.
void QAbstractSlider::setPageStep | ( | int | step | ) |
|
slot |
Sets the slider's minimum to min and its maximum to max.
If max is smaller than min, min becomes the only legal value.
Definition at line 243 of file qabstractslider.cpp.
|
protected |
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.
Definition at line 645 of file qabstractslider.cpp.
void QAbstractSlider::setSingleStep | ( | int | step | ) |
void QAbstractSlider::setSliderDown | ( | bool | down | ) |
Definition at line 461 of file qabstractslider.cpp.
void QAbstractSlider::setSliderPosition | ( | int | position | ) |
Definition at line 492 of file qabstractslider.cpp.
void QAbstractSlider::setTracking | ( | bool | enable | ) |
|
slot |
Definition at line 531 of file qabstractslider.cpp.
int QAbstractSlider::singleStep | ( | ) | const |
Definition at line 396 of file qabstractslider.cpp.
|
protectedvirtual |
Reimplement this virtual function to track slider changes such as \l SliderRangeChange, \l SliderOrientationChange, \l SliderStepsChange, or \l SliderValueChange. The default implementation only updates the display and ignores the change parameter.
Reimplemented in QScrollBar, and QDial.
Definition at line 692 of file qabstractslider.cpp.
|
signal |
This signal is emitted when sliderDown is true and the slider moves. This usually happens when the user is dragging the slider. The value is the new slider position.
This signal is emitted even when tracking is turned off.
int QAbstractSlider::sliderPosition | ( | ) | const |
Definition at line 507 of file qabstractslider.cpp.
|
signal |
This signal is emitted when the user presses the slider with the mouse, or programmatically when setSliderDown(true) is called.
|
signal |
This signal is emitted when the user releases the slider with the mouse, or programmatically when setSliderDown(false) is called.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QObject.
Definition at line 668 of file qabstractslider.cpp.
void QAbstractSlider::triggerAction | ( | SliderAction | action | ) |
Triggers a slider action. Possible actions are \l SliderSingleStepAdd, \l SliderSingleStepSub, \l SliderPageStepAdd, \l SliderPageStepSub, \l SliderToMinimum, \l SliderToMaximum, and \l SliderMove.
Definition at line 608 of file qabstractslider.cpp.
int QAbstractSlider::value | ( | ) | const |
|
signal |
This signal is emitted when the slider value has changed, with the new slider value as argument.
|
readwrite |
whether or not a slider shows its values inverted.
If this property is false
(the default), the minimum and maximum will be shown in its classic position for the inherited widget. If the value is true, the minimum and maximum appear at their opposite location.
Note: This property makes most sense for sliders and dials. For scroll bars, the visual effect of the scroll bar subcontrols depends on whether or not the styles understand inverted appearance; most styles ignore this property for scroll bars.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
whether or not the slider inverts its wheel and key events.
If this property is false
, scrolling the mouse wheel "up" and using keys like page up will increase the slider's value towards its maximum. Otherwise pressing page up will move value towards the slider's minimum.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the slider's maximum value
When setting this property, the \l minimum is adjusted if necessary to ensure that the range remains valid. Also the slider's current value is adjusted to be within the new range.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the sliders's minimum value
When setting this property, the \l maximum is adjusted if necessary to ensure that the range remains valid. Also the slider's current value is adjusted to be within the new range.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the orientation of the slider
The orientation must be \l Qt::Vertical (the default) or \l Qt::Horizontal.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the page step.
The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the single step.
The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
If the property is modified during an auto repeating key event, behavior is undefined.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
whether the slider is pressed down.
The property is set by subclasses in order to let the abstract slider know whether or not \l tracking has any effect.
Changing the slider down property emits the sliderPressed() and sliderReleased() signals.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the current slider position
If \l tracking is enabled (the default), this is identical to \l value.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
whether slider tracking is enabled
If tracking is enabled (the default), the slider emits the valueChanged() signal while the slider is being dragged. If tracking is disabled, the slider emits the valueChanged() signal only when the user releases the slider.
Definition at line 163 of file qabstractslider.h.
|
readwrite |
the slider's current value
The slider forces the value to be within the legal range: \l minimum <= value
<= \l maximum.
Changing the value also changes the \l sliderPosition.
Definition at line 163 of file qabstractslider.h.