From 8d30fc9c3c36ac66bf3d027aaad7adff973f628f Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 18 Nov 2022 21:36:31 +0100 Subject: [PATCH] Fix various clazy warnings --- examples/dockindock/dockindock.cpp | 12 ++++++++---- examples/dockindock/perspectives.cpp | 4 +++- src/DockAreaWidget.cpp | 2 +- src/DockContainerWidget.cpp | 2 -- src/DockManager.cpp | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/examples/dockindock/dockindock.cpp b/examples/dockindock/dockindock.cpp index cf9bbeb8b..bacf42cbd 100644 --- a/examples/dockindock/dockindock.cpp +++ b/examples/dockindock/dockindock.cpp @@ -206,11 +206,15 @@ void DockInDockWidget::fillPerspectivesMenu( QMenu* menu ) if ( !perspectiveNames.isEmpty() ) { QMenu* load = menu->addMenu( "Load perspective" ); - for ( auto name : perspectiveNames ) - load->addAction( new LoadPerspectiveAction( load, name, *this ) ); + for (const auto& name : perspectiveNames) + { + load->addAction(new LoadPerspectiveAction( load, name, *this)); + } QMenu* remove = menu->addMenu( "Remove perspective" ); - for ( auto name : perspectiveNames ) - remove->addAction( new RemovePerspectiveAction( remove, name, *this ) ); + for (const auto& name : perspectiveNames) + { + remove->addAction( new RemovePerspectiveAction( remove, name, *this )); + } } } diff --git a/examples/dockindock/perspectives.cpp b/examples/dockindock/perspectives.cpp index 29002b3c6..e788c2233 100644 --- a/examples/dockindock/perspectives.cpp +++ b/examples/dockindock/perspectives.cpp @@ -219,8 +219,10 @@ void PerspectivesManager::loadPerspectives() // load group info: mainSettings->beginGroup(GROUP_PREFIX); - for ( auto key : mainSettings->allKeys() ) + for (const auto& key : mainSettings->allKeys()) + { m_perspectives[perspective].groups[key] = mainSettings->value( key ).toStringList(); + } mainSettings->endGroup(); } else diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index ab42bd250..6557ce72e 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -1010,7 +1010,7 @@ bool CDockAreaWidget::isCentralWidgetArea() const return false; } - return dockManager()->centralWidget() == dockWidgets()[0]; + return dockManager()->centralWidget() == dockWidgets().constFirst(); } diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 1d2539a75..979e5ef6e 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -568,7 +568,6 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin } else { - QList NewSplitterSizes; QSplitter* NewSplitter = newSplitter(InsertParam.orientation()); int TargetAreaSize = (InsertParam.orientation() == Qt::Horizontal) ? TargetArea->width() : TargetArea->height(); bool AdjustSplitterSizes = true; @@ -692,7 +691,6 @@ void DockContainerWidgetPrivate::moveToNewSection(QWidget* Widget, CDockAreaWidg } else { - auto Sizes = TargetAreaSplitter->sizes(); int TargetAreaSize = (InsertParam.orientation() == Qt::Horizontal) ? TargetArea->width() : TargetArea->height(); QSplitter* NewSplitter = newSplitter(InsertParam.orientation()); NewSplitter->addWidget(TargetArea); diff --git a/src/DockManager.cpp b/src/DockManager.cpp index ea98221f9..8ef5de56f 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -928,7 +928,7 @@ void CDockManager::removePerspective(const QString& Name) void CDockManager::removePerspectives(const QStringList& Names) { int Count = 0; - for (auto Name : Names) + for (const auto& Name : Names) { Count += d->Perspectives.remove(Name); }