aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-05-27 18:01:32 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-05-28 09:57:07 +0200
commit467be7ed0954618eee19d90f758f51c10802c9be (patch)
tree864e316ddebebe84932c854f458f3f297b81ddab
parent27c0034d6bb0df50d4479e42fc82fcd74b03d810 (diff)
qmltyperegistrar: Preserve isQProperty flag from metatypes
Task-number: QTBUG-76025 Change-Id: I952afdad6410c3f7ccb05b6c3de77020b30f78d3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
-rw-r--r--src/qmltyperegistrar/qmltypescreator.cpp2
-rw-r--r--tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp9
-rw-r--r--tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h5
3 files changed, 14 insertions, 2 deletions
diff --git a/src/qmltyperegistrar/qmltypescreator.cpp b/src/qmltyperegistrar/qmltypescreator.cpp
index 34e3e053a8..6b1901bfa7 100644
--- a/src/qmltyperegistrar/qmltypescreator.cpp
+++ b/src/qmltyperegistrar/qmltypescreator.cpp
@@ -162,6 +162,8 @@ void QmlTypesCreator::writeProperties(const QJsonArray &properties, QSet<QString
const auto it = obj.find(QLatin1String("revision"));
if (it != obj.end())
m_qml.writeScriptBinding(QLatin1String("revision"), QString::number(it.value().toInt()));
+ const bool isQProperty = obj[QLatin1String("isQProperty")].toBool();
+ m_qml.writeBooleanBinding(QLatin1String("isQProperty"), isQProperty);
writeType(obj, QLatin1String("type"), !obj.contains(QLatin1String("write")), true);
m_qml.writeEndObject();
diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp
index bf71835e43..ea918af740 100644
--- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp
+++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp
@@ -70,8 +70,8 @@ void tst_qmltyperegistrar::superAndForeignTypes()
QVERIFY(qmltypesData.contains("values: [\"Pixel\", \"Centimeter\", \"Inch\", \"Point\"]"));
QVERIFY(qmltypesData.contains("name: \"SizeGadget\""));
QVERIFY(qmltypesData.contains("prototype: \"SizeEnums\""));
- QVERIFY(qmltypesData.contains("Property { name: \"height\"; type: \"int\" }"));
- QVERIFY(qmltypesData.contains("Property { name: \"width\"; type: \"int\" }"));
+ QVERIFY(qmltypesData.contains("Property { name: \"height\"; isQProperty: false; type: \"int\" }"));
+ QVERIFY(qmltypesData.contains("Property { name: \"width\"; isQProperty: false; type: \"int\" }"));
QVERIFY(qmltypesData.contains("Method { name: \"sizeToString\"; type: \"string\" }"));
}
@@ -81,4 +81,9 @@ void tst_qmltyperegistrar::accessSemantics()
QVERIFY(qmltypesData.contains("accessSemantics: \"value\""));
}
+void tst_qmltyperegistrar::isQProperty()
+{
+ QVERIFY(qmltypesData.contains("Property { name: \"someProperty\"; isQProperty: true; type: \"int\" }"));
+}
+
QTEST_MAIN(tst_qmltyperegistrar)
diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h
index c8d6e04f0a..840a22658c 100644
--- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h
+++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h
@@ -32,6 +32,7 @@
#include "foreign.h"
#include <QtQml/qqml.h>
+#include <QtCore/qproperty.h>
class SizeEnums
{
@@ -66,6 +67,7 @@ class Local : public Foreign
{
Q_OBJECT
QML_ELEMENT
+ Q_PROPERTY(int someProperty)
public:
enum Flag {
Flag1 = 0x1,
@@ -75,6 +77,8 @@ public:
};
Q_DECLARE_FLAGS(Flags, Flag)
Q_FLAG(Flags)
+
+ QProperty<int> someProperty;
};
class tst_qmltyperegistrar : public QObject
@@ -89,6 +93,7 @@ private slots:
void qmltypesHasFlags();
void superAndForeignTypes();
void accessSemantics();
+ void isQProperty();
private:
QByteArray qmltypesData;