diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-10-25 19:51:33 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 12:57:47 +0100 |
commit | 48894cc75b08964e0303c8045cb9ec0c274a4c9e (patch) | |
tree | 90813d38b3c5273d00cbe560b2582fdfc0b80539 /src/widgets/widgets/qabstractspinbox.cpp | |
parent | 8d7b0a8c3ef9929aabfda53c0cbd73b148859c44 (diff) |
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>
Diffstat (limited to 'src/widgets/widgets/qabstractspinbox.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index af3a4d35f9..92af91b66e 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -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(); } |