summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals.cid@kdab.com>2019-10-04 17:20:03 +0200
committerAlbert Astals Cid <albert.astals.cid@kdab.com>2019-10-07 11:00:43 +0200
commitb57d78d32238fc7f7dcccb02be29aa3df3da531e (patch)
tree1fd34e7995dc8bfd299838bd6da140750192c36e
parenta392194a575653dff3cd21227e6a1a2902b8399f (diff)
Minor performance improvements suggested by clang-tidy
* Add const & to function parameters * Add const & to variables assigned from functions that return const & Change-Id: Ibf35e54ffb78f164493222125411f2ba279cb861 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator.cpp2
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator_p.h2
-rw-r--r--src/quickcontrols2/qquickattachedobject.cpp2
-rw-r--r--src/quickcontrols2/qquickiconlabel.cpp2
-rw-r--r--src/quickcontrols2/qquickiconlabel_p.h2
-rw-r--r--src/quickcontrols2/qquickstyle.cpp2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator.cpp b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
index c18a4005..58c1fd8c 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator.cpp
+++ b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
@@ -184,7 +184,7 @@ QColor QQuickMaterialBusyIndicator::color() const
return m_color;
}
-void QQuickMaterialBusyIndicator::setColor(QColor color)
+void QQuickMaterialBusyIndicator::setColor(const QColor &color)
{
if (m_color == color)
return;
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator_p.h b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
index d29427c1..ad7bc002 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator_p.h
+++ b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
@@ -63,7 +63,7 @@ public:
explicit QQuickMaterialBusyIndicator(QQuickItem *parent = nullptr);
QColor color() const;
- void setColor(QColor color);
+ void setColor(const QColor &color);
bool isRunning() const;
void setRunning(bool running);
diff --git a/src/quickcontrols2/qquickattachedobject.cpp b/src/quickcontrols2/qquickattachedobject.cpp
index c43f7dc5..722f22f9 100644
--- a/src/quickcontrols2/qquickattachedobject.cpp
+++ b/src/quickcontrols2/qquickattachedobject.cpp
@@ -119,7 +119,7 @@ static QList<QQuickAttachedObject *> findAttachedChildren(const QMetaObject *typ
if (window) {
item = window->contentItem();
- const auto windowChildren = window->children();
+ const auto &windowChildren = window->children();
for (QObject *child : windowChildren) {
QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child);
if (childWindow) {
diff --git a/src/quickcontrols2/qquickiconlabel.cpp b/src/quickcontrols2/qquickiconlabel.cpp
index b246621b..536b3c1b 100644
--- a/src/quickcontrols2/qquickiconlabel.cpp
+++ b/src/quickcontrols2/qquickiconlabel.cpp
@@ -408,7 +408,7 @@ QString QQuickIconLabel::text() const
return d->text;
}
-void QQuickIconLabel::setText(const QString text)
+void QQuickIconLabel::setText(const QString &text)
{
Q_D(QQuickIconLabel);
if (d->text == text)
diff --git a/src/quickcontrols2/qquickiconlabel_p.h b/src/quickcontrols2/qquickiconlabel_p.h
index df79dbf2..75b77064 100644
--- a/src/quickcontrols2/qquickiconlabel_p.h
+++ b/src/quickcontrols2/qquickiconlabel_p.h
@@ -88,7 +88,7 @@ public:
void setIcon(const QQuickIcon &icon);
QString text() const;
- void setText(const QString text);
+ void setText(const QString &text);
QFont font() const;
void setFont(const QFont &font);
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index e2b6678b..408a0de3 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -495,7 +495,7 @@ static bool qt_is_dark_system_theme()
{
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
if (const QPalette *systemPalette = theme->palette(QPlatformTheme::SystemPalette)) {
- const QColor textColor = systemPalette->color(QPalette::WindowText);
+ const QColor &textColor = systemPalette->color(QPalette::WindowText);
return textColor.red() > 128 && textColor.blue() > 128 && textColor.green() > 128;
}
}