Widgets: Improve usage of string view types
Use string views in QFontDialog, QColorDialog and QCommonStyle Change-Id: I22f4b4694e2d18b784aaa85aebff8d92b8f0b871 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>bb10
parent
61556627f2
commit
4565f97a5c
|
|
@ -1398,8 +1398,8 @@ void QColorShower::htmlEd()
|
|||
if (t.isEmpty())
|
||||
return;
|
||||
|
||||
if (!t.startsWith(QStringLiteral("#"))) {
|
||||
t = QStringLiteral("#") + t;
|
||||
if (!t.startsWith(u"#")) {
|
||||
t.prepend(u"#");
|
||||
QSignalBlocker blocker(htEd);
|
||||
htEd->setText(t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ void QFontDialogPrivate::updateFamilies()
|
|||
|
||||
//and try some fall backs
|
||||
match_t type = MATCH_NONE;
|
||||
if (bestFamilyType <= MATCH_NONE && familyName2 == QStringLiteral("helvetica"))
|
||||
if (bestFamilyType <= MATCH_NONE && familyName2 == "helvetica"_L1)
|
||||
type = MATCH_LAST_RESORT;
|
||||
if (bestFamilyType <= MATCH_LAST_RESORT && familyName2 == f.families().constFirst())
|
||||
type = MATCH_APP;
|
||||
|
|
|
|||
|
|
@ -5501,8 +5501,8 @@ static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFro
|
|||
#endif // QT_CONFIG(imageformat_xpm)
|
||||
|
||||
#if QT_CONFIG(imageformat_png)
|
||||
static inline QString iconResourcePrefix() { return QStringLiteral(":/qt-project.org/styles/commonstyle/images/"); }
|
||||
static inline QString iconPngSuffix() { return QStringLiteral(".png"); }
|
||||
static constexpr QLatin1StringView iconResourcePrefix() noexcept { return ":/qt-project.org/styles/commonstyle/images/"_L1; }
|
||||
static constexpr QLatin1StringView iconPngSuffix() noexcept { return ".png"_L1; }
|
||||
|
||||
template <typename T>
|
||||
static void addIconFiles(QStringView prefix, std::initializer_list<T> sizes, QIcon &icon,
|
||||
|
|
@ -5817,14 +5817,15 @@ QIcon QCommonStylePrivate::iconFromMacTheme(QCommonStyle::StandardPixmap standar
|
|||
case QStyle::SP_TitleBarNormalButton:
|
||||
case QStyle::SP_TitleBarCloseButton: {
|
||||
QIcon titleBarIcon;
|
||||
QString prefix = standardIcon == QStyle::SP_TitleBarCloseButton
|
||||
? QStringLiteral(":/qt-project.org/styles/macstyle/images/closedock-")
|
||||
: QStringLiteral(":/qt-project.org/styles/macstyle/images/dockdock-");
|
||||
constexpr auto imagesPrefix = ":/qt-project.org/styles/macstyle/images/"_L1;
|
||||
const auto namePrefix = standardIcon == QStyle::SP_TitleBarCloseButton
|
||||
? "closedock-"_L1
|
||||
: "dockdock-"_L1;
|
||||
for (const auto size : dockTitleIconSizes) {
|
||||
titleBarIcon.addFile(prefix + QStringLiteral("macstyle-") + QString::number(size) + iconPngSuffix(),
|
||||
QSize(size, size), QIcon::Normal, QIcon::Off);
|
||||
titleBarIcon.addFile(prefix + QStringLiteral("down-macstyle-") + QString::number(size) + iconPngSuffix(),
|
||||
QSize(size, size), QIcon::Normal, QIcon::On);
|
||||
titleBarIcon.addFile(imagesPrefix + namePrefix + "macstyle-"_L1 + QString::number(size)
|
||||
+ iconPngSuffix(), QSize(size, size), QIcon::Normal, QIcon::Off);
|
||||
titleBarIcon.addFile(imagesPrefix + namePrefix + "down-macstyle-"_L1 + QString::number(size)
|
||||
+ iconPngSuffix(), QSize(size, size), QIcon::Normal, QIcon::On);
|
||||
}
|
||||
return titleBarIcon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
|||
if (isDefault)
|
||||
buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90);
|
||||
|
||||
BEGIN_STYLE_PIXMAPCACHE(QStringLiteral("pushbutton-") + buttonColor.name(QColor::HexArgb))
|
||||
BEGIN_STYLE_PIXMAPCACHE(u"pushbutton-" + buttonColor.name(QColor::HexArgb))
|
||||
r = rect.adjusted(0, 1, -1, 0);
|
||||
|
||||
p->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue