aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-08-21 18:34:21 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-09-26 12:32:17 +0200
commitcc1a604c704f848927b3fa0a97b0a50b0b79d2a4 (patch)
tree610ece713eba021c8e5a3d248f54a62370e810f8 /src/qml/types
parent531cf90305ae50920b2e597dd0758fdb82ad88b0 (diff)
Specify parameters of type registration in class declarations
Using this technique we can automatically register all necessary revisions and minor versions of a type, using the metaobject system. This greatly reduces the potential for mistakes and resulting incompatibilities between versions of imports. We assume that for each type we need to register all revisions of its super types and its attached type, and that the revisions match. That is, if you import version X of type A, you will also get version X of its attached type and of any super types. As we previously didn't take these dependencies into account when manually registering the types, a number of extra revisions are now registered for some types. Potentially, we can now generate the qmltypes files at compile time, using moc. Change-Id: I7abb8a5c39f5e63ad1a0cb41a783f2c91909491b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmlbind_p.h1
-rw-r--r--src/qml/types/qqmlconnections_p.h8
-rw-r--r--src/qml/types/qqmltimer_p.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h
index 22007a3d25..e7c7e01a0d 100644
--- a/src/qml/types/qqmlbind_p.h
+++ b/src/qml/types/qqmlbind_p.h
@@ -81,6 +81,7 @@ private:
Q_PROPERTY(RestorationMode restoreMode READ restoreMode WRITE setRestoreMode
NOTIFY restoreModeChanged REVISION 14)
Q_ENUM(RestorationMode)
+ QML_NAMED_ELEMENT(Binding)
public:
QQmlBind(QObject *parent=nullptr);
diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h
index 5d28e8e8be..7bf688cf75 100644
--- a/src/qml/types/qqmlconnections_p.h
+++ b/src/qml/types/qqmlconnections_p.h
@@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT QQmlConnections : public QObject, public QQmlParserStatu
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged REVISION 3)
Q_PROPERTY(bool ignoreUnknownSignals READ ignoreUnknownSignals WRITE setIgnoreUnknownSignals)
+ QML_NAMED_ELEMENT(Connections)
public:
QQmlConnections(QObject *parent=nullptr);
@@ -106,6 +107,13 @@ public:
void applyBindings(QObject *object, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
};
+// TODO: We won't need Connections to be a custom type anymore once we can drop the
+// automatic signal handler inference from undeclared properties.
+template<>
+inline QQmlCustomParser *qmlCreateCustomParser<QQmlConnections>()
+{
+ return new QQmlConnectionsParser;
+}
QT_END_NAMESPACE
diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h
index 0160e97a2f..0cd93e4659 100644
--- a/src/qml/types/qqmltimer_p.h
+++ b/src/qml/types/qqmltimer_p.h
@@ -72,6 +72,7 @@ class Q_QML_PRIVATE_EXPORT QQmlTimer : public QObject, public QQmlParserStatus
Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating NOTIFY repeatChanged)
Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart NOTIFY triggeredOnStartChanged)
Q_PROPERTY(QObject *parent READ parent CONSTANT)
+ QML_NAMED_ELEMENT(Timer)
public:
QQmlTimer(QObject *parent=nullptr);