aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltyperegistrar/qmltypescreator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmltyperegistrar/qmltypescreator.h')
-rw-r--r--src/qmltyperegistrar/qmltypescreator.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/qmltyperegistrar/qmltypescreator.h b/src/qmltyperegistrar/qmltypescreator.h
index 9207a64b7e..2ef4e8ff4b 100644
--- a/src/qmltyperegistrar/qmltypescreator.h
+++ b/src/qmltyperegistrar/qmltypescreator.h
@@ -45,7 +45,7 @@ public:
void setOwnTypes(QVector<QJsonObject> ownTypes) { m_ownTypes = std::move(ownTypes); }
void setForeignTypes(QVector<QJsonObject> foreignTypes) { m_foreignTypes = std::move(foreignTypes); }
void setModule(QString module) { m_module = std::move(module); }
- void setMajorVersion(int majorVersion) { m_majorVersion = majorVersion; }
+ void setVersion(QTypeRevision version) { m_version = version; }
private:
void writeClassProperties(const QmlTypesClassDescription &collector);
@@ -62,7 +62,22 @@ private:
QVector<QJsonObject> m_ownTypes;
QVector<QJsonObject> m_foreignTypes;
QString m_module;
- int m_majorVersion = 0;
+ QTypeRevision m_version = QTypeRevision::zero();
};
+QT_BEGIN_NAMESPACE
+
+// We cannot generally assume that the unspecified version is smaller than any specified one.
+// Therefore, this operator< should not move to QtCore.
+inline bool operator<(QTypeRevision lhs, QTypeRevision rhs)
+{
+ return lhs.hasMajorVersion()
+ ? (rhs.hasMajorVersion()
+ && lhs.toEncodedVersion<quint16>() < rhs.toEncodedVersion<quint16>())
+ : (rhs.hasMajorVersion()
+ || lhs.minorVersion() < rhs.minorVersion());
+}
+
+QT_END_NAMESPACE
+
#endif // QMLTYPESCREATOR_H