diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-10-25 19:56:34 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 12:57:59 +0100 |
commit | b2d3d6365edc312d18451e58e1a0b18c538b3f98 (patch) | |
tree | 7e708484bccdfcc9b0802c200a5010b81bccf568 | |
parent | 48894cc75b08964e0303c8045cb9ec0c274a4c9e (diff) |
QDateTimeEdit: use QSignalBlocker
Change-Id: I4983e96a51220f40644d202d76e92a889ae9431a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index a0bbbbf7c7..6bfc251a2a 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1718,7 +1718,7 @@ void QDateTimeEditPrivate::updateEdit() if (newText == displayText()) return; int selsize = edit->selectedText().size(); - const bool sb = edit->blockSignals(true); + const QSignalBlocker blocker(edit); edit->setText(newText); @@ -1740,7 +1740,6 @@ void QDateTimeEditPrivate::updateEdit() } } - edit->blockSignals(sb); } @@ -1871,7 +1870,7 @@ void QDateTimeEditPrivate::clearSection(int index) { const QLatin1Char space(' '); int cursorPos = edit->cursorPosition(); - bool blocked = edit->blockSignals(true); + const QSignalBlocker blocker(edit); QString t = edit->text(); const int pos = sectionPos(index); if (pos == -1) { @@ -1883,8 +1882,6 @@ void QDateTimeEditPrivate::clearSection(int index) edit->setText(t); edit->setCursorPosition(cursorPos); QDTEDEBUG << cursorPos; - - edit->blockSignals(blocked); } @@ -2574,10 +2571,9 @@ void QDateTimeEditPrivate::syncCalendarWidget() { Q_Q(QDateTimeEdit); if (monthCalendar) { - const bool sb = monthCalendar->blockSignals(true); + const QSignalBlocker blocker(monthCalendar); monthCalendar->setDateRange(q->minimumDate(), q->maximumDate()); monthCalendar->setDate(q->date()); - monthCalendar->blockSignals(sb); } } |