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>
This commit is contained in:
parent
60a6f3f3da
commit
f7863bfdb9
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user