From 748e759df8cb17e26f155734e62b360d711e867e Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Fri, 8 Apr 2022 14:54:18 +0200 Subject: [PATCH] QtCore: stop using QLatin1Char constructor for creating char literals Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: Ibe32a11699f67df2aa80505ba2944f33e5e823e0 Reviewed-by: Marc Mutz --- src/corelib/io/qdir.h | 8 ++--- src/corelib/io/qfileselector_p.h | 2 +- src/corelib/io/qsettings_p.h | 2 +- src/corelib/serialization/qxmlstream.g | 2 +- .../serialization/qxmlstreamparser_p.h | 2 +- src/corelib/text/qstring.h | 32 +++++++++---------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index 7d7a483eae..9fd144c667 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -225,18 +225,18 @@ public: constexpr static inline QChar listSeparator() noexcept { #if defined(Q_OS_WIN) - return QLatin1Char(';'); + return u';'; #else - return QLatin1Char(':'); + return u':'; #endif } static QChar separator() { #if defined(Q_OS_WIN) - return QLatin1Char('\\'); + return u'\\'; #else - return QLatin1Char('/'); + return u'/'; #endif } diff --git a/src/corelib/io/qfileselector_p.h b/src/corelib/io/qfileselector_p.h index 024d0b190d..49022908b0 100644 --- a/src/corelib/io/qfileselector_p.h +++ b/src/corelib/io/qfileselector_p.h @@ -71,7 +71,7 @@ public: static QStringList platformSelectors(); static void addStatics(const QStringList &); //For loading GUI statics from other Qt modules static QString selectionHelper(const QString &path, const QString &fileName, - const QStringList &selectors, const QChar &indicator = QLatin1Char('+')); + const QStringList &selectors, const QChar &indicator = u'+'); QFileSelectorPrivate(); QString select(const QString &filePath) const; diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index 14b3040c14..a179afe8d4 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -141,7 +141,7 @@ inline QString QSettingsGroup::toString() const QString result; result = str; if (num > 0) { - result += QLatin1Char('/'); + result += u'/'; result += QString::number(num); } return result; diff --git a/src/corelib/serialization/qxmlstream.g b/src/corelib/serialization/qxmlstream.g index 9177818778..5e35576cd0 100644 --- a/src/corelib/serialization/qxmlstream.g +++ b/src/corelib/serialization/qxmlstream.g @@ -1071,7 +1071,7 @@ literal_content_start ::= SPACE; /. case $rule_number: if (normalizeLiterals) - textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); + textBuffer.data()[textBuffer.size()-1] = u' '; break; ./ diff --git a/src/corelib/serialization/qxmlstreamparser_p.h b/src/corelib/serialization/qxmlstreamparser_p.h index 9a46bdedac..e73a0f4a50 100644 --- a/src/corelib/serialization/qxmlstreamparser_p.h +++ b/src/corelib/serialization/qxmlstreamparser_p.h @@ -695,7 +695,7 @@ bool QXmlStreamReaderPrivate::parse() case 173: if (normalizeLiterals) - textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); + textBuffer.data()[textBuffer.size()-1] = u' '; break; case 174: diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 266627c331..e26547a1f1 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -532,35 +532,35 @@ public: [[nodiscard]] inline QChar &back(); [[nodiscard]] QString arg(qlonglong a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(qulonglong a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(long a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(ulong a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(int a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(uint a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(short a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(ushort a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(double a, int fieldWidth = 0, char format = 'g', int precision = -1, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(char a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(QChar a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; #if QT_STRINGVIEW_LEVEL < 2 [[nodiscard]] QString arg(const QString &a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; #endif [[nodiscard]] QString arg(QStringView a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; [[nodiscard]] QString arg(QLatin1StringView a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const; + QChar fillChar = u' ') const; private: template struct is_convertible_to_view_or_qstring_helper @@ -691,8 +691,8 @@ public: bool isUpper() const; bool isLower() const; - [[nodiscard]] QString leftJustified(qsizetype width, QChar fill = QLatin1Char(' '), bool trunc = false) const; - [[nodiscard]] QString rightJustified(qsizetype width, QChar fill = QLatin1Char(' '), bool trunc = false) const; + [[nodiscard]] QString leftJustified(qsizetype width, QChar fill = u' ', bool trunc = false) const; + [[nodiscard]] QString rightJustified(qsizetype width, QChar fill = u' ', bool trunc = false) const; #if !defined(Q_CLANG_QDOC) [[nodiscard]] QString toLower() const &