QAbstractSpinBox: use QSignalBlocker

This change changes the point where signals are unblocked again in
QAbstractSpinBoxPrivate::updateEdit() to include the final update()
call. This should not be a problem, as update() merely posts an
event and shouldn't emit any signals.

Change-Id: I4b2ae109f057792b573ad6ea168ca77c18c773d0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2013-10-25 19:51:33 +02:00 committed by The Qt Project
parent 8d7b0a8c3e
commit 48894cc75b

View File

@ -1516,13 +1516,12 @@ void QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(int oldpos, int new
* (newpos < pos ? -1 : 1)) - newpos + pos
: 0;
const bool wasBlocked = edit->blockSignals(true);
const QSignalBlocker blocker(edit);
if (selSize != 0) {
edit->setSelection(pos - selSize, selSize);
} else {
edit->setCursorPosition(pos);
}
edit->blockSignals(wasBlocked);
}
ignoreCursorPositionChanged = false;
}
@ -1722,7 +1721,7 @@ void QAbstractSpinBoxPrivate::updateEdit()
const bool empty = edit->text().isEmpty();
int cursor = edit->cursorPosition();
int selsize = edit->selectedText().size();
const bool sb = edit->blockSignals(true);
const QSignalBlocker blocker(edit);
edit->setText(newText);
if (!specialValue()) {
@ -1734,7 +1733,6 @@ void QAbstractSpinBoxPrivate::updateEdit()
edit->setCursorPosition(empty ? prefix.size() : cursor);
}
}
edit->blockSignals(sb);
q->update();
}