forked from qt-creator/qt-creator
Theme: Limit the usage of qMakePair
Change-Id: Ibc47dfc4f48ab1b3bc2fe77b353d13d1e22d8b8f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -133,17 +133,18 @@ QString Theme::imageFile(Theme::ImageFile imageFile, const QString &fallBack) co
|
|||||||
|
|
||||||
QPair<QColor, QString> Theme::readNamedColor(const QString &color) const
|
QPair<QColor, QString> Theme::readNamedColor(const QString &color) const
|
||||||
{
|
{
|
||||||
if (d->palette.contains(color))
|
const auto it = d->palette.constFind(color);
|
||||||
return qMakePair(d->palette[color], color);
|
if (it != d->palette.constEnd())
|
||||||
|
return {it.value(), color};
|
||||||
if (color == QLatin1String("style"))
|
if (color == QLatin1String("style"))
|
||||||
return qMakePair(QColor(), QString());
|
return {};
|
||||||
|
|
||||||
const QColor col('#' + color);
|
const QColor col('#' + color);
|
||||||
if (!col.isValid()) {
|
if (!col.isValid()) {
|
||||||
qWarning("Color \"%s\" is neither a named color nor a valid color", qPrintable(color));
|
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
|
QString Theme::filePath() const
|
||||||
|
Reference in New Issue
Block a user