diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-11 14:04:17 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-13 18:34:15 +0200 |
commit | a5b9600356cb8941a2d9685975b2454837b5e6ed (patch) | |
tree | efecf045643824fe74d088d4b8bb8302b014bf96 /src/gui/util | |
parent | 2e29f55f76e49c1fbffd2af51ec19d59b87f0e72 (diff) |
QtGui: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.
Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qgridlayoutengine.cpp | 6 | ||||
-rw-r--r-- | src/gui/util/qktxhandler.cpp | 4 | ||||
-rw-r--r-- | src/gui/util/qundostack.cpp | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp index d875db0da6..10c6944600 100644 --- a/src/gui/util/qgridlayoutengine.cpp +++ b/src/gui/util/qgridlayoutengine.cpp @@ -1190,9 +1190,9 @@ void QGridLayoutEngine::dump(int indent) const QString message = QLatin1String("[ "); for (int column = 0; column < internalGridColumnCount(); ++column) { message += QString::number(q_items.indexOf(itemAt(row, column))).rightJustified(3); - message += QLatin1Char(' '); + message += u' '; } - message += QLatin1Char(']'); + message += u']'; qDebug("%*s %s", indent, "", qPrintable(message)); } @@ -1217,7 +1217,7 @@ void QGridLayoutEngine::dump(int indent) const message += QLatin1String((message.isEmpty() ? "[" : ", ")); message += QString::number(cellPos->at(i)); } - message += QLatin1Char(']'); + message += u']'; qDebug("%*s %s %s", indent, "", (pass == 0 ? "rows:" : "columns:"), qPrintable(message)); cellPos = &q_xx; } diff --git a/src/gui/util/qktxhandler.cpp b/src/gui/util/qktxhandler.cpp index c1bf04f3ef..5966d38446 100644 --- a/src/gui/util/qktxhandler.cpp +++ b/src/gui/util/qktxhandler.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #define KTX_IDENTIFIER_LENGTH 12 static const char ktxIdentifier[KTX_IDENTIFIER_LENGTH] = { '\xAB', 'K', 'T', 'X', ' ', '1', '1', '\xBB', '\r', '\n', '\x1A', '\n' }; static const quint32 platformEndianIdentifier = 0x04030201; @@ -237,7 +239,7 @@ QMap<QByteArray, QByteArray> QKtxHandler::decodeKeyValues(QByteArrayView view) c // To separate the key and value we convert the complete data to utf-8 and find the first // null terminator from the left, here we split the data into two. const auto str = QString::fromUtf8(view.constData() + offset, keyAndValueByteSize); - const int idx = str.indexOf(QLatin1Char('\0')); + const int idx = str.indexOf('\0'_L1); if (idx == -1) continue; diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp index f5757c1704..c4dcc68049 100644 --- a/src/gui/util/qundostack.cpp +++ b/src/gui/util/qundostack.cpp @@ -302,7 +302,7 @@ QString QUndoCommand::actionText() const void QUndoCommand::setText(const QString &text) { - int cdpos = text.indexOf(QLatin1Char('\n')); + int cdpos = text.indexOf(u'\n'); if (cdpos > 0) { d->text = text.left(cdpos); d->actionText = text.mid(cdpos + 1); @@ -1044,7 +1044,7 @@ void QUndoStackPrivate::setPrefixedText(QAction *action, const QString &prefix, if (defaultText.isEmpty()) { QString s = prefix; if (!prefix.isEmpty() && !text.isEmpty()) - s.append(QLatin1Char(' ')); + s.append(u' '); s.append(text); action->setText(s); } else { |