Replace QT_USE_FAST_{OPERATOR_PLUS,CONCATENTION} by QT_USE_QSTRINGBUILDER

QT_USE_FAST_CONCATENATION doesn't do anything nowadays.

Using QT_USE_QSTRINGBUILDER is the same as QT_USE_FAST_OPERATOR_PLUS
for QStrings and enables more QStringBuilder use for QByteArrays.

Change-Id: Ibd297817c50d86661d47822799f989447249af1b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-08-06 14:02:05 +02:00
parent e69d90bc1a
commit 52b2ca55c9
16 changed files with 44 additions and 51 deletions

View File

@@ -22,8 +22,7 @@
"-DQT_NO_CAST_TO_ASCII",
"-DQT_RESTRICTED_CAST_FROM_ASCII",
"-DQT_DISABLE_DEPRECATED_BEFORE=0x050600",
"-DQT_USE_FAST_OPERATOR_PLUS",
"-DQT_USE_FAST_CONCATENATION",
"-DQT_USE_QSTRINGBUILDER",
"-DSRCDIR=\"C:/qt-creator/src/plugins/cpptools\"",
"-DQT_QML_DEBUG",
"-DQT_PLUGIN",

View File

@@ -427,11 +427,11 @@ static void enumTestCase(const QByteArray &tag, const QByteArray &source,
QTest::newRow(tag) << fullSource << (prefix + "val")
<< QStringList({"val1", "val2", "val3"});
QTest::newRow(tag + "_cxx11") << fullSource << (prefix + "E::")
QTest::newRow(QByteArray{tag + "_cxx11"}) << fullSource << QByteArray{prefix + "E::"}
<< QStringList({"E", "val1", "val2", "val3"});
fullSource.replace("enum E ", "enum ");
QTest::newRow(tag + "_anon") << fullSource << (prefix + "val")
QTest::newRow(QByteArray{tag + "_anon"}) << fullSource << QByteArray{prefix + "val"}
<< QStringList({"val1", "val2", "val3"});
}

View File

@@ -1,5 +1,3 @@
# DEFINES += QT_USE_FAST_OPERATOR_PLUS
# DEFINES += QT_USE_FAST_CONCATENATION
# CONFIG += single
include(../../qtcreatorplugin.pri)

View File

@@ -395,15 +395,16 @@ PerfConfigEventsModel::EventDescription PerfConfigEventsModel::parseEvent(
if (!extras.isEmpty()) {
QMetaEnum operationMeta = QMetaEnum::fromType<Operation>();
int operation = operationMeta.keyToValue(QByteArray("Operation")
+ extras.takeFirst().toLatin1());
int operation = operationMeta.keyToValue(
QByteArray{"Operation" + extras.takeFirst().toLatin1()});
if (operation != -1)
description.operation = operation;
}
if (!extras.isEmpty()) {
QMetaEnum resultMeta = QMetaEnum::fromType<Result>();
int result = resultMeta.keyToValue(QByteArray("Result") + extras.takeFirst().toLatin1());
int result = resultMeta.keyToValue(
QByteArray{"Result" + extras.takeFirst().toLatin1()});
if (result != -1)
description.result = Result(result);
}

View File

@@ -402,7 +402,7 @@ QString saveImageFileFilter()
{
const auto imageFormats = QImageWriter::supportedImageFormats();
const QByteArrayList supportedFormats = Utils::transform(imageFormats, [](const QByteArray &in)
{ return QByteArray("*.") + in; });
{ return QByteArray{"*." + in}; });
return MainWidget::tr("Images (%1)").arg(QString::fromUtf8(supportedFormats.join(' ')));
}