QtWidgets: replace remaining uses of QL1String with QL1StringView
Task-number: QTBUG-98434 Change-Id: If20e217e6e4fecd18c7707bf94650f5ba856893f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>bb10
parent
7d79b94db7
commit
c48795c515
|
|
@ -287,7 +287,7 @@ void QAccessibleWidget::addControllingSignal(const QString &signal)
|
|||
QByteArray s = QMetaObject::normalizedSignature(signal.toLatin1());
|
||||
if (Q_UNLIKELY(object()->metaObject()->indexOfSignal(s) < 0))
|
||||
qWarning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className());
|
||||
d->primarySignals << QLatin1String(s);
|
||||
d->primarySignals << QLatin1StringView(s);
|
||||
}
|
||||
|
||||
static inline bool isAncestor(const QObject *obj, const QObject *child)
|
||||
|
|
|
|||
|
|
@ -763,7 +763,7 @@ class AttributeFormatterRef {
|
|||
public:
|
||||
template <typename RHS>
|
||||
void operator=(RHS &&rhs)
|
||||
{ string += QLatin1String(key) + u':' + std::forward<RHS>(rhs) + u';'; }
|
||||
{ string += QLatin1StringView(key) + u':' + std::forward<RHS>(rhs) + u';'; }
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1906,8 +1906,8 @@ bool QColorDialogPrivate::canBeNativeDialog() const
|
|||
return false;
|
||||
}
|
||||
|
||||
QLatin1String staticName(QColorDialog::staticMetaObject.className());
|
||||
QLatin1String dynamicName(q->metaObject()->className());
|
||||
QLatin1StringView staticName(QColorDialog::staticMetaObject.className());
|
||||
QLatin1StringView dynamicName(q->metaObject()->className());
|
||||
return (staticName == dynamicName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -724,8 +724,8 @@ bool QFileDialogPrivate::canBeNativeDialog() const
|
|||
return false;
|
||||
}
|
||||
|
||||
QLatin1String staticName(QFileDialog::staticMetaObject.className());
|
||||
QLatin1String dynamicName(q->metaObject()->className());
|
||||
QLatin1StringView staticName(QFileDialog::staticMetaObject.className());
|
||||
QLatin1StringView dynamicName(q->metaObject()->className());
|
||||
return (staticName == dynamicName);
|
||||
}
|
||||
|
||||
|
|
@ -2839,7 +2839,7 @@ void QFileDialogPrivate::saveSettings()
|
|||
settings.setValue("history"_L1, historyUrls);
|
||||
settings.setValue("lastVisited"_L1, lastVisitedDir()->toString());
|
||||
const QMetaEnum &viewModeMeta = q->metaObject()->enumerator(q->metaObject()->indexOfEnumerator("ViewMode"));
|
||||
settings.setValue("viewMode"_L1, QLatin1String(viewModeMeta.key(q->viewMode())));
|
||||
settings.setValue("viewMode"_L1, QLatin1StringView(viewModeMeta.key(q->viewMode())));
|
||||
settings.setValue("qtVersion"_L1, QT_VERSION_STR ""_L1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1045,8 +1045,8 @@ bool QFontDialogPrivate::canBeNativeDialog() const
|
|||
return false;
|
||||
}
|
||||
|
||||
QLatin1String staticName(QFontDialog::staticMetaObject.className());
|
||||
QLatin1String dynamicName(q->metaObject()->className());
|
||||
QLatin1StringView staticName(QFontDialog::staticMetaObject.className());
|
||||
QLatin1StringView dynamicName(q->metaObject()->className());
|
||||
return (staticName == dynamicName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -734,9 +734,11 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
|||
QRect r = opt->rect;
|
||||
int size = qMin(r.height(), r.width());
|
||||
QPixmap pixmap;
|
||||
QString pixmapName = QStyleHelper::uniqueName("$qt_ia-"_L1
|
||||
% QLatin1String(metaObject()->className()), opt, QSize(size, size))
|
||||
% HexString<uint>(pe);
|
||||
QString pixmapName =
|
||||
QStyleHelper::uniqueName("$qt_ia-"_L1
|
||||
% QLatin1StringView(metaObject()->className()),
|
||||
opt, QSize(size, size))
|
||||
% HexString<uint>(pe);
|
||||
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
||||
qreal pixelRatio = p->device()->devicePixelRatio();
|
||||
int border = qRound(pixelRatio*(size/5));
|
||||
|
|
|
|||
|
|
@ -1207,7 +1207,7 @@ QPixmap QPixmapStylePrivate::getCachedPixmap(QPixmapStyle::ControlDescriptor con
|
|||
|
||||
const QString sizeString = QString::number(size.width()) % u'*'
|
||||
% QString::number(size.height());
|
||||
const QString key = QLatin1String(q->metaObject()->className()) % QString::number(control)
|
||||
const QString key = QLatin1StringView(q->metaObject()->className()) % QString::number(control)
|
||||
% u'@' % sizeString;
|
||||
|
||||
QPixmap result;
|
||||
|
|
|
|||
|
|
@ -1051,7 +1051,7 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
|
|||
} else if (decl.d->propertyId == UnknownProperty) {
|
||||
bool knownStyleHint = false;
|
||||
for (int i = 0; i < numKnownStyleHints; i++) {
|
||||
QLatin1String styleHint(knownStyleHints[i]);
|
||||
QLatin1StringView styleHint(knownStyleHints[i]);
|
||||
if (decl.d->property.compare(styleHint) == 0) {
|
||||
QString hintName = QString(styleHint);
|
||||
QVariant hintValue;
|
||||
|
|
@ -1893,7 +1893,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, int element, quint6
|
|||
}
|
||||
|
||||
|
||||
const QString part = QLatin1String(knownPseudoElements[element].name);
|
||||
const QString part = QLatin1StringView(knownPseudoElements[element].name);
|
||||
QList<Declaration> decls = declarations(rules, part, state);
|
||||
QRenderRule newRule(decls, obj);
|
||||
cache[state] = newRule;
|
||||
|
|
@ -2199,7 +2199,7 @@ bool QStyleSheetStyle::hasStyleRule(const QObject *obj, int part) const
|
|||
return result;
|
||||
}
|
||||
|
||||
QString pseudoElement = QLatin1String(knownPseudoElements[part].name);
|
||||
QString pseudoElement = QLatin1StringView(knownPseudoElements[part].name);
|
||||
for (int i = 0; i < rules.count(); i++) {
|
||||
const Selector& selector = rules.at(i).selectors.at(0);
|
||||
if (pseudoElement.compare(selector.pseudoElement(), Qt::CaseInsensitive) == 0) {
|
||||
|
|
@ -5501,7 +5501,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
|
|||
/*!
|
||||
\internal
|
||||
*/
|
||||
static QLatin1String propertyNameForStandardPixmap(QStyle::StandardPixmap sp)
|
||||
static QLatin1StringView propertyNameForStandardPixmap(QStyle::StandardPixmap sp)
|
||||
{
|
||||
switch (sp) {
|
||||
case QStyle::SP_TitleBarMenuButton: return "titlebar-menu-icon"_L1;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class QAbstractScrollAreaFilter : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
QAbstractScrollAreaFilter(QAbstractScrollAreaPrivate *p) : d(p)
|
||||
{ setObjectName(QLatin1String("qt_abstractscrollarea_filter")); }
|
||||
{ setObjectName(QLatin1StringView("qt_abstractscrollarea_filter")); }
|
||||
bool eventFilter(QObject *o, QEvent *e) override
|
||||
{ return (o == d->viewport ? d->viewportEvent(e) : false); }
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -303,7 +303,8 @@ public:
|
|||
{}
|
||||
|
||||
static bool isSeparator(const QModelIndex &index) {
|
||||
return index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator");
|
||||
return index.data(Qt::AccessibleDescriptionRole).toString()
|
||||
== QLatin1StringView("separator");
|
||||
}
|
||||
static void setSeparator(QAbstractItemModel *model, const QModelIndex &index) {
|
||||
model->setData(index, QString::fromLatin1("separator"), Qt::AccessibleDescriptionRole);
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ static QString int2string(int num, int base, int ndigits, bool *oflow)
|
|||
len = ndigits - len;
|
||||
if (len > 0)
|
||||
s += QString(len, u' ');
|
||||
s += QLatin1String(p);
|
||||
s += QLatin1StringView(p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -490,13 +490,13 @@ void QLineEdit::setClearButtonEnabled(bool enable)
|
|||
if (enable) {
|
||||
QAction *clearAction = new QAction(d->clearButtonIcon(), QString(), this);
|
||||
clearAction->setEnabled(!isReadOnly());
|
||||
clearAction->setObjectName(QLatin1String(clearButtonActionNameC));
|
||||
clearAction->setObjectName(QLatin1StringView(clearButtonActionNameC));
|
||||
|
||||
int flags = QLineEditPrivate::SideWidgetClearButton | QLineEditPrivate::SideWidgetFadeInWithText;
|
||||
auto widgetAction = d->addAction(clearAction, nullptr, QLineEdit::TrailingPosition, flags);
|
||||
widgetAction->setVisible(!text().isEmpty());
|
||||
} else {
|
||||
QAction *clearAction = findChild<QAction *>(QLatin1String(clearButtonActionNameC));
|
||||
QAction *clearAction = findChild<QAction *>(QLatin1StringView(clearButtonActionNameC));
|
||||
Q_ASSERT(clearAction);
|
||||
d->removeAction(clearAction);
|
||||
delete clearAction;
|
||||
|
|
@ -509,7 +509,7 @@ void QLineEdit::setClearButtonEnabled(bool enable)
|
|||
bool QLineEdit::isClearButtonEnabled() const
|
||||
{
|
||||
#if QT_CONFIG(action)
|
||||
return findChild<QAction *>(QLatin1String(clearButtonActionNameC));
|
||||
return findChild<QAction *>(QLatin1StringView(clearButtonActionNameC));
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue