Use Qt::SplitBehavior in preference to QString::SplitBehavior

The Qt version was added in 5.14 "for use as eventual replacement for
QString::SplitBehavior." Move another step cloaser to that goal.

Change-Id: I3214ad6ccaca9dfd4a026589cabeb40cbf4a6298
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Edward Welbourne 2020-02-25 16:10:40 +01:00
parent be2c786498
commit 744246b112
9 changed files with 15 additions and 15 deletions

View File

@ -257,7 +257,7 @@ void QWavefrontMesh::readData()
while (!stream.atEnd()) {
stream.readLineInto(&buffer);
QVector<QStringRef> tokens = buffer.splitRef(space, QString::SkipEmptyParts);
QVector<QStringRef> tokens = buffer.splitRef(space, Qt::SkipEmptyParts);
if (tokens.size() < 2)
continue;
@ -316,7 +316,7 @@ void QWavefrontMesh::readData()
if (tokens.size() >= 4 && tokens.size() <= 5) {
{
bool ok;
QVector<QStringRef> faceTokens = tokens.at(1).split(slash, QString::SkipEmptyParts);
QVector<QStringRef> faceTokens = tokens.at(1).split(slash, Qt::SkipEmptyParts);
Q_ASSERT(!faceTokens.isEmpty());
p1 = faceTokens.at(0).toInt(&ok) - 1;
@ -336,7 +336,7 @@ void QWavefrontMesh::readData()
{
bool ok;
QVector<QStringRef> faceTokens = tokens.at(2).split(slash, QString::SkipEmptyParts);
QVector<QStringRef> faceTokens = tokens.at(2).split(slash, Qt::SkipEmptyParts);
Q_ASSERT(!faceTokens.isEmpty());
p2 = faceTokens.at(0).toInt(&ok) - 1;
@ -356,7 +356,7 @@ void QWavefrontMesh::readData()
{
bool ok;
QVector<QStringRef> faceTokens = tokens.at(3).split(slash, QString::SkipEmptyParts);
QVector<QStringRef> faceTokens = tokens.at(3).split(slash, Qt::SkipEmptyParts);
Q_ASSERT(!faceTokens.isEmpty());
p3 = faceTokens.at(0).toInt(&ok) - 1;
@ -394,7 +394,7 @@ void QWavefrontMesh::readData()
if (tokens.size() == 5) {
bool ok;
QVector<QStringRef> faceTokens = tokens.at(4).split(slash, QString::SkipEmptyParts);
QVector<QStringRef> faceTokens = tokens.at(4).split(slash, Qt::SkipEmptyParts);
Q_ASSERT(!faceTokens.isEmpty());
int p4 = faceTokens.at(0).toInt(&ok) - 1;

View File

@ -183,7 +183,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector()
: m_blockingMode(false)
{
const QString args = commandLineArguments();
const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), QString::SkipEmptyParts);
const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), Qt::SkipEmptyParts);
QStringList services;
for (const QStringRef &strArgument : lstjsDebugArguments) {
if (strArgument == QLatin1String("block")) {

View File

@ -345,7 +345,7 @@ void QQmlDebugServerImpl::parseArguments()
QString fileName;
QStringList services;
const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), QString::SkipEmptyParts);
const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), Qt::SkipEmptyParts);
for (auto argsIt = lstjsDebugArguments.begin(), argsItEnd = lstjsDebugArguments.end(); argsIt != argsItEnd; ++argsIt) {
const QStringRef &strArgument = *argsIt;
if (strArgument.startsWith(QLatin1String("port:"))) {

View File

@ -534,7 +534,7 @@ static QString joinStringRefs(const QVector<QStringRef> &refs, const QChar &sep)
*/
QStringList QQmlImports::completeQmldirPaths(const QString &uri, const QStringList &basePaths, int vmaj, int vmin)
{
const QVector<QStringRef> parts = uri.splitRef(Dot, QString::SkipEmptyParts);
const QVector<QStringRef> parts = uri.splitRef(Dot, Qt::SkipEmptyParts);
QStringList qmlDirPathsPaths;
// fully & partially versioned parts + 1 unversioned for each base path
@ -1881,7 +1881,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
#else
QLatin1Char pathSep(':');
#endif
QStringList paths = envImportPath.split(pathSep, QString::SkipEmptyParts);
QStringList paths = envImportPath.split(pathSep, Qt::SkipEmptyParts);
for (int ii = paths.count() - 1; ii >= 0; --ii)
addImportPath(paths.at(ii));
}
@ -1893,7 +1893,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_BUNDLED_LIBS_PATH"))) {
const QString envImportPath = qEnvironmentVariable("QT_BUNDLED_LIBS_PATH");
QLatin1Char pathSep(':');
QStringList paths = envImportPath.split(pathSep, QString::SkipEmptyParts);
QStringList paths = envImportPath.split(pathSep, Qt::SkipEmptyParts);
for (int ii = paths.count() - 1; ii >= 0; --ii)
addPluginPath(paths.at(ii));
}

View File

@ -7304,7 +7304,7 @@ void tst_qqmlecmascript::forInLoop()
QMetaObject::invokeMethod(object, "listProperty");
QStringList r = object->property("listResult").toString().split("|", QString::SkipEmptyParts);
QStringList r = object->property("listResult").toString().split("|", Qt::SkipEmptyParts);
QCOMPARE(r.size(), 3);
QCOMPARE(r[0],QLatin1String("0=obj1"));
QCOMPARE(r[1],QLatin1String("1=obj2"));

View File

@ -674,7 +674,7 @@ void SplineEditor::setEasingCurve(const QString &code)
return;
if (code.startsWith(QLatin1Char('[')) && code.endsWith(QLatin1Char(']'))) {
const QStringRef cleanCode(&code, 1, code.size() - 2);
const auto stringList = cleanCode.split(QLatin1Char(','), QString::SkipEmptyParts);
const auto stringList = cleanCode.split(QLatin1Char(','), Qt::SkipEmptyParts);
if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) {
QVector<qreal> realList;
realList.reserve(stringList.count());

View File

@ -179,7 +179,7 @@ QPair<QString, QString> resolveImportPath(const QString &uri, const QString &ver
{
const QLatin1Char dot('.');
const QLatin1Char slash('/');
const QStringList parts = uri.split(dot, QString::SkipEmptyParts);
const QStringList parts = uri.split(dot, Qt::SkipEmptyParts);
QString ver = version;
while (true) {

View File

@ -124,7 +124,7 @@ QStringList completeImportPaths(const QString &uri, const QString &basePath, int
static const QLatin1Char Slash('/');
static const QLatin1Char Backslash('\\');
const QVector<QStringRef> parts = uri.splitRef(QLatin1Char('.'), QString::SkipEmptyParts);
const QVector<QStringRef> parts = uri.splitRef(QLatin1Char('.'), Qt::SkipEmptyParts);
QStringList qmlDirPathsPaths;
// fully & partially versioned parts + 1 unversioned for each base path

View File

@ -354,7 +354,7 @@ bool QmlProfilerApplication::checkOutputFile(PendingRequest pending)
void QmlProfilerApplication::userCommand(const QString &command)
{
auto args = command.splitRef(QChar::Space, QString::SkipEmptyParts);
auto args = command.splitRef(QChar::Space, Qt::SkipEmptyParts);
if (args.isEmpty()) {
prompt();
return;