diff options
author | David Schulz <david.schulz@qt.io> | 2023-03-28 14:33:39 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2023-03-30 08:00:19 +0000 |
commit | 73c645820fe3df797b5e813c1881afabcab0fd7e (patch) | |
tree | 5d348ceeb7a770d4cdf2ec0cdbe2d92d6adfb082 /src/plugins/texteditor | |
parent | 0f3f5fb4d83c82d83366db2e1a464af573a39c05 (diff) | |
download | qt-creator-73c645820fe3df797b5e813c1881afabcab0fd7e.tar.gz |
TextEditor: use QScopeGuard instead of ExecuteOnDestruction
Change-Id: I2d7c04d69ad49a121b157af2750eaed26bab9480
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index e61262094f..4b0df472f8 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -2533,7 +2533,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) { ICore::restartTrimmer(); - ExecuteOnDestruction eod([&]() { d->clearBlockSelection(); }); + auto clearBlockSelectionGuard = qScopeGuard([&]() { d->clearBlockSelection(); }); if (!isModifier(e) && mouseHidingEnabled()) viewport()->setCursor(Qt::BlankCursor); @@ -2803,8 +2803,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) } if (blockSelectionOperation != QTextCursor::NoMove) { - auto doNothing = [](){}; - eod.reset(doNothing); + clearBlockSelectionGuard.dismiss(); d->handleMoveBlockSelection(blockSelectionOperation); } else if (!d->cursorMoveKeyEvent(e)) { QTextCursor cursor = textCursor(); |