diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-09-11 10:50:57 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-09-12 05:43:35 +0200 |
commit | f7863bfdb90f25fa62a395f8bc80641a54c69179 (patch) | |
tree | 6d21407c9cc7defe63d40c7fe4c1682376996dd6 /src | |
parent | 60a6f3f3da1209674dc57d72dff0559cde47bbf1 (diff) |
QAbstractSpinBox: don't emit update signals twice
A QAbstractSpinBox has a spinClickThresholdTimer that is detecting
if the user is doing a press'n'hold on one of the spin buttons, to
activate auto-repeat.
But if the valueChanged() handler in the application spends too much
time before it returns, the spinClickThresholdTimer will fire before
we get a chance to cancel it from the pending mouseRelease event.
The result is that the spinbox will think that the user is doing a
press'n'hold, and increment the value once more.
To avoid this, we start the timer _after_ the call to
valueChanged() instead.
Pick-to: 5.15
Fixes: QTBUG-86483
Change-Id: Iff5de4f8da562738e02848c98bc1fbc9fe227748
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 154957eea3..b9b62bbaaa 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1678,12 +1678,12 @@ void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false reset(); if (q && (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled : QAbstractSpinBox::StepDownEnabled))) { - spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse); int steps = up ? 1 : -1; if (keyboardModifiers & stepModifier) steps *= 10; q->stepBy(steps); + spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); #ifndef QT_NO_ACCESSIBILITY QAccessibleValueChangeEvent event(q, value); QAccessible::updateAccessibility(&event); |