Replace uses of _qs with _s in sources and examples

Task-number: QTBUG-101408
Change-Id: I48360ba3b23965cd3d90ac243c100a0656a4cde8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Sona Kurazyan 2022-03-18 10:31:16 +01:00
parent a1d8b9023f
commit 908e85cc85
19 changed files with 48 additions and 31 deletions

View File

@ -57,13 +57,15 @@
#include "dialog.h"
using namespace Qt::StringLiterals;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
#if QT_CONFIG(translation)
QTranslator translator;
if (translator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs,
if (translator.load(QLocale::system(), u"qtbase"_s, u"_"_s,
QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
app.installTranslator(&translator);
}

View File

@ -46,6 +46,7 @@
//#define DEBUG_SOLUTION_GEN
using namespace QMakeInternal;
using namespace Qt::StringLiterals;
QT_BEGIN_NAMESPACE
// Filter GUIDs (Do NOT change these!) ------------------------------
@ -301,7 +302,7 @@ QString VcprojGenerator::retrievePlatformToolSet() const
if (!envVar.isEmpty())
return envVar;
return u"v"_qs + project->first("MSVC_TOOLSET_VER");
return u"v"_s + project->first("MSVC_TOOLSET_VER");
}
bool VcprojGenerator::isStandardSuffix(const QString &suffix) const

View File

@ -58,7 +58,7 @@ int main() {
int y;
int z;
QString toString() const { return u"[x: %1; y: %2, z: %3]"_qs.arg(QString::number(x),
QString toString() const { return u"[x: %1; y: %2, z: %3]"_s.arg(QString::number(x),
QString::number(y),
QString::number(z)); }
};

View File

@ -148,7 +148,7 @@ static QSettings *findConfiguration()
#endif
if (QCoreApplication::instance()) {
QDir pwd(QCoreApplication::applicationDirPath());
qtconfig = pwd.filePath(u"qt" QT_STRINGIFY(QT_VERSION_MAJOR) ".conf"_qs);
qtconfig = pwd.filePath(u"qt" QT_STRINGIFY(QT_VERSION_MAJOR) ".conf"_s);
if (QFile::exists(qtconfig))
return new QSettings(qtconfig, QSettings::IniFormat);
qtconfig = pwd.filePath("qt.conf"_L1);
@ -532,7 +532,7 @@ QLibraryInfoPrivate::LocationInfo QLibraryInfoPrivate::locationInfo(QLibraryInfo
result.key = QLatin1StringView(qtConfEntries.viewAt(loc * 2));
result.defaultValue = QLatin1StringView(qtConfEntries.viewAt(loc * 2 + 1));
if (result.key == u"QmlImports")
result.fallbackKey = u"Qml2Imports"_qs;
result.fallbackKey = u"Qml2Imports"_s;
#ifndef Q_OS_WIN // On Windows we use the registry
} else if (loc == QLibraryInfo::SettingsPath) {
result.key = "Settings"_L1;

View File

@ -1648,7 +1648,7 @@ QString QFileSystemEngine::homePath()
QString QFileSystemEngine::rootPath()
{
return u"/"_qs;
return u"/"_s;
}
QString QFileSystemEngine::tempPath()

View File

@ -61,7 +61,7 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
{
Q_UNUSED(nameFilters);
Q_UNUSED(flags);
if (nativePath.endsWith(u".lnk"_qs) && !QFileSystemEngine::isDirPath(dirPath, nullptr)) {
if (nativePath.endsWith(u".lnk"_s) && !QFileSystemEngine::isDirPath(dirPath, nullptr)) {
QFileSystemMetaData metaData;
QFileSystemEntry link = QFileSystemEngine::getLinkTarget(entry, metaData);
nativePath = link.nativeFilePath();

View File

@ -251,7 +251,7 @@ bool QStorageInfoPrivate::queryStorageProperty()
struct Helper
{
QBasicMutex mutex;
QSystemLibrary ntdll {u"ntdll"_qs};
QSystemLibrary ntdll {u"ntdll"_s};
};
Q_GLOBAL_STATIC(Helper, gNtdllHelper)

View File

@ -154,7 +154,7 @@ QString QSystemError::string(ErrorScope errorScope, int errorCode)
qWarning("invalid error scope");
Q_FALLTHROUGH();
case NoError:
return u"No error"_qs;
return u"No error"_s;
}
}

View File

@ -260,9 +260,9 @@ QString QMimeType::comment() const
QStringList languageList;
languageList << QLocale().name();
languageList << QLocale().uiLanguages();
languageList << u"default"_qs; // use the default locale if possible.
languageList << u"default"_s; // use the default locale if possible.
for (const QString &language : qAsConst(languageList)) {
const QString lang = language == "C"_L1 ? u"en_US"_qs : language;
const QString lang = language == "C"_L1 ? u"en_US"_s : language;
const QString comm = d->localeComments.value(lang);
if (!comm.isEmpty())
return comm;

View File

@ -1113,7 +1113,7 @@ static QString winIso639LangName(LCID id)
if (ok && *endptr == '\0') {
switch (i) {
case 0x814:
result = u"nn"_qs; // Nynorsk
result = u"nn"_s; // Nynorsk
break;
default:
break;

View File

@ -1597,7 +1597,7 @@ QString QRegularExpression::errorString() const
#endif
}
#ifdef QT_NO_TRANSLATION
return u"no error"_qs;
return u"no error"_s;
#else
return QCoreApplication::translate("QRegularExpression", "no error");
#endif

View File

@ -279,7 +279,7 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
Q_ASSERT(runnable != nullptr);
auto thread = std::make_unique<QThreadPoolThread>(this);
if (objectName.isEmpty())
objectName = u"Thread (pooled)"_qs;
objectName = u"Thread (pooled)"_s;
thread->setObjectName(objectName);
Q_ASSERT(!allThreads.contains(thread.get())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
allThreads.insert(thread.get());

View File

@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QT_IMPL_METATYPE_EXTERN(QNetworkCookie)
/*!
@ -667,7 +669,7 @@ static QDateTime parseDateString(const QByteArray &dateString)
// hour:minute:second.ms pm
static const QRegularExpression timeRx(
u"(\\d\\d?):(\\d\\d?)(?::(\\d\\d?)(?:\\.(\\d{1,3}))?)?(?:\\s*(am|pm))?"_qs);
u"(\\d\\d?):(\\d\\d?)(?::(\\d\\d?)(?:\\.(\\d{1,3}))?)?(?:\\s*(am|pm))?"_s);
int at = 0;
while (at < dateString.length()) {

View File

@ -64,6 +64,8 @@ extern "C" int LookupStringInFixedSet(const unsigned char *graph, std::size_t le
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcTld, "qt.network.tld")
static constexpr int PSL_NOT_FOUND = -1;
@ -106,7 +108,7 @@ int QPublicSuffixDatabase::lookupDomain(QByteArrayView domain) const
static QStringList locatePublicSuffixFiles()
{
return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
u"publicsuffix/public_suffix_list.dafsa"_qs);
u"publicsuffix/public_suffix_list.dafsa"_s);
}
QPublicSuffixDatabase::QPublicSuffixDatabase()

View File

@ -61,6 +61,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QNetworkManagerInterfaceBase::QNetworkManagerInterfaceBase(QObject *parent)
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), QLatin1String(NM_DBUS_PATH),
NM_DBUS_INTERFACE, QDBusConnection::systemBus(), parent)
@ -137,7 +139,7 @@ static QDBusInterface getPrimaryDevice(const QDBusObjectPath &devicePath)
std::optional<QDBusObjectPath> QNetworkManagerInterface::primaryConnectionDevicePath() const
{
auto it = propertyMap.constFind(u"PrimaryConnection"_qs);
auto it = propertyMap.constFind(u"PrimaryConnection"_s);
if (it != propertyMap.cend())
return it->value<QDBusObjectPath>();
return std::nullopt;

View File

@ -58,6 +58,8 @@ static const char m_classErrorMsg[] = "Can't find class \"%s\"";
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
namespace QtAndroidAccessibility
{
static jmethodID m_addActionMethodID = 0;
@ -374,7 +376,7 @@ if (!clazz) { \
const double step = qAbs(valueIface->minimumStepSize().toDouble(&stepIsValid));
if (!stepIsValid || qFuzzyIsNull(step)) {
// Ignore step, use default precision
valueStr = qFuzzyIsNull(val) ? u"0"_qs : QString::number(val, 'f');
valueStr = qFuzzyIsNull(val) ? u"0"_s : QString::number(val, 'f');
} else {
const int precision = [](double s) {
int count = 0;
@ -398,7 +400,7 @@ if (!clazz) { \
}
return count;
}(step);
valueStr = qFuzzyIsNull(val / step) ? u"0"_qs
valueStr = qFuzzyIsNull(val / step) ? u"0"_s
: QString::number(val, 'f', precision);
}
} else {

View File

@ -35,6 +35,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
CustomWidgetsInfo::CustomWidgetsInfo() = default;
void CustomWidgetsInfo::acceptUI(DomUI *node)
@ -109,8 +111,8 @@ bool CustomWidgetsInfo::isAmbiguousSignal(const QString &className,
if (signalSignature.startsWith(u"triggered") && extends(className, "QAction"))
return true;
if (signalSignature.startsWith(u"clicked(")
&& extendsOneOf(className, {u"QCommandLinkButton"_qs, u"QCheckBox"_qs,
u"QPushButton"_qs, u"QRadioButton"_qs, u"QToolButton"_qs})) {
&& extendsOneOf(className, {u"QCommandLinkButton"_s, u"QCheckBox"_s,
u"QPushButton"_s, u"QRadioButton"_s, u"QToolButton"_s})) {
return true;
}
return false;
@ -137,12 +139,12 @@ QString CustomWidgetsInfo::simpleContainerAddPageMethod(const QString &name) con
using AddPageMethod = std::pair<QString, QString>;
static const AddPageMethod addPageMethods[] = {
{u"QStackedWidget"_qs, u"addWidget"_qs},
{u"QToolBar"_qs, u"addWidget"_qs},
{u"QDockWidget"_qs, u"setWidget"_qs},
{u"QScrollArea"_qs, u"setWidget"_qs},
{u"QSplitter"_qs, u"addWidget"_qs},
{u"QMdiArea"_qs, u"addSubWindow"_qs}
{u"QStackedWidget"_s, u"addWidget"_s},
{u"QToolBar"_s, u"addWidget"_s},
{u"QDockWidget"_s, u"setWidget"_s},
{u"QScrollArea"_s, u"setWidget"_s},
{u"QSplitter"_s, u"addWidget"_s},
{u"QMdiArea"_s, u"addSubWindow"_s}
};
for (const auto &m : addPageMethods) {
if (extends(name, m.first))

View File

@ -134,6 +134,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
using namespace QCss;
@ -1588,12 +1590,12 @@ public:
if (propertyIndex == -1) {
value = obj->property(name.toLatin1()); // might be a dynamic property
if (!value.isValid()) {
if (name == u"class"_qs) {
if (name == "class"_L1) {
QString className = QString::fromLatin1(obj->metaObject()->className());
if (className.contains(QLatin1Char(':')))
className.replace(QLatin1Char(':'), QLatin1Char('-'));
valueStr = className;
} else if (name == u"style"_qs) {
} else if (name == "style"_L1) {
QWidget *w = qobject_cast<QWidget *>(obj);
QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : nullptr;
if (proxy)

View File

@ -70,6 +70,8 @@
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
namespace {
class CloseButton : public QAbstractButton
{
@ -406,12 +408,12 @@ void QTabBarPrivate::init()
{
Q_Q(QTabBar);
leftB = new QToolButton(q);
leftB->setObjectName(u"ScrollLeftButton"_qs);
leftB->setObjectName(u"ScrollLeftButton"_s);
leftB->setAutoRepeat(true);
QObject::connect(leftB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs()));
leftB->hide();
rightB = new QToolButton(q);
rightB->setObjectName(u"ScrollRightButton"_qs);
rightB->setObjectName(u"ScrollRightButton"_s);
rightB->setAutoRepeat(true);
QObject::connect(rightB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs()));
rightB->hide();