Commit 6eb0976e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

USe QStringView here

parent 37b955fc
Pipeline #64181 passed with stage
in 10 minutes and 52 seconds
......@@ -801,7 +801,13 @@ void CppGenerator::writeImplPropertyDependencies(const PropertyNode *node)
}
}
if (!values.isEmpty()) {
mImpl << " m" << key[0].toUpper() << key.midRef(1) << " |= " << enumType << "(" << values.join(QLatin1String(" | ")) << ");\n";
mImpl << " m" << key[0].toUpper()
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
<< QStringView(key).mid(1)
#else
<< key.midRef(1)
#endif
<< " |= " << enumType << "(" << values.join(QLatin1String(" | ")) << ");\n";
values.clear();
}
}
......@@ -809,7 +815,13 @@ void CppGenerator::writeImplPropertyDependencies(const PropertyNode *node)
}
if (!values.isEmpty()) {
mImpl << " m" << key[0].toUpper() << key.midRef(1) << " |= " << enumType << "(" << values.join(QLatin1String(" | ")) << ");\n";
mImpl << " m" << key[0].toUpper()
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
<< QStringView(key).mid(1)
#else
<< key.midRef(1)
#endif
<< " |= " << enumType << "(" << values.join(QLatin1String(" | ")) << ");\n";
}
}
......
......@@ -290,10 +290,20 @@ PropertyNode::Setter *PropertyNode::setter() const
QString PropertyNode::mVariableName() const
{
return QStringLiteral("m") + mName[0].toUpper() + mName.midRef(1);
return QStringLiteral("m") + mName[0].toUpper() +
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
QStringView(mName).mid(1);
#else
mName.midRef(1);
#endif
}
QString PropertyNode::setterName() const
{
return QStringLiteral("set") + mName[0].toUpper() + mName.midRef(1);
return QStringLiteral("set") + mName[0].toUpper() +
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
QStringView(mName).mid(1);
#else
mName.midRef(1);
#endif
}
......@@ -89,7 +89,12 @@ public:
QString mVariableName() const
{
return QStringLiteral("m") + name[0].toUpper() + name.midRef(1);
return QStringLiteral("m") + name[0].toUpper() +
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
QStringView(name).mid(1);
#else
name.midRef(1);
#endif
}
};
......
......@@ -77,11 +77,19 @@ private:
return {};
}
bool ok = false;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
const auto major = QStringView(name).left(dotIdx).toInt(&ok);
#else
const auto major = name.leftRef(dotIdx).toInt(&ok);
#endif
if (!ok) {
return {};
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 2)
const auto minor = QStringView(name).mid(dotIdx + 1).toInt(&ok);
#else
const auto minor = name.midRef(dotIdx + 1).toInt(&ok);
#endif
if (!ok) {
return {};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment