QtGui: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434 Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
7b6b133746
commit
9a55c695c7
@ -152,7 +152,7 @@ AtSpiAdaptor::~AtSpiAdaptor()
|
||||
*/
|
||||
QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
{
|
||||
static const QLatin1String accessibleIntrospection(
|
||||
static const QLatin1StringView accessibleIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Accessible\">\n"
|
||||
" <property access=\"read\" type=\"s\" name=\"Name\"/>\n"
|
||||
" <property access=\"read\" type=\"s\" name=\"Description\"/>\n"
|
||||
@ -200,7 +200,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String actionIntrospection(
|
||||
static const QLatin1StringView actionIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Action\">\n"
|
||||
" <property access=\"read\" type=\"i\" name=\"NActions\"/>\n"
|
||||
" <method name=\"GetDescription\">\n"
|
||||
@ -226,7 +226,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String applicationIntrospection(
|
||||
static const QLatin1StringView applicationIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Application\">\n"
|
||||
" <property access=\"read\" type=\"s\" name=\"ToolkitName\"/>\n"
|
||||
" <property access=\"read\" type=\"s\" name=\"Version\"/>\n"
|
||||
@ -241,7 +241,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String componentIntrospection(
|
||||
static const QLatin1StringView componentIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Component\">\n"
|
||||
" <method name=\"Contains\">\n"
|
||||
" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
|
||||
@ -304,7 +304,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String editableTextIntrospection(
|
||||
static const QLatin1StringView editableTextIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.EditableText\">\n"
|
||||
" <method name=\"SetTextContents\">\n"
|
||||
" <arg direction=\"in\" type=\"s\" name=\"newContents\"/>\n"
|
||||
@ -337,7 +337,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String tableIntrospection(
|
||||
static const QLatin1StringView tableIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Table\">\n"
|
||||
" <property access=\"read\" type=\"i\" name=\"NRows\"/>\n"
|
||||
" <property access=\"read\" type=\"i\" name=\"NColumns\"/>\n"
|
||||
@ -445,7 +445,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String textIntrospection(
|
||||
static const QLatin1StringView textIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Text\">\n"
|
||||
" <property access=\"read\" type=\"i\" name=\"CharacterCount\"/>\n"
|
||||
" <property access=\"read\" type=\"i\" name=\"CaretOffset\"/>\n"
|
||||
@ -573,7 +573,7 @@ QString AtSpiAdaptor::introspect(const QString &path) const
|
||||
" </interface>\n"
|
||||
);
|
||||
|
||||
static const QLatin1String valueIntrospection(
|
||||
static const QLatin1StringView valueIntrospection(
|
||||
" <interface name=\"org.a11y.atspi.Value\">\n"
|
||||
" <property access=\"read\" type=\"d\" name=\"MinimumValue\"/>\n"
|
||||
" <property access=\"read\" type=\"d\" name=\"MaximumValue\"/>\n"
|
||||
@ -1321,7 +1321,7 @@ bool AtSpiAdaptor::applicationInterface(QAccessibleInterface *interface, const Q
|
||||
}
|
||||
if (function == "GetVersion"_L1) {
|
||||
Q_ASSERT(message.signature() == "ss"_L1);
|
||||
QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String(qVersion()))));
|
||||
QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1StringView(qVersion()))));
|
||||
return connection.send(reply);
|
||||
}
|
||||
if (function == "GetLocale"_L1) {
|
||||
@ -1548,7 +1548,7 @@ bool AtSpiAdaptor::inheritsQAction(QObject *object)
|
||||
{
|
||||
const QMetaObject *mo = object->metaObject();
|
||||
while (mo) {
|
||||
const QLatin1String cn(mo->className());
|
||||
const QLatin1StringView cn(mo->className());
|
||||
if (cn == "QAction"_L1)
|
||||
return true;
|
||||
mo = mo->superClass();
|
||||
|
@ -277,7 +277,7 @@ static RoleMapping map[] = {
|
||||
void QSpiAccessibleBridge::initializeConstantMappings()
|
||||
{
|
||||
for (uint i = 0; i < sizeof(map) / sizeof(RoleMapping); ++i)
|
||||
m_spiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].name)));
|
||||
m_spiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1StringView(map[i].name), tr(map[i].name)));
|
||||
|
||||
// -1 because we have button duplicated, as PushButton and Button.
|
||||
Q_ASSERT_X(m_spiRoleMapping.size() ==
|
||||
|
@ -683,7 +683,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
|
||||
// derived class and walk up the class hierarchy.
|
||||
const QMetaObject *mo = object->metaObject();
|
||||
while (mo) {
|
||||
const QString cn = QLatin1String(mo->className());
|
||||
const QString cn = QLatin1StringView(mo->className());
|
||||
|
||||
// Check if the class has a InterfaceFactory installed.
|
||||
for (int i = qAccessibleFactories()->count(); i > 0; --i) {
|
||||
|
@ -271,7 +271,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const int testIndex = keyMap.key(QLatin1String(testFormat), -1);
|
||||
const int testIndex = keyMap.key(QLatin1StringView(testFormat), -1);
|
||||
if (testIndex != -1) {
|
||||
QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(testIndex));
|
||||
if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
|
||||
@ -565,7 +565,7 @@ bool QImageReaderPrivate::initHandler()
|
||||
|
||||
do {
|
||||
file->setFileName(fileName + u'.'
|
||||
+ QLatin1String(extensions.at(currentExtension++).constData()));
|
||||
+ QLatin1StringView(extensions.at(currentExtension++).constData()));
|
||||
file->open(QIODevice::ReadOnly);
|
||||
} while (!file->isOpen() && currentExtension < extensions.size());
|
||||
|
||||
|
@ -928,9 +928,9 @@ static bool read_xpm_body(
|
||||
int transparentColor = currentColor;
|
||||
if (ncols <= 256) {
|
||||
image.setColor(transparentColor, 0);
|
||||
colorMap.insert(xpmHash(QLatin1String(index.constData())), transparentColor);
|
||||
colorMap.insert(xpmHash(QLatin1StringView(index.constData())), transparentColor);
|
||||
} else {
|
||||
colorMap.insert(xpmHash(QLatin1String(index.constData())), 0);
|
||||
colorMap.insert(xpmHash(QLatin1StringView(index.constData())), 0);
|
||||
}
|
||||
} else {
|
||||
QRgb c_rgb = 0;
|
||||
@ -944,9 +944,9 @@ static bool read_xpm_body(
|
||||
}
|
||||
if (ncols <= 256) {
|
||||
image.setColor(currentColor, 0xff000000 | c_rgb);
|
||||
colorMap.insert(xpmHash(QLatin1String(index.constData())), currentColor);
|
||||
colorMap.insert(xpmHash(QLatin1StringView(index.constData())), currentColor);
|
||||
} else {
|
||||
colorMap.insert(xpmHash(QLatin1String(index.constData())), 0xff000000 | c_rgb);
|
||||
colorMap.insert(xpmHash(QLatin1StringView(index.constData())), 0xff000000 | c_rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
{
|
||||
if (ignoreNtfsSymLinks) {
|
||||
#ifdef Q_OS_WIN
|
||||
return !mFileInfo.suffix().compare(QLatin1String("lnk"), Qt::CaseInsensitive);
|
||||
return !mFileInfo.suffix().compare(QLatin1StringView("lnk"), Qt::CaseInsensitive);
|
||||
#endif
|
||||
}
|
||||
return mFileInfo.isSymLink();
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
#endif
|
||||
|
||||
inline qint64 size() const { if (info && !info->isDir()) return info->size(); return 0; }
|
||||
inline QString type() const { if (info) return info->displayType; return QLatin1String(""); }
|
||||
inline QString type() const { if (info) return info->displayType; return QLatin1StringView(""); }
|
||||
inline QDateTime lastModified() const { if (info) return info->lastModified(); return QDateTime(); }
|
||||
inline QFile::Permissions permissions() const { if (info) return info->permissions(); return { }; }
|
||||
inline bool isReadable() const { return ((permissions() & QFile::ReadUser) != 0); }
|
||||
|
@ -1339,10 +1339,10 @@ static void init_plugins(const QList<QByteArray> &pluginList)
|
||||
int colonPos = pluginSpec.indexOf(':');
|
||||
QObject *plugin;
|
||||
if (colonPos < 0)
|
||||
plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString());
|
||||
plugin = QGenericPluginFactory::create(QLatin1StringView(pluginSpec), QString());
|
||||
else
|
||||
plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)),
|
||||
QLatin1String(pluginSpec.mid(colonPos+1)));
|
||||
plugin = QGenericPluginFactory::create(QLatin1StringView(pluginSpec.mid(0, colonPos)),
|
||||
QLatin1StringView(pluginSpec.mid(colonPos+1)));
|
||||
if (plugin)
|
||||
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
|
||||
else
|
||||
@ -1505,7 +1505,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
|
||||
|
||||
Q_UNUSED(platformExplicitlySelected);
|
||||
|
||||
init_platform(QLatin1String(platformName), platformPluginPath, platformThemeName, argc, argv);
|
||||
init_platform(QLatin1StringView(platformName), platformPluginPath, platformThemeName, argc, argv);
|
||||
|
||||
if (!icon.isEmpty())
|
||||
forcedWindowIcon = QDir::isAbsolutePath(icon) ? QIcon(icon) : QIcon::fromTheme(icon);
|
||||
|
@ -122,7 +122,7 @@ static const struct : QMetaTypeModuleHelper
|
||||
return true;
|
||||
);
|
||||
QMETATYPE_CONVERTER(QColor, QByteArray,
|
||||
result = QColor::fromString(QLatin1String(source));
|
||||
result = QColor::fromString(QLatin1StringView(source));
|
||||
return result.isValid();
|
||||
);
|
||||
QMETATYPE_CONVERTER(QString, QColor,
|
||||
|
@ -53,7 +53,7 @@ static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
|
||||
QStringList formats;
|
||||
formats.reserve(imageFormats.size());
|
||||
for (const auto &format : imageFormats)
|
||||
formats.append("image/"_L1 + QLatin1String(format.toLower()));
|
||||
formats.append("image/"_L1 + QLatin1StringView(format.toLower()));
|
||||
|
||||
//put png at the front because it is best
|
||||
int pngIndex = formats.indexOf("image/png"_L1);
|
||||
|
@ -215,7 +215,7 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v)
|
||||
result.number = QVersionNumber::fromString(o.value("value"_L1).toString());
|
||||
const QString opS = o.value("op"_L1).toString();
|
||||
for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) {
|
||||
if (opS == QLatin1String(operators[i])) {
|
||||
if (opS == QLatin1StringView(operators[i])) {
|
||||
result.op = static_cast<Operator>(i);
|
||||
break;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ static QStringList get_colornames()
|
||||
#ifndef QT_NO_COLORNAMES
|
||||
lst.reserve(rgbTblSize);
|
||||
for (int i = 0; i < rgbTblSize; i++)
|
||||
lst << QLatin1String(rgbTbl[i].name);
|
||||
lst << QLatin1StringView(rgbTbl[i].name);
|
||||
#endif
|
||||
return lst;
|
||||
}
|
||||
@ -847,7 +847,7 @@ QColor::QColor(Spec spec) noexcept
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QColor::QColor(QLatin1String name)
|
||||
\fn QColor::QColor(QLatin1StringView name)
|
||||
|
||||
\deprecated [6.6] Use fromString() instead.
|
||||
|
||||
@ -935,7 +935,7 @@ void QColor::setNamedColor(QStringView name)
|
||||
\deprecated [6.6] Use fromString() instead.
|
||||
*/
|
||||
|
||||
void QColor::setNamedColor(QLatin1String name)
|
||||
void QColor::setNamedColor(QLatin1StringView name)
|
||||
{
|
||||
*this = fromString(name);
|
||||
}
|
||||
@ -973,7 +973,7 @@ bool QColor::isValidColor(QStringView name) noexcept
|
||||
\since 5.8
|
||||
\deprecated [6.6] Use isValidColorName() instead.
|
||||
*/
|
||||
bool QColor::isValidColor(QLatin1String name) noexcept
|
||||
bool QColor::isValidColor(QLatin1StringView name) noexcept
|
||||
{
|
||||
return isValidColorName(name);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
QT_DEPRECATED_VERSION_X_6_6("Use QColor::fromString() instead.")
|
||||
inline QColor(const char *aname);
|
||||
QT_DEPRECATED_VERSION_X_6_6("Use QColor::fromString() instead.")
|
||||
inline QColor(QLatin1String name);
|
||||
inline QColor(QLatin1StringView name);
|
||||
#endif
|
||||
QColor(Spec spec) noexcept;
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
QT_DEPRECATED_VERSION_X_6_6("Use fromString() instead.")
|
||||
void setNamedColor(QStringView name);
|
||||
QT_DEPRECATED_VERSION_X_6_6("Use fromString() instead.")
|
||||
void setNamedColor(QLatin1String name);
|
||||
void setNamedColor(QLatin1StringView name);
|
||||
#endif
|
||||
|
||||
static QStringList colorNames();
|
||||
@ -240,7 +240,7 @@ public:
|
||||
QT_DEPRECATED_VERSION_X_6_6("Use isValidColorName() instead.")
|
||||
static bool isValidColor(QStringView) noexcept;
|
||||
QT_DEPRECATED_VERSION_X_6_6("Use isValidColorName() instead.")
|
||||
static bool isValidColor(QLatin1String) noexcept;
|
||||
static bool isValidColor(QLatin1StringView) noexcept;
|
||||
#endif
|
||||
static bool isValidColorName(QAnyStringView) noexcept;
|
||||
|
||||
@ -313,7 +313,7 @@ public: // can't give friendship to a namespace, so it needs to be public
|
||||
Q_DECLARE_TYPEINFO(QColor, Q_RELOCATABLE_TYPE);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(6, 6)
|
||||
inline QColor::QColor(QLatin1String aname)
|
||||
inline QColor::QColor(QLatin1StringView aname)
|
||||
: QColor(fromString(aname)) {}
|
||||
|
||||
inline QColor::QColor(QStringView aname)
|
||||
|
@ -412,7 +412,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
|
||||
else if (key.endsWith(".Transverse"_L1))
|
||||
key.chop(11);
|
||||
for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) {
|
||||
if (QLatin1String(qt_pageSizes[i].mediaOption) == key) {
|
||||
if (QLatin1StringView(qt_pageSizes[i].mediaOption) == key) {
|
||||
if (match)
|
||||
*match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
|
||||
return qt_pageSizes[i].id;
|
||||
|
@ -157,14 +157,14 @@ static inline bool detectWebBrowser(const QByteArray &desktop,
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sizeof(browsers)/sizeof(char *); ++i)
|
||||
if (checkExecutable(QLatin1String(browsers[i]), browser))
|
||||
if (checkExecutable(QLatin1StringView(browsers[i]), browser))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool launch(const QString &launcher, const QUrl &url)
|
||||
{
|
||||
const QString command = launcher + u' ' + QLatin1String(url.toEncoded());
|
||||
const QString command = launcher + u' ' + QLatin1StringView(url.toEncoded());
|
||||
if (debug)
|
||||
qDebug("Launching %s", qPrintable(command));
|
||||
#if !QT_CONFIG(process)
|
||||
|
@ -141,8 +141,8 @@ class QGenericUnixThemePrivate : public QPlatformThemePrivate
|
||||
public:
|
||||
QGenericUnixThemePrivate()
|
||||
: QPlatformThemePrivate()
|
||||
, systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize)
|
||||
, fixedFont(QLatin1String(defaultFixedFontNameC), systemFont.pointSize())
|
||||
, systemFont(QLatin1StringView(defaultSystemFontNameC), defaultSystemFontSize)
|
||||
, fixedFont(QLatin1StringView(defaultFixedFontNameC), systemFont.pointSize())
|
||||
{
|
||||
fixedFont.setStyleHint(QFont::TypeWriter);
|
||||
qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
|
||||
@ -386,12 +386,12 @@ void QKdeThemePrivate::refresh()
|
||||
if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeVersion, kdeSettings)))
|
||||
resources.fonts[QPlatformTheme::SystemFont] = systemFont;
|
||||
else
|
||||
resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize);
|
||||
resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1StringView(defaultSystemFontNameC), defaultSystemFontSize);
|
||||
|
||||
if (QFont *fixedFont = kdeFont(readKdeSetting(QStringLiteral("fixed"), kdeDirs, kdeVersion, kdeSettings))) {
|
||||
resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
|
||||
} else {
|
||||
fixedFont = new QFont(QLatin1String(defaultFixedFontNameC), defaultSystemFontSize);
|
||||
fixedFont = new QFont(QLatin1StringView(defaultFixedFontNameC), defaultSystemFontSize);
|
||||
fixedFont->setStyleHint(QFont::TypeWriter);
|
||||
resources.fonts[QPlatformTheme::FixedFont] = fixedFont;
|
||||
}
|
||||
@ -647,7 +647,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
|
||||
if (!kdeDirsVar.isEmpty())
|
||||
kdeDirs += kdeDirsVar.split(u':', Qt::SkipEmptyParts);
|
||||
|
||||
const QString kdeVersionHomePath = QDir::homePath() + "/.kde"_L1 + QLatin1String(kdeVersionBA);
|
||||
const QString kdeVersionHomePath = QDir::homePath() + "/.kde"_L1 + QLatin1StringView(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionHomePath).isDir())
|
||||
kdeDirs += kdeVersionHomePath;
|
||||
|
||||
@ -655,14 +655,14 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
|
||||
if (QFileInfo(kdeHomePath).isDir())
|
||||
kdeDirs += kdeHomePath;
|
||||
|
||||
const QString kdeRcPath = "/etc/kde"_L1 + QLatin1String(kdeVersionBA) + "rc"_L1;
|
||||
const QString kdeRcPath = "/etc/kde"_L1 + QLatin1StringView(kdeVersionBA) + "rc"_L1;
|
||||
if (QFileInfo(kdeRcPath).isReadable()) {
|
||||
QSettings kdeSettings(kdeRcPath, QSettings::IniFormat);
|
||||
kdeSettings.beginGroup(QStringLiteral("Directories-default"));
|
||||
kdeDirs += kdeSettings.value(QStringLiteral("prefixes")).toStringList();
|
||||
}
|
||||
|
||||
const QString kdeVersionPrefix = "/etc/kde"_L1 + QLatin1String(kdeVersionBA);
|
||||
const QString kdeVersionPrefix = "/etc/kde"_L1 + QLatin1StringView(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionPrefix).isDir())
|
||||
kdeDirs += kdeVersionPrefix;
|
||||
|
||||
@ -719,7 +719,7 @@ public:
|
||||
QString fontName = gtkFontName.left(split);
|
||||
|
||||
systemFont = new QFont(fontName, size);
|
||||
fixedFont = new QFont(QLatin1String(defaultFixedFontNameC), systemFont->pointSize());
|
||||
fixedFont = new QFont(QLatin1StringView(defaultFixedFontNameC), systemFont->pointSize());
|
||||
fixedFont->setStyleHint(QFont::TypeWriter);
|
||||
qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
|
||||
}
|
||||
@ -795,7 +795,7 @@ const QFont *QGnomeTheme::font(Font type) const
|
||||
|
||||
QString QGnomeTheme::gtkFontName() const
|
||||
{
|
||||
return QStringLiteral("%1 %2").arg(QLatin1String(defaultSystemFontNameC)).arg(defaultSystemFontSize);
|
||||
return QStringLiteral("%1 %2").arg(QLatin1StringView(defaultSystemFontNameC)).arg(defaultSystemFontSize);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
@ -841,14 +841,14 @@ QString QGnomeTheme::standardButtonText(int button) const
|
||||
|
||||
QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
|
||||
{
|
||||
if (name == QLatin1String(QGenericUnixTheme::name))
|
||||
if (name == QLatin1StringView(QGenericUnixTheme::name))
|
||||
return new QGenericUnixTheme;
|
||||
#if QT_CONFIG(settings)
|
||||
if (name == QLatin1String(QKdeTheme::name))
|
||||
if (name == QLatin1StringView(QKdeTheme::name))
|
||||
if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme())
|
||||
return kdeTheme;
|
||||
#endif
|
||||
if (name == QLatin1String(QGnomeTheme::name))
|
||||
if (name == QLatin1StringView(QGnomeTheme::name))
|
||||
return new QGnomeTheme;
|
||||
return nullptr;
|
||||
}
|
||||
@ -869,13 +869,13 @@ QStringList QGenericUnixTheme::themeNames()
|
||||
for (const QByteArray &desktopName : desktopNames) {
|
||||
if (desktopEnvironment == "KDE") {
|
||||
#if QT_CONFIG(settings)
|
||||
result.push_back(QLatin1String(QKdeTheme::name));
|
||||
result.push_back(QLatin1StringView(QKdeTheme::name));
|
||||
#endif
|
||||
} else if (gtkBasedEnvironments.contains(desktopName)) {
|
||||
// prefer the GTK3 theme implementation with native dialogs etc.
|
||||
result.push_back(QStringLiteral("gtk3"));
|
||||
// fallback to the generic Gnome theme if loading the GTK3 theme fails
|
||||
result.push_back(QLatin1String(QGnomeTheme::name));
|
||||
result.push_back(QLatin1StringView(QGnomeTheme::name));
|
||||
} else {
|
||||
// unknown, but lowercase the name (our standard practice) and
|
||||
// remove any "x-" prefix
|
||||
@ -884,7 +884,7 @@ QStringList QGenericUnixTheme::themeNames()
|
||||
}
|
||||
}
|
||||
} // desktopSettingsAware
|
||||
result.append(QLatin1String(QGenericUnixTheme::name));
|
||||
result.append(QLatin1StringView(QGenericUnixTheme::name));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ void QXkbCommon::setXkbContext(QPlatformInputContext *inputContext, struct xkb_c
|
||||
const char *const inputContextClassName = "QComposeInputContext";
|
||||
const char *const normalizedSignature = "setXkbContext(xkb_context*)";
|
||||
|
||||
if (inputContext->objectName() != QLatin1String(inputContextClassName))
|
||||
if (inputContext->objectName() != QLatin1StringView(inputContextClassName))
|
||||
return;
|
||||
|
||||
static const QMetaMethod setXkbContext = [&]() {
|
||||
|
@ -643,13 +643,13 @@ static const struct TypeTab {
|
||||
{ "imageBuffer", QShaderDescription::ImageBuffer }
|
||||
};
|
||||
|
||||
static QLatin1String typeStr(const QShaderDescription::VariableType &t)
|
||||
static QLatin1StringView typeStr(const QShaderDescription::VariableType &t)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(typeTab) / sizeof(TypeTab); ++i) {
|
||||
if (typeTab[i].v == t)
|
||||
return QLatin1String(typeTab[i].k);
|
||||
return QLatin1StringView(typeTab[i].k);
|
||||
}
|
||||
return QLatin1String();
|
||||
return {};
|
||||
}
|
||||
|
||||
static const struct ImageFormatTab {
|
||||
@ -698,13 +698,13 @@ static const struct ImageFormatTab {
|
||||
{ "r8ui", QShaderDescription::ImageFormatR8ui }
|
||||
};
|
||||
|
||||
static QLatin1String imageFormatStr(const QShaderDescription::ImageFormat &f)
|
||||
static QLatin1StringView imageFormatStr(const QShaderDescription::ImageFormat &f)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(imageFormatTab) / sizeof(ImageFormatTab); ++i) {
|
||||
if (imageFormatTab[i].v == f)
|
||||
return QLatin1String(imageFormatTab[i].k);
|
||||
return QLatin1StringView(imageFormatTab[i].k);
|
||||
}
|
||||
return QLatin1String();
|
||||
return {};
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
@ -806,7 +806,7 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::StorageBlock &blk)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define JSON_KEY(key) static constexpr QLatin1String key ## Key() noexcept { return QLatin1String( #key ); }
|
||||
#define JSON_KEY(key) static constexpr QLatin1StringView key ## Key() noexcept { return QLatin1StringView( #key ); }
|
||||
JSON_KEY(name)
|
||||
JSON_KEY(type)
|
||||
JSON_KEY(location)
|
||||
|
@ -588,7 +588,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
||||
// of the required glyphs, or representing them by question marks.
|
||||
// Move these to the end, so that the proper fonts are preferred.
|
||||
for (const char *family : { ".Apple Symbols Fallback", ".Noto Sans Universal" }) {
|
||||
int index = fallbackList.indexOf(QLatin1String(family));
|
||||
int index = fallbackList.indexOf(QLatin1StringView(family));
|
||||
if (index >= 0)
|
||||
fallbackList.move(index, fallbackList.size() - 1);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 50, 55, 35,
|
||||
QString Value::toString() const
|
||||
{
|
||||
if (type == KnownIdentifier) {
|
||||
return QLatin1String(values[indexOfId[variant.toInt()]].name);
|
||||
return QLatin1StringView(values[indexOfId[variant.toInt()]].name);
|
||||
} else {
|
||||
return variant.toString();
|
||||
}
|
||||
@ -362,12 +362,12 @@ static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1] = {
|
||||
|
||||
static bool operator<(const QString &name, const QCssKnownValue &prop)
|
||||
{
|
||||
return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0;
|
||||
return QString::compare(name, QLatin1StringView(prop.name), Qt::CaseInsensitive) < 0;
|
||||
}
|
||||
|
||||
static bool operator<(const QCssKnownValue &prop, const QString &name)
|
||||
{
|
||||
return QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0;
|
||||
return QString::compare(QLatin1StringView(prop.name), name, Qt::CaseInsensitive) < 0;
|
||||
}
|
||||
|
||||
static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues)
|
||||
@ -1570,7 +1570,7 @@ bool Declaration::realValue(qreal *real, const char *unit) const
|
||||
const QString str = v.variant.toString();
|
||||
QStringView s(str);
|
||||
if (unit) {
|
||||
const QLatin1String unitStr(unit);
|
||||
const QLatin1StringView unitStr(unit);
|
||||
if (!s.endsWith(unitStr, Qt::CaseInsensitive))
|
||||
return false;
|
||||
s.chop(unitStr.size());
|
||||
@ -1589,7 +1589,7 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
|
||||
const QString str = v.variant.toString();
|
||||
QStringView s(str);
|
||||
if (unit) {
|
||||
const QLatin1String unitStr(unit);
|
||||
const QLatin1StringView unitStr(unit);
|
||||
if (!s.endsWith(unitStr, Qt::CaseInsensitive))
|
||||
return false;
|
||||
s.chop(unitStr.size());
|
||||
@ -2214,7 +2214,7 @@ QList<Declaration> StyleSelector::declarationsForNode(NodePtr node, const char *
|
||||
const Selector& selector = rules.at(i).selectors.at(0);
|
||||
const QString pseudoElement = selector.pseudoElement();
|
||||
|
||||
if (extraPseudo && pseudoElement == QLatin1String(extraPseudo)) {
|
||||
if (extraPseudo && pseudoElement == QLatin1StringView(extraPseudo)) {
|
||||
decls += rules.at(i).declarations;
|
||||
continue;
|
||||
}
|
||||
@ -2991,7 +2991,7 @@ bool Parser::until(QCss::TokenType target, QCss::TokenType target2)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::testTokenAndEndsWith(QCss::TokenType t, QLatin1String str)
|
||||
bool Parser::testTokenAndEndsWith(QCss::TokenType t, QLatin1StringView str)
|
||||
{
|
||||
if (!test(t)) return false;
|
||||
if (!lexem().endsWith(str, Qt::CaseInsensitive)) {
|
||||
|
@ -799,9 +799,9 @@ public:
|
||||
inline bool testMedium() { return test(IDENT); }
|
||||
inline bool parseNextMedium(QStringList *media) { if (!testMedium()) return recordError(); return parseMedium(media); }
|
||||
inline bool testPseudoPage() { return test(COLON); }
|
||||
inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("import")); }
|
||||
inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("media")); }
|
||||
inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("page")); }
|
||||
inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1StringView("import")); }
|
||||
inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1StringView("media")); }
|
||||
inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1StringView("page")); }
|
||||
inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(TILDE) || test(S); }
|
||||
inline bool testProperty() { return test(IDENT); }
|
||||
bool testTerm();
|
||||
@ -835,7 +835,7 @@ public:
|
||||
return (index - 1) < symbols.count() ? symbols.at(index - 1).token : NONE;
|
||||
}
|
||||
|
||||
bool testTokenAndEndsWith(TokenType t, QLatin1String str);
|
||||
bool testTokenAndEndsWith(TokenType t, QLatin1StringView str);
|
||||
|
||||
inline bool recordError() { errorIndex = index; return false; }
|
||||
|
||||
|
@ -1248,10 +1248,10 @@ QByteArray QFontSubset::toTruetype() const
|
||||
if (noEmbed)
|
||||
name.copyright = "Fake font"_L1;
|
||||
else
|
||||
name.copyright = QLatin1String(properties.copyright);
|
||||
name.copyright = QLatin1StringView(properties.copyright);
|
||||
name.family = fontEngine->fontDef.families.first();
|
||||
name.subfamily = "Regular"_L1; // ######
|
||||
name.postscript_name = QLatin1String(properties.postscriptName);
|
||||
name.postscript_name = QLatin1StringView(properties.postscriptName);
|
||||
name_table = generateName(name);
|
||||
}
|
||||
tables.append(name_table);
|
||||
|
@ -2469,7 +2469,7 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
|
||||
void QTextHtmlExporter::emitAttribute(const char *attribute, const QString &value)
|
||||
{
|
||||
html += u' ';
|
||||
html += QLatin1String(attribute);
|
||||
html += QLatin1StringView(attribute);
|
||||
html += "=\""_L1;
|
||||
html += value.toHtmlEscaped();
|
||||
html += u'"';
|
||||
@ -2512,7 +2512,7 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
|
||||
}
|
||||
if (name) {
|
||||
html += " font-size:"_L1;
|
||||
html += QLatin1String(name);
|
||||
html += QLatin1StringView(name);
|
||||
html += u';';
|
||||
attributesEmitted = true;
|
||||
}
|
||||
@ -2659,7 +2659,7 @@ void QTextHtmlExporter::emitTextLength(const char *attribute, const QTextLength
|
||||
return;
|
||||
|
||||
html += u' ';
|
||||
html += QLatin1String(attribute);
|
||||
html += QLatin1StringView(attribute);
|
||||
html += "=\""_L1;
|
||||
html += QString::number(length.rawValue());
|
||||
|
||||
@ -2702,7 +2702,7 @@ void QTextHtmlExporter::emitFloatStyle(QTextFrameFormat::Position pos, StyleMode
|
||||
html += u'\"';
|
||||
}
|
||||
|
||||
static QLatin1String richtextBorderStyleToHtmlBorderStyle(QTextFrameFormat::BorderStyle style)
|
||||
static QLatin1StringView richtextBorderStyleToHtmlBorderStyle(QTextFrameFormat::BorderStyle style)
|
||||
{
|
||||
switch (style) {
|
||||
case QTextFrameFormat::BorderStyle_None:
|
||||
|
@ -326,18 +326,18 @@ static_assert(MAX_ENTITY == sizeof entities / sizeof *entities);
|
||||
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
|
||||
bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
|
||||
{
|
||||
return QLatin1String(entity1.name) < QLatin1String(entity2.name);
|
||||
return QLatin1StringView(entity1.name) < QLatin1StringView(entity2.name);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool operator<(QStringView entityStr, const QTextHtmlEntity &entity)
|
||||
{
|
||||
return entityStr < QLatin1String(entity.name);
|
||||
return entityStr < QLatin1StringView(entity.name);
|
||||
}
|
||||
|
||||
static bool operator<(const QTextHtmlEntity &entity, QStringView entityStr)
|
||||
{
|
||||
return QLatin1String(entity.name) < entityStr;
|
||||
return QLatin1StringView(entity.name) < entityStr;
|
||||
}
|
||||
|
||||
static QChar resolveEntity(QStringView entity)
|
||||
@ -451,12 +451,12 @@ static const QTextHtmlElement elements[Html_NumElements]= {
|
||||
|
||||
static bool operator<(const QString &str, const QTextHtmlElement &e)
|
||||
{
|
||||
return str < QLatin1String(e.name);
|
||||
return str < QLatin1StringView(e.name);
|
||||
}
|
||||
|
||||
static bool operator<(const QTextHtmlElement &e, const QString &str)
|
||||
{
|
||||
return QLatin1String(e.name) < str;
|
||||
return QLatin1StringView(e.name) < str;
|
||||
}
|
||||
|
||||
static const QTextHtmlElement *lookupElementHelper(const QString &element)
|
||||
|
@ -196,9 +196,9 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
|
||||
case MD_BLOCK_CODE: {
|
||||
MD_BLOCK_CODE_DETAIL *detail = static_cast<MD_BLOCK_CODE_DETAIL *>(det);
|
||||
m_codeBlock = true;
|
||||
m_blockCodeLanguage = QLatin1String(detail->lang.text, int(detail->lang.size));
|
||||
m_blockCodeLanguage = QLatin1StringView(detail->lang.text, int(detail->lang.size));
|
||||
m_blockCodeFence = detail->fence_char;
|
||||
QString info = QLatin1String(detail->info.text, int(detail->info.size));
|
||||
QString info = QLatin1StringView(detail->info.text, int(detail->info.size));
|
||||
m_needsInsertBlock = true;
|
||||
if (m_blockQuoteDepth)
|
||||
qCDebug(lcMD, "CODE lang '%s' info '%s' fenced with '%c' inside QUOTE %d", qPrintable(m_blockCodeLanguage), qPrintable(info), m_blockCodeFence, m_blockQuoteDepth);
|
||||
|
@ -430,7 +430,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
|
||||
numberStr += Space;
|
||||
prefix += numberStr;
|
||||
} else {
|
||||
prefix += QLatin1String(bullet) + Space;
|
||||
prefix += QLatin1StringView(bullet) + Space;
|
||||
}
|
||||
m_stream << prefix;
|
||||
} else if (blockFmt.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) {
|
||||
|
@ -522,7 +522,7 @@ static void populateFromPattern(FcPattern *pattern, QFontDatabasePrivate::Applic
|
||||
applicationFont->properties.append(properties);
|
||||
}
|
||||
|
||||
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
|
||||
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
|
||||
// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
|
||||
|
||||
for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k) {
|
||||
@ -554,7 +554,7 @@ static void populateFromPattern(FcPattern *pattern, QFontDatabasePrivate::Applic
|
||||
applicationFont->properties.append(properties);
|
||||
}
|
||||
FontFile *altFontFile = new FontFile(*fontFile);
|
||||
QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile);
|
||||
QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1StringView((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile);
|
||||
} else {
|
||||
QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF
|
||||
}
|
||||
QString QWindowsFontDatabaseFT::fontDir() const
|
||||
{
|
||||
const QString result = QLatin1String(qgetenv("windir")) + "/Fonts"_L1;//QPlatformFontDatabase::fontDir();
|
||||
const QString result = QLatin1StringView(qgetenv("windir")) + "/Fonts"_L1;//QPlatformFontDatabase::fontDir();
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << result;
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user