9#if QT_CONFIG(accessibility)
14#include <private/qapplication_p.h>
179 : minimum(0), maximum(99), pageStep(10),
value(0),
position(0), pressValue(-1),
180 singleStep(1), singleStepFromItemView(-1), viewMayChangeSingleStep(true), offset_accumulated(0), tracking(true),
182 invertedAppearance(
false), invertedControls(
false),
184#ifdef QT_KEYPAD_NAVIGATION
185 , isAutoRepeating(
false)
186 , repeatMultiplier(1)
188 firstRepeat.invalidate();
210 int oldMin =
d->minimum;
211 int oldMax =
d->maximum;
213 d->maximum =
qMax(min, max);
214 if (oldMin !=
d->minimum || oldMax !=
d->maximum) {
215 sliderChange(SliderRangeChange);
216 emit rangeChanged(
d->minimum,
d->maximum);
282 return d->orientation;
352 d->viewMayChangeSingleStep = (step < 0);
353 if (step < 0 && d->singleStepFromItemView > 0)
354 step =
d->singleStepFromItemView;
356 if (step !=
d->singleStep)
357 d->setSteps(step,
d->pageStep);
363 return d->singleStep;
380 if (step !=
d->pageStep)
381 d->setSteps(
d->singleStep, step);
428 bool doEmit =
d->pressed != down;
439 if (!down &&
d->position !=
d->value)
467 if (
d->tracking && !
d->blocktracking)
503 const bool emitValueChanged = (
value !=
d->value);
506 if (
d->position !=
value) {
511#if QT_CONFIG(accessibility)
512 QAccessibleValueChangeEvent
event(
this,
d->value);
513 QAccessible::updateAccessibility(&
event);
517 if (emitValueChanged)
539 return d->invertedAppearance;
545 d->invertedAppearance =
invert;
563 return d->invertedControls;
582 d->blocktracking =
true;
607 d->blocktracking =
false;
620 d->repeatActionTimer.stop();
622 d->repeatActionTime = repeatTime;
623 d->repeatActionTimer.start(thresholdTime,
this);
634 return d->repeatAction;
642 if (e->
timerId() ==
d->repeatActionTimer.timerId()) {
643 if (
d->repeatActionTime) {
644 d->repeatActionTimer.start(
d->repeatActionTime,
this);
645 d->repeatActionTime = 0;
648 d->setAdjustedSliderPosition(
d->overflowSafeAdd(
d->pageStep));
650 d->setAdjustedSliderPosition(
d->overflowSafeAdd(-
d->pageStep));
671 int stepsToScroll = 0;
685 qreal stepsToScrollF =
686#if QT_CONFIG(wheelevent)
687 QApplication::wheelScrollLines() *
700 if (stepsToScroll == 0) {
706 if (effective_offset < 0.f && value >
minimum)
714 stepsToScroll = -stepsToScroll;
716 int prevValue =
value;
720 if (prevValue ==
value) {
730#if QT_CONFIG(wheelevent)
731void QAbstractSlider::wheelEvent(QWheelEvent * e)
735 bool vertical = bool(e->angleDelta().y());
736 int delta = vertical ? e->angleDelta().y() : e->angleDelta().x();
752#ifdef QT_KEYPAD_NAVIGATION
753 if (ev->isAutoRepeat()) {
754 if (!
d->firstRepeat.isValid())
755 d->firstRepeat.start();
756 else if (1 ==
d->repeatMultiplier) {
759 const int repeatMSecs =
d->firstRepeat.elapsed();
771 const int SliderRepeatElapse = 2500;
773 d->repeatMultiplier = currentTimeElapse / SliderRepeatElapse;
777 else if (
d->firstRepeat.isValid()) {
778 d->firstRepeat.invalidate();
779 d->repeatMultiplier = 1;
785#ifdef QT_KEYPAD_NAVIGATION
787 if (QApplicationPrivate::keypadNavigationEnabled())
788 setEditFocus(!hasEditFocus());
793 if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus()) {
802#ifdef QT_KEYPAD_NAVIGATION
806 if (QApplicationPrivate::keypadNavigationEnabled()
810 && (QWidgetPrivate::canKeypadNavigate(
Qt::Horizontal) || QWidgetPrivate::inTabWidget(
this)))) {
814 if (QApplicationPrivate::keypadNavigationEnabled() &&
d->orientation ==
Qt::Vertical)
824#ifdef QT_KEYPAD_NAVIGATION
826 if (QApplicationPrivate::keypadNavigationEnabled()
830 && (QWidgetPrivate::canKeypadNavigate(
Qt::Horizontal) || QWidgetPrivate::inTabWidget(
this)))) {
834 if (QApplicationPrivate::keypadNavigationEnabled() &&
d->orientation ==
Qt::Vertical)
844#ifdef QT_KEYPAD_NAVIGATION
847 if (QApplicationPrivate::keypadNavigationEnabled()
850 || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(
Qt::Vertical))) {
858#ifdef QT_KEYPAD_NAVIGATION
860 if (QApplicationPrivate::keypadNavigationEnabled()
863 || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(
Qt::Vertical))) {
896 switch (ev->type()) {
899 d->repeatActionTimer.stop();
913#ifdef QT_KEYPAD_NAVIGATION
917 d->origValue =
d->value;
941#include "moc_qabstractslider.cpp"
int overflowSafeAdd(int add) const
int singleStepFromItemView
void itemviewChangeSingleStep(int step)
void setSteps(int single, int page)
int effectiveSingleStep() const
virtual int bound(int val) const
Qt::Orientation orientation
~QAbstractSliderPrivate()
bool scrollByDelta(Qt::Orientation orientation, Qt::KeyboardModifiers modifiers, int delta)
bool viewMayChangeSingleStep
The QAbstractSlider class provides an integer value within a range.
bool invertedControls
whether or not the slider inverts its wheel and key events.
void sliderPressed()
This signal is emitted when the user presses the slider with the mouse, or programmatically when setS...
void keyPressEvent(QKeyEvent *ev) override
\reimp
void setInvertedControls(bool)
int value
the slider's current value
QAbstractSlider(QWidget *parent=nullptr)
Constructs an abstract slider.
SliderAction repeatAction() const
Returns the current repeat action.
void setRepeatAction(SliderAction action, int thresholdTime=500, int repeatTime=50)
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of...
void sliderReleased()
This signal is emitted when the user releases the slider with the mouse, or programmatically when set...
virtual void sliderChange(SliderChange change)
Reimplement this virtual function to track slider changes such as \l SliderRangeChange,...
void valueChanged(int value)
This signal is emitted when the slider value has changed, with the new slider value as argument.
SliderAction
\value SliderNoAction \value SliderSingleStepAdd \value SliderSingleStepSub \value SliderPageStepAdd ...
void setTracking(bool enable)
void setInvertedAppearance(bool)
bool isSliderDown() const
int pageStep
the page step.
void setOrientation(Qt::Orientation)
Qt::Orientation orientation
the orientation of the slider
void actionTriggered(int action)
This signal is emitted when the slider action action is triggered.
int sliderPosition
the current slider position
int singleStep
the single step.
bool invertedAppearance
whether or not a slider shows its values inverted.
void sliderMoved(int position)
This signal is emitted when sliderDown is true and the slider moves.
void timerEvent(QTimerEvent *) override
\reimp
bool event(QEvent *e) override
\reimp
int minimum
the sliders's minimum value
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
void setSliderPosition(int)
SliderChange
\value SliderRangeChange \value SliderOrientationChange \value SliderStepsChange \value SliderValueCh...
int maximum
the slider's maximum value
void changeEvent(QEvent *e) override
\reimp
~QAbstractSlider()
Destroys the slider.
void triggerAction(SliderAction action)
Triggers a slider action.
Type type() const
Returns the event type.
The QKeyEvent class describes a key event.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
EGLImageKHR int int EGLuint64KHR * modifiers
Combined button and popup list for selecting options.
@ NavigationModeKeypadTabOrder
@ WA_WState_OwnSizePolicy
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLenum GLuint GLintptr offset
GLdouble GLdouble GLdouble GLdouble q
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
settings setValue("DataPump/bgcolor", color)