aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add support for semi-automatic QML type registrationsUlf Hermann2019-10-141-26/+48
| | | | | | | | | | | | | | | We can use the new moc JSON output to collect all meta-objects at build time and, for those that include QML element registration meta-data, generate code that automatically registers these types with QML. This eliminates the need to call qmlRegisterType manually. For now this generates free-standing functions (per module) that need to be called manually. This is intended as an intermediate step. Task-number: QTBUG-68796 Change-Id: Ib414eef9757344feee488ebc7388f957b975347f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use qmlProtectModule to protect a module from further modificationUlf Hermann2019-10-081-26/+13
| | | | | | | | | | | | | | | | | | | | | | We don't need two mechanisms to do essentially the same thing. QQmlTypeLoader::Blob::addImport() had an "optimization" to never check for qmldir files of locked imports. This meant the first time you imported a module with a plugin that locked the module you could use the qmldir file to load additional .qml files afterwards. The second time you imported the same thing, you couldn't. As this is not a great example of consistent behavior, we drop this optimization and always allow the qmldir files of plugins that lock the module to specify additional QML files. As a side effect of this, additional plugins listed in a qmldir file can also now be loaded after the module has been locked by some other means. However, any qmlRegisterFooBar() called from the module will be prevented. Change-Id: Idabb2bd5f75fc85b62f42625173672b4ae84382e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Specify parameters of type registration in class declarationsUlf Hermann2019-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | 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>
* Also check the non-file-imported type on QQmlMetaType::typeForUrlMichael Brasser2019-09-091-3/+10
| | | | | | | | | | | There is no reason why we wouldn't want to find those. Failure to do so leads to duplicate creation of singleton objects. Fixes: QTBUG-76514 Change-Id: If2fdfbd933229518136ae0d19474bbaebfbb8cff Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Port from QMutex::Recursive to QRecursiveMutexMarc Mutz2019-07-311-2/+2
| | | | | | Change-Id: I5bf128b4479971e87d377707f2ebf267ccba1f1d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Split qqmltypeloader{_p.h|.cpp} into a several filesUlf Hermann2019-07-111-0/+1
| | | | | | | No one can read this mess. Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-011-1/+7
|\ | | | | | | | | | | | | | | Conflicts: src/imports/imports.pro src/qml/qml/qqmlmetatype.cpp Change-Id: I308436caf55402cb2246cb591c6ac8f83e1febf8
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-281-1/+28
| |\ | | | | | | | | | Change-Id: I59343fe228ca6b823b61577e5a0907e7381899c2
| | * Unregister unit cache hook when destroying the plugin singletonMitch Curtis2019-06-251-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | At the point the plugin is actually unloaded the hook turns into a dangling pointer. Fixes: QTBUG-71387 Change-Id: Ib8ccee3f9a86d4700fbea7e87c666cd8f30f71e4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Move the header checking into ExecutableCompilationUnitUlf Hermann2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to verify the header unless we want to execute the code. Change-Id: Ieac51c47faafcd7047228b4264aa7750ba3d8889 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | add std::function overload to qmlRegisterSingletonTypeFabian Kosmale2019-06-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-06-021-1/+3
| |\| | | | | | | | | | Change-Id: Icf36857844b6643d9fbe3c841b1d9b78943435d4
| | * In qmlUnregisterType() also remove the type from undeletableTypesUlf Hermann2019-05-291-1/+3
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-76074 Change-Id: I7f5ca6af0955524f9a417811c2e9f960c2b3efb3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | We need a CompilationUnit that only holds the data needed for compilation and another one that is executable by the runtime. Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Mark functions involving attached property IDs as deprecatedUlf Hermann2019-04-301-0/+2
| | | | | | | | | | | | | | | | | | 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-291-0/+6
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compilercontext.cpp src/qml/qml/qqmlmetatype.cpp Change-Id: I02e0216961b92ff68a3f91a70edc33fe9e8db147
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-271-0/+4
| |\| | | | | | | | | | Change-Id: I552629813ea8100d04ea19e51fe7198931082e19
| | * Fix crash in QQmlMetaType::freeUnusedTypesAndCaches()Kevin Funk2019-04-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix crash when QQmlMetaType::freeUnusedTypesAndCaches() is being called during program exit, i.e. when the parent QJSEngine instance is being destructed during exit(). Sample backtrace: #0 QQmlMetaType::freeUnusedTypesAndCaches () at /home/kfunk/devel/src/qt5.12/qtdeclarative/src/qml/qml/qqmlmetatype.cpp:2600 #1 0x00007fffe12fce83 in QJSEnginePrivate::~QJSEnginePrivate (this=0x60c001c0b040, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtdeclarative/src/qml/jsapi/qjsengine.cpp:982 #2 0x00007fffe12fce9f in QJSEnginePrivate::~QJSEnginePrivate (this=0x60c001c0b040, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtdeclarative/src/qml/jsapi/qjsengine.cpp:980 #3 0x00007ffff53650c3 in QScopedPointerDeleter<QObjectData>::cleanup (pointer=<optimized out>) at ../../include/QtCore/../../../../../src/qt5.12/qtbase/src/corelib/tools/qscopedpointer.h:52 #4 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer (this=0x60300178b3a8, __in_chrg=<optimized out>) at ../../include/QtCore/../../../../../src/qt5.12/qtbase/src/corelib/tools/qscopedpointer.h:107 #5 QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtbase/src/corelib/kernel/qobject.cpp:891 #6 0x00007fffe12ff572 in QJSEngine::~QJSEngine (this=0x60300178b3a0, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtdeclarative/src/qml/jsapi/qjsengine.cpp:379 #7 0x00007fffe12ff583 in QJSEngine::~QJSEngine (this=0x60300178b3a0, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtdeclarative/src/qml/jsapi/qjsengine.cpp:375 #8 0x00007ffff5363cc4 in QObjectPrivate::deleteChildren (this=this@entry=0x60b00016c380) at /home/kfunk/devel/src/qt5.12/qtbase/src/corelib/kernel/qobject.cpp:2010 #9 0x00007ffff53650f5 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtbase/src/corelib/kernel/qobject.cpp:1032 #10 0x00007fffe103b43b in Grantlee::ScriptableTagLibrary::~ScriptableTagLibrary (this=0x607000ba4c00) at templates/lib/Grantlee_Templates_autogen/MTDBPGIEEV/../../../../../../../src/kf5/grantlee/templates/scriptabletags/scriptabletags.h:58 #11 0x00007fffe103b469 in Grantlee::ScriptableTagLibrary::~ScriptableTagLibrary (this=0x607000ba4c00) at templates/lib/Grantlee_Templates_autogen/MTDBPGIEEV/../../../../../../../src/kf5/grantlee/templates/scriptabletags/scriptabletags.h:58 #12 0x00007ffff5363cc4 in QObjectPrivate::deleteChildren (this=this@entry=0x60b00016c0c0) at /home/kfunk/devel/src/qt5.12/qtbase/src/corelib/kernel/qobject.cpp:2010 #13 0x00007ffff53650f5 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /home/kfunk/devel/src/qt5.12/qtbase/src/corelib/kernel/qobject.cpp:1032 #14 0x00007fffe0fef704 in Grantlee::Engine::~Engine (this=0x60300178a2c0) at /home/kfunk/devel/src/kf5/grantlee/templates/lib/engine.cpp:60 #15 0x00007fffdf2e2482 in GrantleeTheme::Engine::~Engine (this=0x60300178a2c0) at /home/kfunk/devel/src/kf5/grantleetheme/src/grantleethemeengine.cpp:54 #16 0x00007fffdf2e24a9 in GrantleeTheme::Engine::~Engine (this=0x60300178a2c0) at /home/kfunk/devel/src/kf5/grantleetheme/src/grantleethemeengine.cpp:52 #17 0x00007ffff3f4f8d1 in MessageViewer::MessagePartRendererManager::~MessagePartRendererManager (this=0x7ffff40c8ab0 <MessageViewer::MessagePartRendererManager::self()::s_self>) at /home/kfunk/devel/src/kf5/messagelib/messageviewer/src/messagepartthemes/default /messagepartrenderermanager.cpp:118 #18 0x00007ffff4b442ac in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #19 0x00007ffff4b443da in exit () from /lib/x86_64-linux-gnu/libc.so.6 Also see: https://bugs.kde.org/show_bug.cgi?id=406871 Change-Id: If5676880c87f1fa2405701a439e1a0037dce045c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-231-19/+9
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: Ieff61c076e46eb50a059c8b0210f7f4d7ce0cbcf
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-191-23/+12
| |\| | | | | | | | | | Change-Id: I9ef4be23bfe35aa48d4c65d4159e72c527943845
| | * QML: Remove static attchedPropertyIds mapUlf Hermann2019-04-181-23/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-021-8/+15
| |\| | | | | | | | | | Change-Id: I1dd04210f10895c509b5c637fc5e2dcf66e3bb91
| | * Allow enums in QQmlType to be set up in two separate passesUlf Hermann2019-03-281-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The baseMetaObject and the property cache can become available at different points in time. If we have initialized the enums before either of them is available we want to add the additional enums when the other one appears. Fixes: QTBUG-74677 Change-Id: I57276681a50b6c04181c6a29e736f2dc20632a0c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Move propertyCache-by-minor-version into QQmlMetaTypeDataUlf Hermann2019-04-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ths data structure should only be accessed when protected by the metatype data lock. In fact we don't access it from anywhere else. To make that more obvious, move it to the right place. This allows us to eliminate some const_cast and poking around in QQmlTypePrivate from the outside. Change-Id: I16ffd240b9504b9c00010bdb2d17b05c8196fe8a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Use QQmlRefCount for QQmlType(Private)Ulf Hermann2019-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we already have an implementation of refcounting, we can just use that intead of inventing another one. This also gives us nice move ctors and operators. Also, use const pointers to QQmlTypePrivate where possible. This exposes quite some nastiness that needs to be fixed in follow-up commits: All the mutable members of QQmlTypePrivate are unsafe for multithreaded use. Change-Id: I3be8f2c53d86e06ffa80c8df8830473fe6d1d91d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-251-2/+2
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: I517c001ea4eb0fdd8e469f9fffe5b7559a5b0795
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-221-7/+7
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktableview/tst_qquicktableview.cpp Change-Id: If3bf1abc23a59c458be0bb862d92f2edcb16b79f
| | * QML: Pass type minor version when creating property dataUlf Hermann2019-02-211-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the type minor version recursive properties should be available or not. Check for that when resolving grouped properties. Fixes: QTBUG-33179 Change-Id: Id8f62befdc4a29d879710499e19d3d289bd18775 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Make QQmlTypePrivate::name safe for usage from different threadsUlf Hermann2019-02-111-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | There is hardly a point in setting this lazily. We always set uri and elementName together anyway. Change-Id: I5f9f00ee72d78fd8cf66413e81c8d88db1f8a436 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Eliminate excessive friendlyness of QQmlTypeUlf Hermann2019-02-081-21/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQmlMetaTypeData does need to be exposed to the QQmlType ctors. Rather, we can use factory functions to create the QQmlTypePrivate objects. The static attachedPropertyIds should really be part of QQmlMetaTypeData and access to them should be protected by the lock. Task-number: QTBUG-73271 Change-Id: I154a3842fab03a02c710901a20afd1652364808d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Move registration functions from qqmlimport.cpp to qqmlmetatype.cppUlf Hermann2019-02-081-20/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions require the metatype data in multiple interdependent places. If they are executed concurrently data races are almost guaranteed. Move the functions to qqmlmetatype.cpp and keep the metatype mutex locked for their duration. Access to the internals of the metatype system also allows us to significantly simplify the logic. Additionally we can remove methods only used by those functions from the public interface of QQmlMetaType now. Task-number: QTBUG-73271 Change-Id: I1279259cca5cb5be63026d5b74f5d013e7a1ac5c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Tighten the interface of QQmlTypeModuleUlf Hermann2019-02-071-69/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No other classes really need direct access to QQmlTypeModulePrivate. Adding or removing types, as well as lookup of types needs to be protected by a mutex, as that can happen from multiple threads. However, we don't need to acquire the global type registration mutex in order to change the internals of some QQmlTypeModule. Rather, each type module gets its own mutex. The minimum and maximum versions as well as the "locked" property can be handled with atomic integers as they only ever move in one direction. The module and majorVersion properties are constant over the life time of the object. Therefore they don't need any locking. Task-number: QTBUG-73271 Change-Id: I23fe7dcaf521ccecaaaf19c1fb0436e109c42f03 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QQmlMetaType: Only provide access to the singleton through the lockUlf Hermann2019-02-061-109/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The singleton is hidden behind a struct that is only transparent for a smart pointer that acquires the lock on construction and releases it on destruction. Task-number: QTBUG-73271 Change-Id: Ifec9c853498edb8fb71411170171d999d51258f6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QML: Split qqmlmetatype{_p.h|.cpp} into multiple filesUlf Hermann2019-02-061-1702/+81
|/ / | | | | | | | | | | | | | | Having all those classes in one big file promotes spaghetti code and makes the code unreadable. Change-Id: I3b6df93b9cfe1d97228771049b3054e78b868ea3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-221-4/+12
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/quick/qquickpathview/tst_qquickpathview.cpp Change-Id: Ic1f5e219a255d0613f7654368a5ce3eccb8f0ee9
| * QQmlMetaType: Erase attached properties in dtorUlf Hermann2019-01-151-4/+12
| | | | | | | | | | | | | | | | | | | | Also, make it more obvious that the attachedPropertyIds are a static member of QQmlTypePrivate. Fixes: QTBUG-72972 Change-Id: If0a28e034dd46d7127993ed15aed11c7641d580e Reviewed-by: Harald Hvaal <harald.hvaal@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QML: Consider all possible metatypes when looking for attached propsUlf Hermann2019-01-211-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | metaObjectToType is in fact a MultiHash. There can be more than one QML type associated with a given metaobject. Therefore, in order to find the attached properties we need to iterate them. This highlights a different problem: If you register the same metaobject under different QML names and define different attached properties for each, you will get random results here. That, however, is a problem of the public qmlAttachedPropertiesObject function, which doesn't take a parameter for the registered name of the type. Change-Id: I0eb9618114029ef5000d8eb12691b7f8de485121 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove unused functionJędrzej Nowacki2018-12-031-7/+0
|/ | | | | | | QQmlType::createSize was unused and it's purpose was not clear enough. Change-Id: If4ef502d0a4ea7ca53351f04ea45c2a73a2b3d22 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Doc: improve qmlRegisterInterface() documentationMitch Curtis2018-11-071-0/+3
| | | | | Change-Id: I5e8b63a287c65baf1eb53957cc5a9585176db284 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix erroneous enum conflict warningsSimon Hausmann2018-10-231-5/+24
| | | | | | | | | | | | | Permit enums from sub-classes to overwrite enums from super-classes, but keep warnings about clashes within a class, provided that the values differ. The last condition relates to the declaration of enums and a subsequent declaration of Q_FLAGS, which appear to have the same keys and values in the meta-object system. Task-number: QTBUG-71184 Change-Id: I2a00dc90e3714fc4c6fe8add5a6268b88bb9e745 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
* qmlplugindump: Properly handle extension typesKai Koehne2018-10-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extension classes do augment the primary C++ class with additional properties that should be part of the QML type. Anyhow, they should not be visible in the API. The old logic tried to emulate this by making the extension class the actual C++ type, and 'inheriting' from the normal class by setting it in the prototype. Anyhow, this failed for e.g. Qt3D, where there are numerous types sharing the same extension class. Instead, this patch fixes the issue a) hiding the extension class metainformation itself, and b) printing properties of the extension class as part of the main type. In the QMetaObject collection phase, we now traverse the class hierarchy using QQmlType::baseMetaObject instead of QQmlType::metaObject. In the generation phase, we explicitly resolve the extended type, and dump additional properties and "DefaultProperty" information into the main type description. Note that the ExtendedType sets the DefaultProperty independent of the version. Changing this would require either revisioning the defaultProperty, or (again) splitting up the types, which however brings other problems. Task-number: QTBUG-70294 Change-Id: I324469152398a605fae9e5a35b619845444ac4e8 Reviewed-by: Marco Benelli <marco.benelli@qt.io>
* Remove left over commentRainer Keller2018-09-141-1/+1
| | | | | Change-Id: If0483546fd88ee0270938f2cd72fbf69936f2a20 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Check for nullptr in enum conflict analysisRainer Keller2018-09-141-2/+10
| | | | | | | Task-number: QTBUG-70547 Change-Id: Idc0c20d3aee354366daefc99e10eec74065bf579 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* List possbile enum conflictsRainer Keller2018-09-121-1/+60
| | | | | | | | | | | | | When enums are overwritten a report is shown listing possible candidates and their source locations. Previously registered enum will be overwritten due to name clash: QQuickListView.Center Possible conflicting items: QQuickListView.TransformOrigin.Center from scope QQuickItem injected by QQuickListView QQuickListView.PositionMode.Center from scope QQuickItemView injected by QQuickListView Change-Id: I02217b1cf2c80a909ceb6f392083d76266cc622c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix QML extended type registrationSimon Hausmann2018-08-231-3/+5
| | | | | | | | | | | | Avoid calling init() too early (indirectly through metaObject()), as it relies on subsequent type registrations for extended types and must be called as late as possible. Amends bb296168f426d7e646c0208427f25687f96e2693 Task-number: QTBUG-70127 Change-Id: I87f67c7f26cddf7d7319be929512e339c8b6c9ad Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
* Provide option to skip registration of enum classes unscopedRainer Keller2018-08-211-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Enums classes are registered unscoped which leads to clashes in the following cases: 1. Two different enums contain the same values 2. The name of an enum class is the same as an enum value In the 2nd case you can not even access the scoped enum at all because it will be overwritten by the primitive type. Users can now add a class info to the meta type to disable the unscoped registration which solves all clashes. The default is kept as is. class MyClass : public QObject { Q_OBJECT Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") public: ... }; [ChangeLog][QtQml] Added option to disable unscoped registration of enum classes. Change-Id: Ifa4197a14a252575e8a25ae56fb6ee479addf80b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Adapt to QMetaObject::d internal changesThiago Macieira2018-08-041-1/+1
| | | | | | | | qtbase is changing the type of the QMetaObject pointers to use a wrapper class. Change-Id: Id2be776c7ae0467c9d9ffffd15431f7b1b005c09 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-06-291-13/+29
|\ | | | | | | Change-Id: I800f39ea59efd6049d3226ec27b8ecb3f6e9ae28
| * Show error message when type qmlRegisterType and friends failErik Verbruggen2018-06-261-13/+29
| | | | | | | | | | | | | | | | | | When a type is registered through qmlRegisterType or similar functions, no error was shown. Task-number: QTBUG-68323 Change-Id: Iff44bf8744c67dba2fdd12c43aaee44a8e15364a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>