47 #ifndef QT_NO_ACCESSIBILITY 233 : minimum(0), maximum(99), pageStep(10), value(0),
position(0), pressValue(-1),
234 singleStep(1), offset_accumulated(0), tracking(true),
235 blocktracking(false), pressed(false),
236 invertedAppearance(false), invertedControls(false),
238 #ifdef QT_KEYPAD_NAVIGATION
239 , isAutoRepeating(false)
240 , repeatMultiplier(1)
242 firstRepeat.invalidate();
264 int oldMin =
d->minimum;
265 int oldMax =
d->maximum;
267 d->maximum =
qMax(min, max);
268 if (oldMin !=
d->minimum || oldMax !=
d->maximum) {
269 sliderChange(SliderRangeChange);
270 emit rangeChanged(
d->minimum,
d->maximum);
322 if (
d->orientation == orientation)
339 return d->orientation;
417 if (step !=
d->singleStep)
418 d->setSteps(step,
d->pageStep);
424 return d->singleStep;
444 if (step !=
d->pageStep)
445 d->setSteps(
d->singleStep, step);
471 d->tracking = enable;
498 bool doEmit =
d->pressed != down;
509 if (!down &&
d->position !=
d->value)
532 position =
d->bound(position);
533 if (position ==
d->position)
540 if (
d->tracking && !
d->blocktracking)
573 value =
d->bound(value);
574 if (
d->value == value &&
d->position == value)
577 if (
d->position != value) {
582 #ifndef QT_NO_ACCESSIBILITY 609 return d->invertedAppearance;
615 d->invertedAppearance = invert;
636 return d->invertedControls;
642 d->invertedControls = invert;
653 d->blocktracking =
true;
678 d->blocktracking =
false;
691 d->repeatActionTimer.stop();
693 d->repeatActionTime = repeatTime;
694 d->repeatActionTimer.start(thresholdTime,
this);
705 return d->repeatAction;
713 if (e->
timerId() ==
d->repeatActionTimer.timerId()) {
714 if (
d->repeatActionTime) {
715 d->repeatActionTimer.start(
d->repeatActionTime,
this);
716 d->repeatActionTime = 0;
719 d->setAdjustedSliderPosition(
d->overflowSafeAdd(
d->pageStep));
721 d->setAdjustedSliderPosition(
d->overflowSafeAdd(-
d->pageStep));
754 int stepsToScroll = 0;
763 offset_accumulated = 0;
768 qreal stepsToScrollF =
769 #ifndef QT_NO_WHEELEVENT 772 offset * effectiveSingleStep();
774 if (offset_accumulated != 0 && (offset / offset_accumulated) < 0)
775 offset_accumulated = 0;
777 offset_accumulated += stepsToScrollF;
788 if (stepsToScroll == 0)
793 stepsToScroll = -stepsToScroll;
795 int prevValue =
value;
796 position = overflowSafeAdd(stepsToScroll);
799 if (prevValue ==
value) {
800 offset_accumulated = 0;
809 #ifndef QT_NO_WHEELEVENT 814 int delta = e->
delta();
828 #ifdef QT_KEYPAD_NAVIGATION 830 if (!
d->firstRepeat.isValid())
831 d->firstRepeat.start();
832 else if (1 ==
d->repeatMultiplier) {
835 const int repeatMSecs =
d->firstRepeat.elapsed();
847 const int SliderRepeatElapse = 2500;
849 d->repeatMultiplier = currentTimeElapse / SliderRepeatElapse;
853 else if (
d->firstRepeat.isValid()) {
854 d->firstRepeat.invalidate();
855 d->repeatMultiplier = 1;
861 #ifdef QT_KEYPAD_NAVIGATION 863 if (QApplication::keypadNavigationEnabled())
864 setEditFocus(!hasEditFocus());
869 if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
879 #ifdef QT_KEYPAD_NAVIGATION 883 if (QApplication::keypadNavigationEnabled()
887 && (QWidgetPrivate::canKeypadNavigate(
Qt::Horizontal) || QWidgetPrivate::inTabWidget(
this)))) {
891 if (QApplication::keypadNavigationEnabled() &&
d->orientation ==
Qt::Vertical)
901 #ifdef QT_KEYPAD_NAVIGATION 903 if (QApplication::keypadNavigationEnabled()
907 && (QWidgetPrivate::canKeypadNavigate(
Qt::Horizontal) || QWidgetPrivate::inTabWidget(
this)))) {
911 if (QApplication::keypadNavigationEnabled() &&
d->orientation ==
Qt::Vertical)
921 #ifdef QT_KEYPAD_NAVIGATION 924 if (QApplication::keypadNavigationEnabled()
927 || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(
Qt::Vertical))) {
935 #ifdef QT_KEYPAD_NAVIGATION 937 if (QApplication::keypadNavigationEnabled()
940 || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(
Qt::Vertical))) {
973 switch (ev->
type()) {
976 d->repeatActionTimer.stop();
990 #ifdef QT_KEYPAD_NAVIGATION 994 d->origValue =
d->value;
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
The QKeyEvent class describes a key event.
void sliderPressed()
This signal is emitted when the user presses the slider with the mouse, or programmatically when setS...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
bool scrollByDelta(Qt::Orientation orientation, Qt::KeyboardModifiers modifiers, int delta)
virtual void sliderChange(SliderChange change)
Reimplement this virtual function to track slider changes such as SliderRangeChange ...
bool event(QEvent *e)
Reimplemented Function
void sliderMoved(int position)
This signal is emitted when sliderDown is true and the slider moves.
int sliderPosition() const
The QWheelEvent class contains parameters that describe a wheel event.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
void triggerAction(SliderAction action)
Triggers a slider action.
void actionTriggered(int action)
This signal is emitted when the slider action action is triggered.
QAbstractSlider(QWidget *parent=0)
Constructs an abstract slider.
void changeEvent(QEvent *e)
Reimplemented Function
void setInvertedAppearance(bool)
Q_DECL_CONSTEXPR T qAbs(const T &t)
static int wheelScrollLines()
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
void keyPressEvent(QKeyEvent *ev)
Reimplemented Function
~QAbstractSliderPrivate()
int key() const
Returns the code of the key that was pressed or released.
bool isSliderDown() const
void setInvertedControls(bool)
#define QT_BEGIN_NAMESPACE
This macro expands to.
int delta() const
Returns the distance that the wheel is rotated, in eighths of a degree.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Qt::Orientation orientation() const
static int clampScrollStep(qreal x)
Truncate qreal to int without flipping on overflow.
bool invertedControls() const
bool invertedAppearance() const
void valueChanged(int value)
This signal is emitted when the slider value has changed, with the new slider value as argument...
Qt::Orientation orientation() const
Returns the wheel's orientation.
~QAbstractSlider()
Destroys the slider.
The QTimerEvent class contains parameters that describe a timer event.
void sliderReleased()
This signal is emitted when the user releases the slider with the mouse, or programmatically when set...
QObject * parent() const
Returns a pointer to the parent object.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
void setSliderPosition(int)
The QAbstractSlider class provides an integer value within a range.
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
void wheelEvent(QWheelEvent *e)
Reimplemented Function
void setOrientation(Qt::Orientation)
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
void setTracking(bool enable)
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
void setSteps(int single, int page)
void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
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...
SliderAction repeatAction() const
Returns the current repeat action.