From abb85b073a960d066b40150c09b62696de13b5c4 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 7 Jun 2023 09:39:30 +0200 Subject: [PATCH] QScopeGuard: Make all usages of QScopeGuard consistent Change-Id: Icfc35ecbdbdee8dadbb1b17789694093427c3ed9 Reviewed-by: Marco Bubke Reviewed-by: hjk Reviewed-by: Qt CI Bot --- src/app/main.cpp | 2 +- src/libs/utils/deviceshell.cpp | 1 - src/libs/utils/process.cpp | 2 +- src/plugins/android/androidrunnerworker.cpp | 2 +- .../clangtools/documentclangtoolrunner.cpp | 4 ++-- src/plugins/copilot/copilothoverhandler.cpp | 5 +++-- .../editormanager/editormanager.cpp | 2 +- .../coreplugin/locator/javascriptfilter.cpp | 1 - src/plugins/coreplugin/loggingviewer.cpp | 2 +- .../languageclient/clientrequesttask.cpp | 2 -- .../componentcore/designeractionmanager.cpp | 2 +- .../dynamicpropertiesproxymodel.cpp | 6 +++--- .../propertyeditor/gradientmodel.cpp | 4 ++-- .../propertyeditor/propertyeditorview.cpp | 21 ++++++++++--------- .../richtexteditor/richtexteditor.cpp | 1 - .../stateseditor/stateseditorview.cpp | 15 ++++++------- .../stateseditornew/stateseditorview.cpp | 20 ++++++++++-------- .../designercore/model/texttomodelmerger.cpp | 2 +- src/plugins/remotelinux/linuxdevice.cpp | 1 - src/plugins/texteditor/basehoverhandler.cpp | 2 +- .../texteditor/codeassist/codeassistant.cpp | 2 +- .../texteditor/colorpreviewhoverhandler.cpp | 2 +- src/plugins/texteditor/texteditor.cpp | 8 +++---- .../processlauncher/processlauncher-main.cpp | 2 +- .../utils/process/processtestapp/main.cpp | 2 +- .../process/processtestapp/processtestapp.cpp | 2 +- tests/unit/unittest/unittests-main.cpp | 1 - 27 files changed, 57 insertions(+), 59 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index ec401522928..e6a7bdcd7ec 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -586,7 +586,7 @@ int main(int argc, char **argv) QCoreApplication::setOrganizationName(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR)); QGuiApplication::setApplicationDisplayName(Core::Constants::IDE_DISPLAY_NAME); - auto cleanup = qScopeGuard([] { Utils::Singleton::deleteAll(); }); + const QScopeGuard cleanup([] { Utils::Singleton::deleteAll(); }); const QStringList pluginArguments = app.arguments(); diff --git a/src/libs/utils/deviceshell.cpp b/src/libs/utils/deviceshell.cpp index f96c5da8f2d..99ddecdeec9 100644 --- a/src/libs/utils/deviceshell.cpp +++ b/src/libs/utils/deviceshell.cpp @@ -8,7 +8,6 @@ #include "qtcassert.h" #include -#include Q_LOGGING_CATEGORY(deviceShellLog, "qtc.utils.deviceshell", QtWarningMsg) diff --git a/src/libs/utils/process.cpp b/src/libs/utils/process.cpp index e1302671e34..970b0b4a296 100644 --- a/src/libs/utils/process.cpp +++ b/src/libs/utils/process.cpp @@ -66,7 +66,7 @@ public: return std::invoke(std::forward(function), std::forward(args)...); QElapsedTimer timer; timer.start(); - auto cleanup = qScopeGuard([this, &timer] { + const QScopeGuard cleanup([this, &timer] { const qint64 currentNsecs = timer.nsecsElapsed(); const bool mainThread = isMainThread(); const int hitThisAll = m_hitThisAll.fetch_add(1) + 1; diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index 65ef8695580..b9a09629fb2 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -341,7 +341,7 @@ bool AndroidRunnerWorker::uploadDebugServer(const QString &debugServerFileName) } const QString tempDebugServerPath = tempDebugServerPathTemplate.arg(count); - auto cleanUp = qScopeGuard([this, tempDebugServerPath] { + const QScopeGuard cleanup([this, tempDebugServerPath] { if (!runAdb({"shell", "rm", "-f", tempDebugServerPath})) qCDebug(androidRunWorkerLog) << "Debug server cleanup failed."; }); diff --git a/src/plugins/clangtools/documentclangtoolrunner.cpp b/src/plugins/clangtools/documentclangtoolrunner.cpp index 93cd27bac38..8dab531dcb6 100644 --- a/src/plugins/clangtools/documentclangtoolrunner.cpp +++ b/src/plugins/clangtools/documentclangtoolrunner.cpp @@ -158,7 +158,7 @@ void DocumentClangToolRunner::run() if (m_projectSettingsUpdate) disconnect(m_projectSettingsUpdate); m_taskTree.reset(); - QScopeGuard guard([this] { finalize(); }); + QScopeGuard cleanup([this] { finalize(); }); auto isEditorForCurrentDocument = [this](const IEditor *editor) { return editor->document() == m_document; @@ -216,7 +216,7 @@ void DocumentClangToolRunner::run() if (tasks.isEmpty()) return; - guard.dismiss(); + cleanup.dismiss(); m_taskTree.reset(new TaskTree(tasks)); connect(m_taskTree.get(), &TaskTree::done, this, &DocumentClangToolRunner::finalize); connect(m_taskTree.get(), &TaskTree::errorOccurred, this, &DocumentClangToolRunner::finalize); diff --git a/src/plugins/copilot/copilothoverhandler.cpp b/src/plugins/copilot/copilothoverhandler.cpp index 135cbd8390f..d17ec073b2c 100644 --- a/src/plugins/copilot/copilothoverhandler.cpp +++ b/src/plugins/copilot/copilothoverhandler.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -117,7 +118,7 @@ void CopilotHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, ReportPriority report) { - auto reportNone = qScopeGuard([&] { report(Priority_None); }); + QScopeGuard cleanup([&] { report(Priority_None); }); if (!editorWidget->suggestionVisible()) return; @@ -133,7 +134,7 @@ void CopilotHoverHandler::identifyMatch(TextEditorWidget *editorWidget, if (completions.isEmpty()) return; - reportNone.dismiss(); + cleanup.dismiss(); report(Priority_Suggestion); } diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 81262f5ebfe..261146797b4 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -3325,7 +3325,7 @@ IEditor *EditorManager::openEditorWithContents(Id editorId, EditorManager::gotoOtherSplit(); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - const auto cleanup = qScopeGuard(&QApplication::restoreOverrideCursor); + const QScopeGuard cleanup(&QApplication::restoreOverrideCursor); const QString title = makeTitleUnique(titlePattern); diff --git a/src/plugins/coreplugin/locator/javascriptfilter.cpp b/src/plugins/coreplugin/locator/javascriptfilter.cpp index 3656d673205..b179b32316d 100644 --- a/src/plugins/coreplugin/locator/javascriptfilter.cpp +++ b/src/plugins/coreplugin/locator/javascriptfilter.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include diff --git a/src/plugins/coreplugin/loggingviewer.cpp b/src/plugins/coreplugin/loggingviewer.cpp index 63fba41a4df..742e65a34c5 100644 --- a/src/plugins/coreplugin/loggingviewer.cpp +++ b/src/plugins/coreplugin/loggingviewer.cpp @@ -591,7 +591,7 @@ void LoggingViewManagerWidget::saveLoggingsToFile() const { // should we just let it continue without temporarily disabling? const bool enabled = m_manager->isEnabled(); - const auto cleanup = qScopeGuard([this, enabled] { m_manager->setEnabled(enabled); }); + const QScopeGuard cleanup([this, enabled] { m_manager->setEnabled(enabled); }); if (enabled) m_manager->setEnabled(false); const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(), diff --git a/src/plugins/languageclient/clientrequesttask.cpp b/src/plugins/languageclient/clientrequesttask.cpp index ed3ddaff2c5..6da5be5704c 100644 --- a/src/plugins/languageclient/clientrequesttask.cpp +++ b/src/plugins/languageclient/clientrequesttask.cpp @@ -3,8 +3,6 @@ #include "clientrequesttask.h" -#include - using namespace LanguageServerProtocol; namespace LanguageClient { diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index 77976993e4f..7243225c887 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -635,7 +635,7 @@ public: const auto selection = selectionContext(); bool showMenu = false; - auto cleanup = qScopeGuard([&]{ menu()->setEnabled(showMenu); }); + const QScopeGuard cleanup([&]{ menu()->setEnabled(showMenu); }); if (!selection.isValid()) return; diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp index 689753ff8be..977488a107a 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp @@ -330,7 +330,7 @@ void DynamicPropertyRow::commitValue(const QVariant &value) return; m_lock = true; - auto unlock = qScopeGuard([this] { m_lock = false; }); + const QScopeGuard cleanup([this] { m_lock = false; }); auto view = propertiesModel->view(); RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__); @@ -371,7 +371,7 @@ void DynamicPropertyRow::commitExpression(const QString &expression) } m_lock = true; - auto unlock = qScopeGuard([this] { m_lock = false; }); + const QScopeGuard cleanup([this] { m_lock = false; }); auto view = propertiesModel->view(); RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__); @@ -426,7 +426,7 @@ void DynamicPropertyRow::resetValue() } } else { m_lock = true; - auto unlock = qScopeGuard([this] { m_lock = false; }); + const QScopeGuard cleanup([this] { m_lock = false; }); RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__); try { diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp index a81560f5662..67ee0ec15ce 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp @@ -306,7 +306,7 @@ QString GradientModel::readGradientOrientation() const void GradientModel::setupModel() { m_locked = true; - auto guard = qScopeGuard([&] { m_locked = false; }); + const QScopeGuard cleanup([&] { m_locked = false; }); beginResetModel(); endResetModel(); @@ -329,7 +329,7 @@ void GradientModel::setAnchorBackend(const QVariant &anchorBackend) setupModel(); m_locked = true; - auto guard = qScopeGuard([&] { m_locked = false; }); + const QScopeGuard cleanup([&] { m_locked = false; }); emit anchorBackendChanged(); emit hasGradientChanged(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 5dff76453ac..b8f998e8fae 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -29,16 +29,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include enum { debug = false @@ -241,10 +242,10 @@ void PropertyEditorView::changeExpression(const QString &propertyName) if (noValidSelection()) return; - QScopeGuard unlock([&](){ m_locked = false; }); + const QScopeGuard cleanup([&] { m_locked = false; }); m_locked = true; - executeInTransaction("PropertyEditorView::changeExpression", [this, name](){ + executeInTransaction("PropertyEditorView::changeExpression", [this, name] { PropertyName underscoreName(name); underscoreName.replace('.', '_'); diff --git a/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp b/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp index b32e0e69262..258c8a0a68f 100644 --- a/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp +++ b/src/plugins/qmldesigner/components/richtexteditor/richtexteditor.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index 2b64138387f..ea9bed74890 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -331,7 +332,7 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -351,7 +352,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -369,7 +370,7 @@ void StatesEditorView::setStateAsDefault(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -389,7 +390,7 @@ void StatesEditorView::resetDefaultState() return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); try { if (acitveStatesGroupNode().hasProperty("state")) @@ -411,7 +412,7 @@ void StatesEditorView::setAnnotation(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -438,7 +439,7 @@ void StatesEditorView::removeAnnotation(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -580,7 +581,7 @@ void StatesEditorView::variantPropertiesChanged(const QList &pr return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); for (const VariantProperty &property : propertyList) { if (property.name() == "name" diff --git a/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.cpp index c263a510966..b35bd214778 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.cpp @@ -29,8 +29,10 @@ #include "stateseditorwidget.h" #include -#include #include +#include +#include + #include #include @@ -572,7 +574,7 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -592,7 +594,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -612,7 +614,7 @@ void StatesEditorView::setStateAsDefault(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -632,7 +634,7 @@ void StatesEditorView::resetDefaultState() return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); try { if (activeStatesGroupNode().hasProperty("state")) @@ -654,7 +656,7 @@ void StatesEditorView::setAnnotation(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -683,7 +685,7 @@ void StatesEditorView::removeAnnotation(int internalNodeId) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (hasModelNodeForInternalId(internalNodeId)) { QmlModelState state(modelNodeForInternalId(internalNodeId)); @@ -869,7 +871,7 @@ void StatesEditorView::variantPropertiesChanged(const QList &pr return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); for (const VariantProperty &property : propertyList) { if (property.name() == "name" @@ -948,7 +950,7 @@ void StatesEditorView::moveStates(int from, int to) return; m_block = true; - auto guard = qScopeGuard([&]() { m_block = false; }); + const QScopeGuard cleanup([&] { m_block = false; }); if (!activeStatesGroupNode().hasNodeListProperty("states")) return; diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index ac89c54acd6..43a43161985 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1022,7 +1022,7 @@ Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, co bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler) { QmlJS::ScopeChain::setSkipmakeComponentChain(true); - QScopeGuard unSkip([]() { QmlJS::ScopeChain::setSkipmakeComponentChain(false); }); + const QScopeGuard cleanup([] { QmlJS::ScopeChain::setSkipmakeComponentChain(false); }); qCInfo(rewriterBenchmark) << Q_FUNC_INFO; diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 59af192eaa2..61939f20954 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 203ecc36e20..45949fb8863 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -121,7 +121,7 @@ void BaseHoverHandler::process(TextEditorWidget *widget, int pos, ReportPriority void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, ReportPriority report) { - const auto cleanup = qScopeGuard([this, report] { report(priority()); }); + const QScopeGuard cleanup([this, report] { report(priority()); }); QString tooltip = editorWidget->extraSelectionTooltip(pos); if (!tooltip.isEmpty()) diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 0da6571da8f..0bdf34efaba 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -158,7 +158,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason, bool isUpdate) { // make sure to cleanup old proposals if we cannot find a new assistant - auto cleanup = qScopeGuard([this] { destroyContext(); }); + QScopeGuard cleanup([this] { destroyContext(); }); if (isWaitingForProposal()) cancelCurrentRequest(); diff --git a/src/plugins/texteditor/colorpreviewhoverhandler.cpp b/src/plugins/texteditor/colorpreviewhoverhandler.cpp index 1a66392c550..7e3134e8c27 100644 --- a/src/plugins/texteditor/colorpreviewhoverhandler.cpp +++ b/src/plugins/texteditor/colorpreviewhoverhandler.cpp @@ -335,7 +335,7 @@ static QColor colorFromFuncAndArgs(const QString &func, const QStringList &args) void ColorPreviewHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, ReportPriority report) { - const auto cleanup = qScopeGuard([this, report] { report(priority()); }); + const QScopeGuard cleanup([this, report] { report(priority()); }); if (editorWidget->extraSelectionTooltip(pos).isEmpty()) { const QTextBlock tb = editorWidget->document()->findBlock(pos); diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 2c8ff597015..0a0e1dff889 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -1435,7 +1435,7 @@ void TextEditorWidgetPrivate::print(QPrinter *printer) return; doc = doc->clone(doc); - const auto cleanup = qScopeGuard([doc] { delete doc; }); + const QScopeGuard cleanup([doc] { delete doc; }); QTextOption opt = doc->defaultTextOption(); opt.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); @@ -2555,7 +2555,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) { ICore::restartTrimmer(); - auto clearBlockSelectionGuard = qScopeGuard([&]() { d->clearBlockSelection(); }); + QScopeGuard cleanup([&] { d->clearBlockSelection(); }); if (!isModifier(e) && mouseHidingEnabled()) viewport()->setCursor(Qt::BlankCursor); @@ -2834,7 +2834,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) } if (blockSelectionOperation != QTextCursor::NoMove) { - clearBlockSelectionGuard.dismiss(); + cleanup.dismiss(); d->handleMoveBlockSelection(blockSelectionOperation); } else if (!d->cursorMoveKeyEvent(e)) { QTextCursor cursor = textCursor(); @@ -5284,7 +5284,7 @@ void TextEditorWidgetPrivate::paintTextMarks(QPainter &painter, const ExtraAreaP int yoffset = blockBoundingRect.top(); painter.save(); - const auto cleanup = qScopeGuard([&painter, size, yoffset, xoffset, overrideIcon] { + const QScopeGuard cleanup([&painter, size, yoffset, xoffset, overrideIcon] { if (!overrideIcon.isNull()) { const QRect r(xoffset, yoffset, size, size); overrideIcon.paint(&painter, r, Qt::AlignCenter); diff --git a/src/tools/processlauncher/processlauncher-main.cpp b/src/tools/processlauncher/processlauncher-main.cpp index 0629ec3c6d2..980839cd8a8 100644 --- a/src/tools/processlauncher/processlauncher-main.cpp +++ b/src/tools/processlauncher/processlauncher-main.cpp @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) return 1; } - auto cleanup = qScopeGuard([] { Utils::Singleton::deleteAll(); }); + const QScopeGuard cleanup([] { Utils::Singleton::deleteAll(); }); Utils::Internal::LauncherSocketHandler launcher(app.arguments().constLast()); QTimer::singleShot(0, &launcher, &Utils::Internal::LauncherSocketHandler::start); diff --git a/tests/auto/utils/process/processtestapp/main.cpp b/tests/auto/utils/process/processtestapp/main.cpp index 91952c2528e..34923c407aa 100644 --- a/tests/auto/utils/process/processtestapp/main.cpp +++ b/tests/auto/utils/process/processtestapp/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char **argv) #endif QCoreApplication app(argc, argv); - auto cleanup = qScopeGuard([] { Singleton::deleteAll(); }); + const QScopeGuard cleanup([] { Singleton::deleteAll(); }); TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/" + Core::Constants::IDE_CASED_ID + "-XXXXXX"); diff --git a/tests/auto/utils/process/processtestapp/processtestapp.cpp b/tests/auto/utils/process/processtestapp/processtestapp.cpp index 3905d0a22b5..6cf7510eb78 100644 --- a/tests/auto/utils/process/processtestapp/processtestapp.cpp +++ b/tests/auto/utils/process/processtestapp/processtestapp.cpp @@ -33,7 +33,7 @@ void ProcessTestApp::invokeSubProcess() { ProcessTestApp processTestApp; int returnValue = 1; - auto cleanup = qScopeGuard([&returnValue] { + const QScopeGuard cleanup([&returnValue] { QMetaObject::invokeMethod(qApp, [returnValue] { qApp->exit(returnValue); }, Qt::QueuedConnection); diff --git a/tests/unit/unittest/unittests-main.cpp b/tests/unit/unittest/unittests-main.cpp index af6f5db4fb2..e2b83c0941a 100644 --- a/tests/unit/unittest/unittests-main.cpp +++ b/tests/unit/unittest/unittests-main.cpp @@ -13,7 +13,6 @@ #include #include -#include #ifdef WITH_BENCHMARKS #include