QScopeGuard: Make all usages of QScopeGuard consistent

Change-Id: Icfc35ecbdbdee8dadbb1b17789694093427c3ed9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2023-06-07 09:39:30 +02:00
parent aefd4d759e
commit abb85b073a
27 changed files with 57 additions and 59 deletions

View File

@@ -586,7 +586,7 @@ int main(int argc, char **argv)
QCoreApplication::setOrganizationName(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR)); QCoreApplication::setOrganizationName(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR));
QGuiApplication::setApplicationDisplayName(Core::Constants::IDE_DISPLAY_NAME); QGuiApplication::setApplicationDisplayName(Core::Constants::IDE_DISPLAY_NAME);
auto cleanup = qScopeGuard([] { Utils::Singleton::deleteAll(); }); const QScopeGuard cleanup([] { Utils::Singleton::deleteAll(); });
const QStringList pluginArguments = app.arguments(); const QStringList pluginArguments = app.arguments();

View File

@@ -8,7 +8,6 @@
#include "qtcassert.h" #include "qtcassert.h"
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QScopeGuard>
Q_LOGGING_CATEGORY(deviceShellLog, "qtc.utils.deviceshell", QtWarningMsg) Q_LOGGING_CATEGORY(deviceShellLog, "qtc.utils.deviceshell", QtWarningMsg)

View File

