aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.h
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Integrate sequences with registration macrosUlf Hermann2020-11-111-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | You get to write QML_SEQUENTIAL_CONTAINER(value_type) now, and qmltyperegistrar will generate a sensible registration call from that. A registration might look like this: struct MyStringListForeign { Q_GADGET QML_ANONYMOUS QML_SEQUENTIAL_CONTAINER(QString) QML_FOREIGN(MyStringList) QML_ADDED_IN_VERSION(3, 1) }; It's unfortunate that we need to use a metaobject to transfer all of this information, but there is no other sensible way. Transform the containers defined in qv4sequenceobject.cpp to use the new style, and move them out of the builtins, into QtQml. Recognize that only one of them was ever tested, and add tests for the rest. Task-number: QTBUG-82443 Change-Id: I3a30f9e27266bb575eea26c5daf5dad1ec461cc5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Allow singleton types to be extendedUlf Hermann2020-11-021-6/+10
| | | | | | | | | It seems we never stated that singletons can not be extended in our documentation. Therefore this is technically a bug fix and doesn't need separate documentation. Change-Id: I7877289bd5a52ecf709f80ba1975137981ec65f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Allow namespaces as extensions to typesUlf Hermann2020-11-021-6/+19
| | | | | | | | | | | | | | | | | This way we can access the enums of namespaces as properties of the primary type. This is achieved by: 1. Making enums of extended types available in the base type 2. Allowing the extension to be specified as plain metaObject rather than as type name. 3. Refraining from creating the extension if the create function does not exist. The goal of this is to declare the Qt namespace in a civilized way, but will also help with cleaning up the QtQuick value types and their enums. Change-Id: I13399741d30ce38d1bff753cfa1b11e72ccfbf6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use factory functions and ctors for creating value typesUlf Hermann2020-10-021-0/+14
| | | | | | | | | | As you can extend value types with QML_EXTENDED we may as well allow a factory function in the extended type. Furthermore, if the original type allows construction from QJSValue, we may just use that. In turn, we can get rid of the value type providers now. Change-Id: I9124ea47537eab6c33d7451080ab2fff942eaa7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Rewrite qv4sequenceobject based on QMetaSequenceUlf Hermann2020-10-021-0/+16
| | | | | | | | | | This avoids the template explosion and makes the mechanism extendable. You can now register additional anonymous sequential containers. Fixes: QTBUG-71574 Task-number: QTBUG-82443 Change-Id: I5b9ed9af1533a3b7df8fc5bb37bbb73b8304e592 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow proper registration of value typesUlf Hermann2020-09-231-57/+72
| | | | | | | | | | | | | | | | | | | | You can now have an extension object on a value type that offers additional properties. This is how we model the QtQuick value types. It allows us to retrieve the extension's metaobject without using the virtual functions in the value type provider. As before, this mechanism is still rather dangerous and not fit for public consumption. It relies on the extension object having exactly the same layout as the original value type, and it hides any properties the original value type might expose. Furthermore we enforce now that gadgets should have lowercase names. The ones that didn't before are split up into an anonymous value type and a namespace that contains all the addressable bits. Task-number: QTBUG-82443 Change-Id: Ic93d6764538d6ccc0774b3c5648eee08ba0939c0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove superfluous namespace and exportsFabian Kosmale2020-08-311-23/+7
| | | | | | | | | [ChangeLog][QtQml] The functions qmlExecuteDeferred, qmlContext and qmlEngine are no longer available in the QtQml namespace. Use their counterparts in the global namespace. Change-Id: Ife1ea83ca1d474420c9ee697772b7115247cc400 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove deprecated registration functionsFabian Kosmale2020-08-271-42/+0
| | | | | | | | | | | | | | [ChangeLog][QML] Removed qmlRegisterType overload taking no arguments, use qmlRegisterAnonymousType instead, or switch to declarative type registration with QML_ANONYMOUS. Removed overloads of qmlRegisterExtendedType and qmlRegisterInterface which did not take a version argument. Use the overloads providing a version, or swtich to declarative type registration with QML_EXTENDED and QML_INTERFACE. Change-Id: Iadcc53d7ebe5cae40856b69efc33293fd0208c1f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* import Qt namespace in QtQmlFawzi Mohamed2020-08-271-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | Introduces and uses the QML_FOREIGN_NAMESPACE to declare the Qt namespace in QtQml, and exports all the enumerations in the Qt namespace, and makes them available also in QtQml/plugins.qmltypes Please note that this does *not* remove the special QV4::QtObject as it contains much more than the enumerations. Having two object registered as Qt (the complete QV4::QtObject added to the global properties in ExecutionEngine::initializeGlobal, and QtInQml registered by the qmltyperegistrar) gives problems, if the partial one overrides the complete one. For this reason the classinfo QML.ManualRegistration (no public macro until shown to be more generally useful) is introduced and used to ensure that QtInQml generates only documentation (plugins.qmltypes), and no registration that might conflict with QtObject. This makes the current builtins.qmltypes redundant. Fixes: QTBUG-84897 Change-Id: Iffc96cd3e1d9f9d7d047ee60221a4b0928f53005 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove deprecated functions involving attached property IDsFabian Kosmale2020-08-251-7/+0
| | | | | | | | | | | [ChangeLog][QML] The deprecated functions qmlAttachedPropertiesObjectById and qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool) have been removed. Use the qmlAttachedPropertiesObject(QObject *, QQmlAttachedPropertiesFunc, bool) overload of qmlAttachedPropertiesObject instead. Change-Id: I6bc8315557733dc2f51b2ffdebeec51873b74b2b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add userdata callback to qml registrationMaximilian Goldstein2020-07-101-22/+17
| | | | | | | This is needed in order to remove PySide2's qml type limit. Change-Id: I331d9e31574a744eb9085222d58ea8a8789e0e31 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-251-16/+14
| | | | | | Task-number: QTBUG-84469 Change-Id: I4c3353c00a566023503fbc178ba8454391dc334c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-241-2/+14
| | | | | | | | | | | | | You can now import the latest version, a specific version, or, "auto" which is the same version as the parent module. [ChangeLog][QtQml] You can now procedurally add module imports to modules, using qmlRegisterModuleImport(). However, actual import statements in qmldir files should be preferred wherever possible. Fixes: QTBUG-84899 Change-Id: I3b32dd8b07a19d31b6538b9a6bb436840862f345 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add methods to programatically insert qmldir import statementsUlf Hermann2020-06-091-0/+3
| | | | | | | We need this for controls2 to select the style at runtime. Change-Id: I23b6ab962a647b519d5af019eade27f89e1e4e00 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-05-151-2/+1
|\ | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktextedit/BLACKLIST Change-Id: If1868d27ea40fdc206971c2f7a24e91c5e62b1bf
| * Merge remote-tracking branch 'origin/5.14' into 5.15.0Qt Forward Merge Bot2020-04-271-2/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqml.h Change-Id: I34295e4ea3fc9ec2a42cb93df498d54a5583ddf1
| | * Generate the docs for qmlRegisterSingletonInstance5.14Giuseppe D'Angelo2020-04-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | I think qdoc is once more confused by the mismatch between the actual declaration and the signature in the \fn macro. Change-Id: I25d1be71ffdfc20961e23e06e9132ed09d1e29d0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Register value types declarativelyUlf Hermann2020-04-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | For now this has the effect of adding them to the .qmltypes files. In the future, the registration shall actually add additional value types you can declare as properties in QML. Change-Id: Ifee5a8ec054f35cc7bd07eb992a136730be68da7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-04-221-0/+5
|\| | | | | | | | | | | Change-Id: Iafb7061945e011542fbf0f6ebe776f0a4187b0a4
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-04-201-0/+5
| |\| | | | | | | | | | Change-Id: I5d7acb2a3883104d6002f147b58977ff58aa3383
| | * Make qdoc generate the documentation for qmlRegisterSingletonTypeGiuseppe D'Angelo2020-04-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | I *guess* it wasn't find the "dummy" signature spelled in the docs, but only the actual one (with SFINAE), so the overload ended up being undocumented. Change-Id: I3c48057860c83dc78107e87b93616415976e802f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | qqml.h: do not use QML_REGISTER_TYPE(QObject)Fabian Kosmale2020-03-251-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This breaks code if the following circumstances all apply: - A project is compiled with CMake using AUTOMOC - It contains a class with a property of type QQmlList<QObject> - In the resulting mocs_compilation.cpp, qqml.h is (transitively included). Then, a use of QMetaTypeId<QQmlList<QObject>> will be in a single file before its definition. The use comes from the instation of qt_metaTypeArray. The explicit specialization comes from QMetaTypeID, and happens afterwards (depending on include order). gcc does not like this, and the compilation fails. There is probably no reason for QML_REGISTER_TYPE(QObject), so we just remove it. Removes the Q_DECLARE_METATYPE(QVariant), too, while we're at it. Change-Id: Ia6607c31af92dadd809633188bb82fa90efaf922 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-201-0/+5
|\| | | | | | | | | | | Change-Id: I6f320ea43b5837444226228c118e57c4bda8702a
| * | qmlRegisterSingletonInstance: show user-friendly signature in documentationFabian Kosmale2020-03-181-0/+5
| | | | | | | | | | | | | | | Change-Id: I50ee4c014acf3f95d00a38c6d115776143688c8e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Clean up type registration structsUlf Hermann2020-03-121-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * reset all structVersions to 0, removing checks for higher versions * add structVerions where they are missing * consistently check for compatibility in qqmlmetatype.cpp * remove unused members * rename RegisterSingletonFunctor Fixes: QTBUG-82241 Change-Id: I74f1876b3298dbb60ff7cfab8c13e8ad4f9f8cdc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Optionally return type IDs from qmlRegisterTypeAndRevisions()Ulf Hermann2020-03-111-17/+25
| | | | | | | | | | | | | | | | | | | | | | | | This allows us to save the type IDs and later unregister the types in qmltyperegistrar-generated code. Change-Id: Id1bc73e2832c6d76e513ee3ee267b8d52e3851da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Adapt to the the new QMetaType changeOlivier Goffart2020-03-091-70/+37
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-82453 Change-Id: I7e5682945a07c3af183becd3947a69568f139d16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-091-0/+32
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| * | Provide a way to statically register namespacesUlf Hermann2020-02-251-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, qmltyperegistrar would stumble over any QML_* macros in namespaces, as the namespaces could not be used as template arguments. However, namespaces are intended to be usable by QML as uncreatable "types". Now, qmltyperegistrar checks the namespace flag that moc records in the JSON output, and if that is given, registers an uncreatable metaobject instead of a type. Therefore you can use QML_ELEMENT and friends to register namespaces, just like you would register classes (except that they're implicitly uncreatable, of course). Task-number: QTBUG-68796 Change-Id: I186d7e9425471c32fb1a1f29c0c0b946afb2a9d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-171-10/+61
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/qtqml/plugin.cpp src/qml/qml/qqml.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypeloader.cpp src/qml/types/qqmlbind.cpp src/quick/items/qquickitemsmodule.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
| * | Provide a macro for qmlRegisterTypeNotAvailableUlf Hermann2020-02-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That is, register QQmlTypeNotAvailable as foreign type under the name given as parameter. Also, statically register QQuickAnimatedImage as unavailable in case of !quick_animatedimage and register it for the right version. Task-number: QTBUG-68796 Change-Id: I2ea292d2aeda66d8ce43b3bccbd3d21663330bd6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Add a static variant of qmlRegisterInterface()Ulf Hermann2020-02-121-6/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qmlRegisterInterface() should not be called procedurally, for the same reason that qmlRegisterType() should not be called procedurally. Also, add URI and major version parameters to qmlRegisterInterface(), and deprecate the typeName parameter. We want to identify which import an interface belongs to. Task-number: QTBUG-68796 Change-Id: Iba3d66e5ce6219b30aadba34396f12fca92f35a7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * | Add uri and version parameters to qmlRegisterExtendedType()Ulf Hermann2020-02-121-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | We want to know which module a registration belongs to, even if the type is uncreatable. Change-Id: I8c417eeca2c0bfa186df43edc0c2f455ed0880e6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* | | Process major versions as part of Q_REVISIONUlf Hermann2020-02-131-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | Retrieve the major version from the meta object revisions and use them to register types and generate qmltypes files. Change-Id: I35da8963457660d1a49ba9063574e1a68057a7ba Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-36/+36
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-041-2/+6
|\| | | | | | | | | | | | | | | Conflicts: src/imports/qtquick2/plugins.qmltypes src/quick/items/qquickitemsmodule.cpp Change-Id: I841c65c9c131354788b4f3fcfe3d7ed27be316d5
| * Fix deprecation macros in qqml.hUlf Hermann2019-09-181-2/+6
| | | | | | | | | | | | | | | | | | | | Give a friendly message for qmlAttachedPropertiesObject(int ...) and disable plain qmlRegisterType<Foo>() if QT_DEPRECATED_SINCE(5, 14). Change-Id: I9373f38fdddcb58ec1211b6cab492e1bc5370e52 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Specify parameters of type registration in class declarationsUlf Hermann2019-09-261-20/+93
|/ | | | | | | | | | | | | | | | | | | | | 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>
* Drop default parameter for qmlRegisterAnonymousTypeUlf Hermann2019-09-051-2/+2
| | | | | | | | People already feel compelled to misuse it. Change-Id: I7da0745f9cc3b6081f3237213e57c3cd084bfe4d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qqml.h: add qmlRegisterAnonymousTypeFabian Kosmale2019-08-211-2/+8
| | | | | | | | | This version behaves for the most part like qmlRegisterType(), but it adds a uri and major version, which qmlplugindump can use to put the tpyes into the correct plugins.qmltyes file. Change-Id: I50f620216439a3edc66ac740cb051c2fbb936e51 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Introduce qmlRegisterSingletonInstanceFabian Kosmale2019-07-191-0/+9
| | | | | | | | | | This method is intended as a replacement for common setContextProperty use cases, where the user is only using one single engine and has already created the object. Task-number: QTBUG-73064 Change-Id: Ib9ec023a0ad679aa22e90ebcb4a0c07622459c61 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* add std::function overload to qmlRegisterSingletonTypeFabian Kosmale2019-06-111-3/+22
| | | | | | | | | | | | | | | | | | | | | | This changes enables passing stateful lambdas to qmlRegisterSingletonType, which helps when porting away from setContextProperty. Unfortunately, we cannot directly add an overload for std::function, as this causes ambiguity in the overload set when a lambda of the form auto f = [](QQmlEngine*, QJSEngine*) -> QObject* is passed to the function (which is what the examples do) We therefore use a template to support abribtrary callables f, then SFINAE them out if f is not convertible to the desired std::function, or when f is convertible to a plain C function pointer, thus removing the ambiguity Change-Id: I6ca95ad692d8bb785e420b85bf3d8c1d0007ce17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-111-3/+6
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4value_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmltypewrapper.cpp src/quick/items/qquicktableview.cpp Change-Id: I684f8e01a711580512848bf1253f39b39fcbf4c7
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-261-3/+6
| |\ | | | | | | | | | Change-Id: I208cd36d2b7add94f36e4d86cf0c790a1e4a7e86
| | * Re-add cache for looking up attached properties objectsUlf Hermann2019-05-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c018df5b4075ae962966d4df7653d476dab02840 removed an optimization in qmlAttachedPropertiesObject. The attached properties ID was implicitly cached as it was static in a method templated by the type the attached properties were registered for. We don't actually need the ID for this, as we can also cache the function pointer. Fixes: QTBUG-75609 Change-Id: I15e728ce4bbb89062a84ee6f113b1188faa32b92 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Mark functions involving attached property IDs as deprecatedUlf Hermann2019-04-301-3/+5
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-75176 Change-Id: I969e7987ebf8b98aed9ba9e17388a0e168ef5e09 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-231-2/+7
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: Ieff61c076e46eb50a059c8b0210f7f4d7ce0cbcf
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-191-2/+7
| |\| | | | | | | | | | Change-Id: I9ef4be23bfe35aa48d4c65d4159e72c527943845
| | * QML: Remove static attchedPropertyIds mapUlf Hermann2019-04-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the same object is available under two different names it should still have the same attached properties no matter which name you use. This was achieved by having a static map of metaobjects to attached property IDs that would always hold the first attached property ID registered for a given metaobject. This attached property ID was then used as key in the map of attached properties for the actual objects. The obvious downside to that is that we need a global static which gives us thread safety and static initialization (and destruction) problems. It turns out, all the attached properties are created by attached properties functions, registered by the user. Those functions only get the object to be amended as parameter. Therefore, no attached properties function can be registered for multiple attached properties on the same object as it wouldn't know which one to create for a given call. Thus, the whole ID dance is unnecessary as we can as well index the attached property objects by the function that created them. This nicely avoids creating two attached property objects for the same object and function and still makes the global static unnecessary. Fixes: QTBUG-75176 Change-Id: Ie8d53ef0a6f41c9b3d6b9d611cde1603a557901c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Clean up type registrationUlf Hermann2019-04-181-2/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QML-specific types need to be registered only for "QtQml". Make sure we don't accidentally add new QML-specific types to QtQuick. We also don't want the base types to be registered under any random URI and version. Formally qmlRegisterBaseTypes() is a public function, but it _really_ should not be called by anyone. Finally, split the types into ones that should belong to QtQml.Models and ones that belong to QtQml proper. Add a plugin that handles QtQml itself rather than using the QQmlEngine ctor for this. [ChangeLog] The accidentally exported function qmlRegisterBaseTypes() was removed. Change-Id: I8bf9f8515e18b016750c721fe694d4cda076780b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>