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();
|
ICore::restartTrimmer();
|
||||||
|
|
||||||
ExecuteOnDestruction eod([&]() { d->clearBlockSelection(); });
|
auto clearBlockSelectionGuard = qScopeGuard([&]() { d->clearBlockSelection(); });
|
||||||
|
|
||||||
if (!isModifier(e) && mouseHidingEnabled())
|
if (!isModifier(e) && mouseHidingEnabled())
|
||||||
viewport()->setCursor(Qt::BlankCursor);
|
viewport()->setCursor(Qt::BlankCursor);
|
||||||
@@ -2803,8 +2803,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (blockSelectionOperation != QTextCursor::NoMove) {
|
if (blockSelectionOperation != QTextCursor::NoMove) {
|
||||||
auto doNothing = [](){};
|
clearBlockSelectionGuard.dismiss();
|
||||||
eod.reset(doNothing);
|
|
||||||
d->handleMoveBlockSelection(blockSelectionOperation);
|
d->handleMoveBlockSelection(blockSelectionOperation);
|
||||||
} else if (!d->cursorMoveKeyEvent(e)) {
|
} else if (!d->cursorMoveKeyEvent(e)) {
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
|
Reference in New Issue
Block a user