QDateTimeEdit: use QSignalBlocker
Change-Id: I4983e96a51220f40644d202d76e92a889ae9431a Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
48894cc75b
commit
b2d3d6365e
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user