Replace manual signal blocking/unblocking with QSignalBlocker

Change-Id: Ibb59fab4e37d045e506c5a8172b6f5cbb955b028
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2017-09-30 07:12:57 +02:00
parent 7c3ea5a78c
commit c330cf0679
39 changed files with 195 additions and 226 deletions

View File

@@ -155,9 +155,10 @@ void CppEditorOutline::setSorted(bool sort)
m_proxyModel->sort(0, Qt::AscendingOrder);
else
m_proxyModel->sort(-1, Qt::AscendingOrder);
bool block = m_sortAction->blockSignals(true);
m_sortAction->setChecked(m_proxyModel->sortColumn() == 0);
m_sortAction->blockSignals(block);
{
QSignalBlocker blocker(m_sortAction);
m_sortAction->setChecked(m_proxyModel->sortColumn() == 0);
}
updateIndexNow();
}
}
@@ -226,10 +227,9 @@ void CppEditorOutline::updateIndexNow()
QModelIndex comboIndex = modelIndex();
if (comboIndex.isValid()) {
bool blocked = m_combo->blockSignals(true);
QSignalBlocker blocker(m_combo);
m_combo->setCurrentIndex(m_proxyModel->mapFromSource(comboIndex));
updateToolTip();
m_combo->blockSignals(blocked);
}
}