diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 54f183b8c1f..bccc4f374b0 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -592,8 +592,8 @@ public: return csz; } - bool hasStyleHint(const QString &sh) const { return styleHints.contains(sh); } - QVariant styleHint(const QString &sh) const { return styleHints.value(sh); } + bool hasStyleHint(QLatin1StringView sh) const { return styleHints.contains(sh); } + QVariant styleHint(QLatin1StringView sh) const { return styleHints.value(sh); } void fixupBorder(int); @@ -1027,14 +1027,13 @@ QRenderRule::QRenderRule(const QList &declarations, const QObject * bool knownStyleHint = false; for (const auto sh : knownStyleHints) { QLatin1StringView styleHint(sh); - if (decl.d->property.compare(styleHint) == 0) { - QString hintName = QString(styleHint); + if (decl.d->property == styleHint) { QVariant hintValue; - if (hintName.endsWith("alignment"_L1)) { + if (styleHint.endsWith("alignment"_L1)) { hintValue = (int) decl.alignmentValue(); - } else if (hintName.endsWith("color"_L1)) { + } else if (styleHint.endsWith("color"_L1)) { hintValue = (int) decl.colorValue().rgba(); - } else if (hintName.endsWith("size"_L1)) { + } else if (styleHint.endsWith("size"_L1)) { // Check only for the 'em' case const QString valueString = decl.d->values.at(0).variant.toString(); const bool isEmSize = valueString.endsWith(u"em", Qt::CaseInsensitive); @@ -1064,9 +1063,9 @@ QRenderRule::QRenderRule(const QList &declarations, const QObject * // Normal case where we receive a 'px' or 'pt' unit hintValue = decl.sizeValue(); } - } else if (hintName.endsWith("icon"_L1)) { + } else if (styleHint.endsWith("icon"_L1)) { hintValue = decl.iconValue(); - } else if (hintName == "button-layout"_L1 && decl.d->values.size() != 0 + } else if (styleHint == "button-layout"_L1 && decl.d->values.size() != 0 && decl.d->values.at(0).type == QCss::Value::String) { hintValue = subControlLayout(decl.d->values.at(0).variant.toString().toLatin1()); } else { @@ -5642,7 +5641,7 @@ QIcon QStyleSheetStyle::standardIcon(StandardPixmap standardIcon, const QStyleOp const QWidget *w) const { RECURSION_GUARD(return baseStyle()->standardIcon(standardIcon, opt, w)) - QString s = propertyNameForStandardPixmap(standardIcon); + const auto s = propertyNameForStandardPixmap(standardIcon); if (!s.isEmpty()) { QRenderRule rule = renderRule(w, opt); if (rule.hasStyleHint(s)) @@ -5660,7 +5659,7 @@ QPixmap QStyleSheetStyle::standardPixmap(StandardPixmap standardPixmap, const QS const QWidget *w) const { RECURSION_GUARD(return baseStyle()->standardPixmap(standardPixmap, opt, w)) - QString s = propertyNameForStandardPixmap(standardPixmap); + const auto s = propertyNameForStandardPixmap(standardPixmap); if (!s.isEmpty()) { QRenderRule rule = renderRule(w, opt); if (rule.hasStyleHint(s)) { @@ -5689,7 +5688,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi return baseStyle()->styleHint(sh, opt, w, shret); QRenderRule rule = renderRule(w, opt); - QString s; + QLatin1StringView s; switch (sh) { case SH_LineEdit_PasswordCharacter: s = "lineedit-password-character"_L1; break; case SH_LineEdit_PasswordMaskDelay: s = "lineedit-password-mask-delay"_L1; break;