diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-10-04 17:20:03 +0200 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-10-07 11:00:43 +0200 |
commit | b57d78d32238fc7f7dcccb02be29aa3df3da531e (patch) | |
tree | 1fd34e7995dc8bfd299838bd6da140750192c36e /src/quickcontrols2 | |
parent | a392194a575653dff3cd21227e6a1a2902b8399f (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>
Diffstat (limited to 'src/quickcontrols2')
-rw-r--r-- | src/quickcontrols2/qquickattachedobject.cpp | 2 | ||||
-rw-r--r-- | src/quickcontrols2/qquickiconlabel.cpp | 2 | ||||
-rw-r--r-- | src/quickcontrols2/qquickiconlabel_p.h | 2 | ||||
-rw-r--r-- | src/quickcontrols2/qquickstyle.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
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; } } |