@@ -66,7 +66,7 @@ public:
return std::invoke(std::forward<Function>(function), std::forward<Args>(args)...); return std::invoke(std::forward<Function>(function), std::forward<Args>(args)...);
QElapsedTimer timer; QElapsedTimer timer;
timer.start(); timer.start();
auto cleanup = qScopeGuard([this, &timer] { const QScopeGuard cleanup([this, &timer] {
const qint64 currentNsecs = timer.nsecsElapsed(); const qint64 currentNsecs = timer.nsecsElapsed();
const bool mainThread = isMainThread(); const bool mainThread = isMainThread();
const int hitThisAll = m_hitThisAll.fetch_add(1) + 1; const int hitThisAll = m_hitThisAll.fetch_add(1) + 1;

View File

@@ -341,7 +341,7 @@ bool AndroidRunnerWorker::uploadDebugServer(const QString &debugServerFileName)
} }
const QString tempDebugServerPath = tempDebugServerPathTemplate.arg(count); const QString tempDebugServerPath = tempDebugServerPathTemplate.arg(count);
auto cleanUp = qScopeGuard([this, tempDebugServerPath] { const QScopeGuard cleanup([this, tempDebugServerPath] {
if (!runAdb({"shell", "rm", "-f", tempDebugServerPath})) if (!runAdb({"shell", "rm", "-f", tempDebugServerPath}))
qCDebug(androidRunWorkerLog) << "Debug server cleanup failed."; qCDebug(androidRunWorkerLog) << "Debug server cleanup failed.";
}); });

View File

@@ -158,7 +158,7 @@ void DocumentClangToolRunner::run()
if (m_projectSettingsUpdate) if (m_projectSettingsUpdate)
disconnect(m_projectSettingsUpdate); disconnect(m_projectSettingsUpdate);
m_taskTree.reset(); m_taskTree.reset();
QScopeGuard guard([this] { finalize(); }); QScopeGuard cleanup([this] { finalize(); });
auto isEditorForCurrentDocument = [this](const IEditor *editor) { auto isEditorForCurrentDocument = [this](const IEditor *editor) {
return editor->document() == m_document; return editor->document() == m_document;
@@ -216,7 +216,7 @@ void DocumentClangToolRunner::run()
if (tasks.isEmpty()) if (tasks.isEmpty())
return; return;
guard.dismiss(); cleanup.dismiss();
m_taskTree.reset(new TaskTree(tasks)); m_taskTree.reset(new TaskTree(tasks));
connect(m_taskTree.get(), &TaskTree::done, this, &DocumentClangToolRunner::finalize); connect(m_taskTree.get(), &TaskTree::done, this, &DocumentClangToolRunner::finalize);
connect(m_taskTree.get(), &TaskTree::errorOccurred, this, &DocumentClangToolRunner::finalize); connect(m_taskTree.get(), &TaskTree::errorOccurred, this, &DocumentClangToolRunner::finalize);

View File

@@ -15,6 +15,7 @@
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <QPushButton> #include <QPushButton>
#include <QScopeGuard>
#include <QToolBar> #include <QToolBar>
#include <QToolButton> #include <QToolButton>
@@ -117,7 +118,7 @@ void CopilotHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
int pos, int pos,
ReportPriority report) ReportPriority report)
{ {
auto reportNone = qScopeGuard([&] { report(Priority_None); }); QScopeGuard cleanup([&] { report(Priority_None); });
if (!editorWidget->suggestionVisible()) if (!editorWidget->suggestionVisible())
return; return;
@@ -133,7 +134,7 @@ void CopilotHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
if (completions.isEmpty()) if (completions.isEmpty())
return; return;
reportNone.dismiss(); cleanup.dismiss();
report(Priority_Suggestion); report(Priority_Suggestion);
} }

View File

@@ -3325,7 +3325,7 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
EditorManager::gotoOtherSplit(); EditorManager::gotoOtherSplit();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
const auto cleanup = qScopeGuard(&QApplication::restoreOverrideCursor); const QScopeGuard cleanup(&QApplication::restoreOverrideCursor);
const QString title = makeTitleUnique(titlePattern); const QString title = makeTitleUnique(titlePattern);

View File

@@ -15,7 +15,6 @@
#include <QJSEngine> #include <QJSEngine>
#include <QPair> #include <QPair>
#include <QPointer> #include <QPointer>
#include <QScopeGuard>
#include <chrono> #include <chrono>

View File

@@ -591,7 +591,7 @@ void LoggingViewManagerWidget::saveLoggingsToFile() const
{ {
// should we just let it continue without temporarily disabling? // should we just let it continue without temporarily disabling?
const bool enabled = m_manager->isEnabled(); 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) if (enabled)
m_manager->setEnabled(false); m_manager->setEnabled(false);
const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(), const Utils::FilePath fp = Utils::FileUtils::getSaveFilePath(ICore::dialogParent(),

View File

@@ -3,8 +3,6 @@
#include "clientrequesttask.h" #include "clientrequesttask.h"
#include <QScopeGuard>
using namespace LanguageServerProtocol; using namespace LanguageServerProtocol;
namespace LanguageClient { namespace LanguageClient {

View File

@@ -635,7 +635,7 @@ public:
const auto selection = selectionContext(); const auto selection = selectionContext();
bool showMenu = false; bool showMenu = false;
auto cleanup = qScopeGuard([&]{ menu()->setEnabled(showMenu); }); const QScopeGuard cleanup([&]{ menu()->setEnabled(showMenu); });
if (!selection.isValid()) if (!selection.isValid())
return; return;

View File

@@ -330,7 +330,7 @@ void DynamicPropertyRow::commitValue(const QVariant &value)
return; return;
m_lock = true; m_lock = true;
auto unlock = qScopeGuard([this] { m_lock = false; }); const QScopeGuard cleanup([this] { m_lock = false; });
auto view = propertiesModel->view(); auto view = propertiesModel->view();
RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__); RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__);
@@ -371,7 +371,7 @@ void DynamicPropertyRow::commitExpression(const QString &expression)
} }
m_lock = true; m_lock = true;
auto unlock = qScopeGuard([this] { m_lock = false; }); const QScopeGuard cleanup([this] { m_lock = false; });
auto view = propertiesModel->view(); auto view = propertiesModel->view();
RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__); RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__);
@@ -426,7 +426,7 @@ void DynamicPropertyRow::resetValue()
} }
} else { } else {
m_lock = true; m_lock = true;
auto unlock = qScopeGuard([this] { m_lock = false; }); const QScopeGuard cleanup([this] { m_lock = false; });
RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__); RewriterTransaction transaction = view->beginRewriterTransaction(__FUNCTION__);
try { try {

View File

@@ -306,7 +306,7 @@ QString GradientModel::readGradientOrientation() const
void GradientModel::setupModel() void GradientModel::setupModel()
{ {
m_locked = true; m_locked = true;
auto guard = qScopeGuard([&] { m_locked = false; }); const QScopeGuard cleanup([&] { m_locked = false; });
beginResetModel(); beginResetModel();
endResetModel(); endResetModel();
@@ -329,7 +329,7 @@ void GradientModel::setAnchorBackend(const QVariant &anchorBackend)
setupModel(); setupModel();
m_locked = true; m_locked = true;
auto guard = qScopeGuard([&] { m_locked = false; }); const QScopeGuard cleanup([&] { m_locked = false; });
emit anchorBackendChanged(); emit anchorBackendChanged();
emit hasGradientChanged(); emit hasGradientChanged();

View File

@@ -29,16 +29,17 @@
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QDir>
#include <QFileSystemWatcher>
#include <QFileInfo>
#include <QDebug>
#include <QQuickItem>
#include <QTimer>
#include <QShortcut>
#include <QApplication> #include <QApplication>
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QFileSystemWatcher>
#include <QQuickItem>
#include <QScopeGuard>
#include <QScopedPointer> #include <QScopedPointer>
#include <QShortcut>
#include <QTimer>
enum { enum {
debug = false debug = false
@@ -241,10 +242,10 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
if (noValidSelection()) if (noValidSelection())
return; return;
QScopeGuard unlock([&](){ m_locked = false; }); const QScopeGuard cleanup([&] { m_locked = false; });
m_locked = true; m_locked = true;
executeInTransaction("PropertyEditorView::changeExpression", [this, name](){ executeInTransaction("PropertyEditorView::changeExpression", [this, name] {
PropertyName underscoreName(name); PropertyName underscoreName(name);
underscoreName.replace('.', '_'); underscoreName.replace('.', '_');

View File

@@ -13,7 +13,6 @@
#include <QFileDialog> #include <QFileDialog>
#include <QPainter> #include <QPainter>
#include <QPointer> #include <QPointer>
#include <QScopeGuard>
#include <QStyle> #include <QStyle>
#include <QStyleFactory> #include <QStyleFactory>
#include <QTextTable> #include <QTextTable>

View File

@@ -23,6 +23,7 @@
#include <QDebug> #include <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include <QRegularExpression> #include <QRegularExpression>
#include <QScopeGuard>
#include <cmath> #include <cmath>
#include <memory> #include <memory>
@@ -331,7 +332,7 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -351,7 +352,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -369,7 +370,7 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -389,7 +390,7 @@ void StatesEditorView::resetDefaultState()
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
try { try {
if (acitveStatesGroupNode().hasProperty("state")) if (acitveStatesGroupNode().hasProperty("state"))
@@ -411,7 +412,7 @@ void StatesEditorView::setAnnotation(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -438,7 +439,7 @@ void StatesEditorView::removeAnnotation(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -580,7 +581,7 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
for (const VariantProperty &property : propertyList) { for (const VariantProperty &property : propertyList) {
if (property.name() == "name" if (property.name() == "name"

View File

@@ -29,8 +29,10 @@
#include "stateseditorwidget.h" #include "stateseditorwidget.h"
#include <QDebug> #include <QDebug>
#include <QRegularExpression>
#include <QMessageBox> #include <QMessageBox>
#include <QRegularExpression>
#include <QScopeGuard>
#include <cmath> #include <cmath>
#include <memory> #include <memory>
@@ -572,7 +574,7 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -592,7 +594,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -612,7 +614,7 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -632,7 +634,7 @@ void StatesEditorView::resetDefaultState()
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
try { try {
if (activeStatesGroupNode().hasProperty("state")) if (activeStatesGroupNode().hasProperty("state"))
@@ -654,7 +656,7 @@ void StatesEditorView::setAnnotation(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -683,7 +685,7 @@ void StatesEditorView::removeAnnotation(int internalNodeId)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (hasModelNodeForInternalId(internalNodeId)) { if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId)); QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -869,7 +871,7 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
for (const VariantProperty &property : propertyList) { for (const VariantProperty &property : propertyList) {
if (property.name() == "name" if (property.name() == "name"
@@ -948,7 +950,7 @@ void StatesEditorView::moveStates(int from, int to)
return; return;
m_block = true; m_block = true;
auto guard = qScopeGuard([&]() { m_block = false; }); const QScopeGuard cleanup([&] { m_block = false; });
if (!activeStatesGroupNode().hasNodeListProperty("states")) if (!activeStatesGroupNode().hasNodeListProperty("states"))
return; return;

View File

@@ -1022,7 +1022,7 @@ Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, co
bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler) bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler)
{ {
QmlJS::ScopeChain::setSkipmakeComponentChain(true); QmlJS::ScopeChain::setSkipmakeComponentChain(true);
QScopeGuard unSkip([]() { QmlJS::ScopeChain::setSkipmakeComponentChain(false); }); const QScopeGuard cleanup([] { QmlJS::ScopeChain::setSkipmakeComponentChain(false); });
qCInfo(rewriterBenchmark) << Q_FUNC_INFO; qCInfo(rewriterBenchmark) << Q_FUNC_INFO;

View File

@@ -40,7 +40,6 @@
#include <QMutex> #include <QMutex>
#include <QReadWriteLock> #include <QReadWriteLock>
#include <QRegularExpression> #include <QRegularExpression>
#include <QScopeGuard>
#include <QTemporaryDir> #include <QTemporaryDir>
#include <QThread> #include <QThread>
#include <QTimer> #include <QTimer>

View File

@@ -121,7 +121,7 @@ void BaseHoverHandler::process(TextEditorWidget *widget, int pos, ReportPriority
void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, ReportPriority report) 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); QString tooltip = editorWidget->extraSelectionTooltip(pos);
if (!tooltip.isEmpty()) if (!tooltip.isEmpty())

View File

@@ -158,7 +158,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
bool isUpdate) bool isUpdate)
{ {
// make sure to cleanup old proposals if we cannot find a new assistant // make sure to cleanup old proposals if we cannot find a new assistant
auto cleanup = qScopeGuard([this] { destroyContext(); }); QScopeGuard cleanup([this] { destroyContext(); });
if (isWaitingForProposal()) if (isWaitingForProposal())
cancelCurrentRequest(); cancelCurrentRequest();

View File

@@ -335,7 +335,7 @@ static QColor colorFromFuncAndArgs(const QString &func, const QStringList &args)
void ColorPreviewHoverHandler::identifyMatch(TextEditorWidget *editorWidget, void ColorPreviewHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
int pos, ReportPriority report) int pos, ReportPriority report)
{ {
const auto cleanup = qScopeGuard([this, report] { report(priority()); }); const QScopeGuard cleanup([this, report] { report(priority()); });
if (editorWidget->extraSelectionTooltip(pos).isEmpty()) { if (editorWidget->extraSelectionTooltip(pos).isEmpty()) {
const QTextBlock tb = editorWidget->document()->findBlock(pos); const QTextBlock tb = editorWidget->document()->findBlock(pos);

View File

@@ -1435,7 +1435,7 @@ void TextEditorWidgetPrivate::print(QPrinter *printer)
return; return;
doc = doc->clone(doc); doc = doc->clone(doc);
const auto cleanup = qScopeGuard([doc] { delete doc; }); const QScopeGuard cleanup([doc] { delete doc; });
QTextOption opt = doc->defaultTextOption(); QTextOption opt = doc->defaultTextOption();
opt.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); opt.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
@@ -2555,7 +2555,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
{ {
ICore::restartTrimmer(); ICore::restartTrimmer();
auto clearBlockSelectionGuard = qScopeGuard([&]() { d->clearBlockSelection(); }); QScopeGuard cleanup([&] { d->clearBlockSelection(); });
if (!isModifier(e) && mouseHidingEnabled()) if (!isModifier(e) && mouseHidingEnabled())
viewport()->setCursor(Qt::BlankCursor); viewport()->setCursor(Qt::BlankCursor);
@@ -2834,7 +2834,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
} }
if (blockSelectionOperation != QTextCursor::NoMove) { if (blockSelectionOperation != QTextCursor::NoMove) {
clearBlockSelectionGuard.dismiss(); cleanup.dismiss();
d->handleMoveBlockSelection(blockSelectionOperation); d->handleMoveBlockSelection(blockSelectionOperation);
} else if (!d->cursorMoveKeyEvent(e)) { } else if (!d->cursorMoveKeyEvent(e)) {
QTextCursor cursor = textCursor(); QTextCursor cursor = textCursor();
@@ -5284,7 +5284,7 @@ void TextEditorWidgetPrivate::paintTextMarks(QPainter &painter, const ExtraAreaP
int yoffset = blockBoundingRect.top(); int yoffset = blockBoundingRect.top();
painter.save(); painter.save();
const auto cleanup = qScopeGuard([&painter, size, yoffset, xoffset, overrideIcon] { const QScopeGuard cleanup([&painter, size, yoffset, xoffset, overrideIcon] {
if (!overrideIcon.isNull()) { if (!overrideIcon.isNull()) {
const QRect r(xoffset, yoffset, size, size); const QRect r(xoffset, yoffset, size, size);
overrideIcon.paint(&painter, r, Qt::AlignCenter); overrideIcon.paint(&painter, r, Qt::AlignCenter);

View File

@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
auto cleanup = qScopeGuard([] { Utils::Singleton::deleteAll(); }); const QScopeGuard cleanup([] { Utils::Singleton::deleteAll(); });
Utils::Internal::LauncherSocketHandler launcher(app.arguments().constLast()); Utils::Internal::LauncherSocketHandler launcher(app.arguments().constLast());
QTimer::singleShot(0, &launcher, &Utils::Internal::LauncherSocketHandler::start); QTimer::singleShot(0, &launcher, &Utils::Internal::LauncherSocketHandler::start);

View File

@@ -28,7 +28,7 @@ int main(int argc, char **argv)
#endif #endif
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
auto cleanup = qScopeGuard([] { Singleton::deleteAll(); }); const QScopeGuard cleanup([] { Singleton::deleteAll(); });
TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/" TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/"
+ Core::Constants::IDE_CASED_ID + "-XXXXXX"); + Core::Constants::IDE_CASED_ID + "-XXXXXX");

View File

@@ -33,7 +33,7 @@ void ProcessTestApp::invokeSubProcess()
{ {
ProcessTestApp processTestApp; ProcessTestApp processTestApp;
int returnValue = 1; int returnValue = 1;
auto cleanup = qScopeGuard([&returnValue] { const QScopeGuard cleanup([&returnValue] {
QMetaObject::invokeMethod(qApp, [returnValue] { QMetaObject::invokeMethod(qApp, [returnValue] {
qApp->exit(returnValue); qApp->exit(returnValue);
}, Qt::QueuedConnection); }, Qt::QueuedConnection);

View File

@@ -13,7 +13,6 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QScopeGuard>
#ifdef WITH_BENCHMARKS #ifdef WITH_BENCHMARKS
#include <benchmark/benchmark.h> #include <benchmark/benchmark.h>