aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-08-10 13:43:42 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-14 11:51:06 +0000
commitdea5b8b611e4f1a385e9fe4bee5991fc9adcd888 (patch)
treee7b63858897eb3f36d5d50a25fadd00da683aadd /src/qml/types
parent22baf58174515a8886eb0f6fec7238b8e7df72fb (diff)
Fix revision of Connections.enabled property
The enabled property was added with QtQuick/QtQml 2.3 as part of Qt 5.7, but due to multiple bugs, the property became visible across all versions, breaking lookup as outlined in the linked task. The first issue was that property revisioning needs to be specified via the REVISION tag inside Q_PROPERTY, not using Q_REVISION. The second issue was that in type registration the unversioned type must be registered first followed by the revisions. Otherwise the call to QQmlMetaType::qmlType(const QMetaObject *metaObject, const QHashedStringRef &module, int version_major, int version_minor) that will look through the metaObjectToType multi-hash will find the last inserted type first and that satisfies the minor version requiremend. In the case of the Connections type, that would be the base version registered last with qmlRegisterCustomType<QQmlConnections>(uri, versionMajor, versionMinor,"Connections", new QQmlConnectionsParser); Lastly, if we were to just call that one first and then register revision 1 afterwards, then only the first version would have a custom parser attached and we would fail to process the bindings correctly if using the newer revision. So to fix this, we introduce another private qmlRegisterCustomType specialization that includes a meta object revision, thus allowing us to register the Connections type in the correct order and both with a customer parser. That's not ideal, but also not worse than the previous three registration and it fixes the visibility. [ChangeLog][QtQml][Connections] Fixed the visibility of the enabled property to only appear when importing QtQml/QtQuick >= 2.3, which was introduced with Qt 5.7. Otherwise it would accidentally shadow for example an "enabled" context property. Task-number: QTBUG-69884 Change-Id: I888374d96f19502466358df81007bcb3c65d3a79 Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmlconnections_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h
index 6b063d5602..bd03d7e152 100644
--- a/src/qml/types/qqmlconnections_p.h
+++ b/src/qml/types/qqmlconnections_p.h
@@ -69,7 +69,7 @@ class Q_AUTOTEST_EXPORT QQmlConnections : public QObject, public QQmlParserStatu
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
- Q_REVISION(1) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged REVISION 1)
Q_PROPERTY(bool ignoreUnknownSignals READ ignoreUnknownSignals WRITE setIgnoreUnknownSignals)
public: