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

Fix some qt6 compile error

parent 798401bb
Pipeline #115817 passed with stage
in 5 minutes and 8 seconds
......@@ -443,7 +443,13 @@ void CppGenerator::writeImplSerializer(PropertyNode const *node, const char *str
--it;
const QString mVar = it.key();
mImpl << "(obj."
<< "m" << mVar[0].toUpper() << mVar.midRef(1) << " & " << it.value() << ")";
<< "m" << mVar[0].toUpper()
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
<< mVar.midRef(1)
#else
<< QStringView(mVar).mid(1)
#endif
<< " & " << it.value() << ")";
if (it == deps.cbegin()) {
break;
} else {
......@@ -536,10 +542,21 @@ void CppGenerator::writeImplClass(ClassNode const *node)
<< " &val)\n"
"{\n";
if (!setter->append.isEmpty()) {
mImpl << " m" << setter->append[0].toUpper() << setter->append.midRef(1) << " << val;\n";
mImpl << " m" << setter->append[0].toUpper()
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
<< setter->append.midRef(1)
#else
<< QStringView(setter->append).mid(1)
#endif
<< " << val;\n";
}
if (!setter->remove.isEmpty()) {
const QString mVar = QLatin1String("m") + setter->remove[0].toUpper() + setter->remove.midRef(1);
const QString mVar = QLatin1String("m") + setter->remove[0].toUpper()
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ setter->remove.midRef(1);
#else
+ QStringView(setter->remove).mid(1);
#endif
mImpl << " auto it = std::find(" << mVar << ".begin(), " << mVar
<< ".end(), val);\n"
" if (it != "
......
......@@ -106,7 +106,11 @@ QString ClassNode::parentClassName() const
Q_UNREACHABLE();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ClassNode::ClassType ClassNode::elementNameToType(const QStringRef &name)
#else
ClassNode::ClassType ClassNode::elementNameToType(QStringView name)
#endif
{
if (name == QLatin1String("class")) {
return Class;
......@@ -174,8 +178,11 @@ EnumNode::EnumType EnumNode::enumType() const
{
return mEnumType;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
EnumNode::EnumType EnumNode::elementNameToType(const QStringRef &name)
#else
EnumNode::EnumType EnumNode::elementNameToType(QStringView name)
#endif
{
if (name == QLatin1String("enum")) {
return TypeEnum;
......
......@@ -72,7 +72,11 @@ public:
QString parentClassName() const;
QVector<PropertyNode const *> properties() const;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
static ClassType elementNameToType(const QStringRef &name);
#else
static ClassType elementNameToType(QStringView name);
#endif
private:
QString mName;
......@@ -117,9 +121,11 @@ public:
QString name() const;
EnumType enumType() const;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
static EnumType elementNameToType(const QStringRef &name);
#else
static EnumType elementNameToType(QStringView name);
#endif
private:
QString mName;
EnumType mEnumType;
......
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