aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Integrate sequences with registration macrosUlf Hermann2020-11-111-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Doc:: Fix documentation warnings for Qt QMLTopi Reinio2020-11-051-2/+2
| | | | | | Task-number: QTBUG-88156 Change-Id: Ic6127c6128b4c7736cb4b5ab8ce51629388b59ca Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QML: Allow singleton types to be extendedUlf Hermann2020-11-021-0/+2
| | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | 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>
* Allow optional imports in qmldir filesUlf Hermann2020-10-081-4/+4
| | | | | | | | | | This is useful for modules that select their imports at runtime using qmlRegisterModuleImport(). We can list all possible variants as optional imports so that tools can see what types might be available. Task-number: QTBUG-87130 Change-Id: I8a37bdde79aef3619fd1f05e5ea6781d521afa88 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use factory functions and ctors for creating value typesUlf Hermann2020-10-021-0/+2
| | | | | | | | | | 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/+6
| | | | | | | | | | 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>
* Restrict qmlRegisterTypesAndRevisions to major version givenUlf Hermann2020-07-161-0/+4
| | | | | | | | | | | We should not register any revisions larger than the given major version as that allows importing an incomplete module, as the version-less import. Typically the offending version is pulled in via some QML_FOREIGN and only the types derived from that foreign class are available in the higher major version. Change-Id: I186fb010d704bea514cefff9f66eb58186df5c91 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add userdata callback to qml registrationMaximilian Goldstein2020-07-101-0/+3
| | | | | | | This is needed in order to remove PySide2's qml type limit. Change-Id: I331d9e31574a744eb9085222d58ea8a8789e0e31 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-241-10/+82
| | | | | | | | | | | | | 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>
* Un-pimpl QQmlModuleImportUlf Hermann2020-06-101-1/+1
| | | | | | | There is no point in having that pimpl'd. Change-Id: I9e3f6671ca178ea3f58fd0488dbb291a38656685 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add methods to programatically insert qmldir import statementsUlf Hermann2020-06-091-0/+31
| | | | | | | We need this for controls2 to select the style at runtime. Change-Id: I23b6ab962a647b519d5af019eade27f89e1e4e00 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a default message to QML_UNCREATABLEMaximilian Goldstein2020-05-061-3/+8
| | | | | | | | | [ChangeLog][QML][Feature] Add a default message to QML_UNCREATABLE when proving an empty string as a reason Fixes: QTBUG-83842 Change-Id: Ifd2044fa6c56c3a382d451ec47d5f92a1ac16b81 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Clean up type registration structsUlf Hermann2020-03-121-12/+7
| | | | | | | | | | | | * 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-4/+9
| | | | | | | | 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-4/+2
| | | | | | 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-02-171-0/+37
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+37
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove custom operator<(QTypeRevision, QTypeRevision)Ulf Hermann2020-02-131-11/+0
| | | | | | | | | | | | | | | | We have global comparison operators now. Change-Id: I5e7461c8442591f139642379f8889445dfaa8431 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Process major versions as part of Q_REVISIONUlf Hermann2020-02-131-24/+56
| | | | | | | | | | | | | | | | 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-27/+43
|/ | | | | | | | | | | | | | 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 "Merge remote-tracking branch 'origin/5.14' into 5.15"Qt Forward Merge Bot2019-10-081-0/+7
|\
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-081-0/+7
| |\ | | | | | | | | | Change-Id: Ib381f350ada365747ce20b989bfdc368d75f2219
| | * qmlRegisterSingletonInstance: Do not crash if instance gets deletedFabian Kosmale2019-10-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a QPointer, so that we notice if the object has been deleted. Also ensure that in the documentation the function is in a single line, as qdoc will otherwise silently omit it. Change-Id: Idecd370d00089997cd18b3247ad2290a561b2b69 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Use qmlProtectModule to protect a module from further modificationUlf Hermann2019-10-081-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-9/+172
|/ | | | | | | | | | | | | | | | | | | | | 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>
* Introduce qmlRegisterSingletonInstanceFabian Kosmale2019-07-191-0/+20
| | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-011-0/+20
| | | | | | | | Conflicts: src/imports/imports.pro src/qml/qml/qqmlmetatype.cpp Change-Id: I308436caf55402cb2246cb591c6ac8f83e1febf8
* Clean up the QT_CONFIG(library) conditionsUlf Hermann2019-06-261-2/+0
| | | | | | | | | | | | | We can clear the engine plugins when compiled without library support as those might be static plugins. However, explicitly loading a dynamic plugin is pointless if compiled without library support. We can just disable the whole function. Furthermore, the ability to load dynamic qmldir plugins does not depend on Qt being compiled as shared library but rather on library support being available. Change-Id: I8553706f0f8f5bd4e98cc130bf56c4526f81b85f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Split qqmlmetatype{_p.h|.cpp} into multiple filesUlf Hermann2019-02-061-0/+116
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>