From 7eb778dc3d49de19f696c4136cedce4edcc473ab Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 30 Sep 2022 10:24:53 +0200 Subject: [PATCH] Theme: Limit the usage of qMakePair Change-Id: Ibc47dfc4f48ab1b3bc2fe77b353d13d1e22d8b8f Reviewed-by: Eike Ziller --- src/libs/utils/theme/theme.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index 2896938aebc..b1ff5a438b5 100644 --- a/src/libs/utils/theme/theme.cpp +++ b/src/libs/utils/theme/theme.cpp @@ -133,17 +133,18 @@ QString Theme::imageFile(Theme::ImageFile imageFile, const QString &fallBack) co QPair Theme::readNamedColor(const QString &color) const { - if (d->palette.contains(color)) - return qMakePair(d->palette[color], color); + const auto it = d->palette.constFind(color); + if (it != d->palette.constEnd()) + return {it.value(), color}; if (color == QLatin1String("style")) - return qMakePair(QColor(), QString()); + return {}; const QColor col('#' + color); if (!col.isValid()) { qWarning("Color \"%s\" is neither a named color nor a valid color", qPrintable(color)); - return qMakePair(Qt::black, QString()); + return {Qt::black, {}}; } - return qMakePair(col, QString()); + return {col, {}}; } QString Theme::filePath() const