diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-09-30 07:12:57 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-10-04 09:35:06 +0000 |
commit | c330cf067959b1919fd2d75a5e3797e0e64cc9fc (patch) | |
tree | 7ccfef4b8841efde06cdffce7708c8f4e0ec156b /src/plugins/fakevim | |
parent | 7c3ea5a78c30c90d6ce250aa312a2cb6cc587901 (diff) |
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>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r-- | src/plugins/fakevim/fakevimplugin.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 5a914075a6d..0ec944f92e0 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -137,14 +137,15 @@ public: int messageLevel, FakeVimHandler *eventFilter) { if (cursorPos != -1) { - m_edit->blockSignals(true); - m_label->clear(); - m_edit->setText(contents); - if (anchorPos != -1 && anchorPos != cursorPos) - m_edit->setSelection(anchorPos, cursorPos - anchorPos); - else - m_edit->setCursorPosition(cursorPos); - m_edit->blockSignals(false); + { + QSignalBlocker blocker(m_edit); + m_label->clear(); + m_edit->setText(contents); + if (anchorPos != -1 && anchorPos != cursorPos) + m_edit->setSelection(anchorPos, cursorPos - anchorPos); + else + m_edit->setCursorPosition(cursorPos); + } setCurrentWidget(m_edit); m_edit->setFocus(); } else { |