From 92a290895be19b72b543ffaf7bd29001cffb36bc Mon Sep 17 00:00:00 2001 From: thalieht Date: Thu, 14 Feb 2019 14:29:57 +0200 Subject: [PATCH] Convert vars into refs to avoid copy construction from const refs --- src/gui/transferlistmodel.cpp | 2 +- src/webui/api/appcontroller.cpp | 2 +- src/webui/api/synccontroller.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/transferlistmodel.cpp b/src/gui/transferlistmodel.cpp index dd1f549ce..07e4f2963 100644 --- a/src/gui/transferlistmodel.cpp +++ b/src/gui/transferlistmodel.cpp @@ -468,6 +468,6 @@ bool isDarkTheme() { const QPalette pal = QApplication::palette(); // QPalette::Base is used for the background of the Treeview - const QColor color = pal.color(QPalette::Active, QPalette::Base); + const QColor &color = pal.color(QPalette::Active, QPalette::Base); return (color.lightness() < 127); } diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 38fec32ad..1b5990aac 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -329,7 +329,7 @@ void AppController::setPreferencesAction() // Update deleted folders for (auto i = oldScanDirs.cbegin(); i != oldScanDirs.cend(); ++i) { - const QString folder = i.key(); + const QString &folder = i.key(); if (!scanDirs.contains(folder)) { model->removePath(folder); qDebug("Removed watched folder %s", qUtf8Printable(folder)); diff --git a/src/webui/api/synccontroller.cpp b/src/webui/api/synccontroller.cpp index 2fe27bbae..406cde859 100644 --- a/src/webui/api/synccontroller.cpp +++ b/src/webui/api/synccontroller.cpp @@ -434,9 +434,9 @@ void SyncController::maindataAction() data["torrents"] = torrents; QVariantHash categories; - const auto categoriesList = session->categories(); + const auto &categoriesList = session->categories(); for (auto it = categoriesList.cbegin(); it != categoriesList.cend(); ++it) { - const auto key = it.key(); + const auto &key = it.key(); categories[key] = QVariantMap { {"name", key}, {"savePath", it.value()}