forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user