aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* fix not initialized enum error valueTim Jenssen2021-01-261-1/+1
| | | | | | | amends: c0b59369ab45a78e4407633365a52c1a9255512c Change-Id: If068443257baa0eaee31a43b94b2e0d0f7f554fe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmltypeloader: Allow pluginless qmldir + declarative type registrationFabian Kosmale2020-12-151-1/+9
| | | | | | | | | | | | | | Assume an application which uses a QML singleton (so needs qmldir), and wants to use declarative type registration. This currently breaks because we find the qmldir, see that there is no plugin to load, and thus never search for registration functions. Requiring the creation of a plugin is rather pointless for an application which doesn't reuse the QML types; so instead enable this usecase to work. Note that qmldir + imperative registration did always work, as the imperative registration code did always run. Change-Id: Iac40020eb97d602d10eb8c4eecac5195ffeabe14 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Respect QML_DISABLE_DISK_CACHE also for caches built into the binaryUlf Hermann2020-12-101-5/+8
| | | | | | | | Previously it would only disable loading of separate cache files. Change-Id: Iae92fc03d2e5566ef7dc44a6730b788b7512fd3d Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow optional imports in qmldir filesUlf Hermann2020-10-081-2/+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>
* Match specific module imports also for versionless QML importsUlf Hermann2020-06-291-9/+33
| | | | | | | | | | Previously, if you registered a module import for a specific version X of a module, and the user imported the module without specifying a version, the module import would not be carried out even if X was the version actually imported. Change-Id: I853ed6f275501cf4cbd4e5a360985e67b07f3773 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-241-7/+7
| | | | | | | | | | | | | 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>
* QML: Fix precedence of module importsUlf Hermann2020-06-111-8/+18
| | | | | | | | Types imported transitively via a qmldir import statement should not shadow types available from the module itself. Change-Id: Id34edc5c5e2fff4ba37009f4bab9039b7ed18dff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add methods to programatically insert qmldir import statementsUlf Hermann2020-06-091-2/+8
| | | | | | | We need this for controls2 to select the style at runtime. Change-Id: I23b6ab962a647b519d5af019eade27f89e1e4e00 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Update dependencies.yaml and adapt to API changes in qtbaseSimon Hausmann2020-04-221-11/+8
| | | | | | | | | | | | | | | | The evaluation callback does not have to perform the comparison anymore and the shared pointer of the private is not used in the API anymore. Also, the versionFunctions() has been moved out of QOpenGLContext and renamed QOpenGLVersionFunctionsFactory::get(). QHash doesn't keep iterators stable under erase(), so clean up the code relying on it, and avoid an intermediate QList at the same time. Task-number: QTBUG-74409 Change-Id: I90176be1067d88c8f2b1ea07198a06d432f5be9c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Prepare for new members in QQmlPrivate::CachedQmlUnitSimon Hausmann2020-04-211-7/+7
| | | | | | | | Pass the address of the entire structure through to the compiler, so that when adding new members we can easily access them. Change-Id: I5da75ba4e64d3e0e750a3ff3df4edbb88cdb6937 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow multiple URL interceptors per engineUlf Hermann2020-03-171-5/+7
| | | | | | | | | | | We may want to have, for example, a QQmlFileSelector and a component-specific interceptor that chooses a theme or similar. Also, make the API public. We want to propose this as alternative to dynamically registering QML files via qmlRegisterType(QUrl, ...). Change-Id: I4a535d3ea556da6710fde816579ec188b3f57099 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-091-4/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * Revert "error -> networkError to fix deprecation warning"Timur Pocheptsov2020-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 391bd68b4045268b389780f4b08d2f07951b45bf. Reason for revert: this warning is only temporary, the patch fixing it - is coming. But the original change of error->networkError was reverted in 5.15 to make the new patch, changing signal name instead, work. Now qtdeclarative does not compile - it calls non-existing function. Change-Id: I276562564c8954f67dcdf4fd5d08afd5f3f9dc8b Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * error -> networkError to fix deprecation warningFawzi Mohamed2020-02-271-2/+2
| | | | | | | | | | Change-Id: I80d518a1b21185baba0d4934ebf486809e086f9f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Revert "Replace call to deprecated QNetworkReply::error method"Timur Pocheptsov2020-02-241-2/+2
| | | | | | | | | | | | | | | | | | This reverts commit e5a4ba4a5573ace08def218b985dde83de0805fb. Reason for revert: it was decided to re-name a signal instead, like it's done in QProcess. Change-Id: I0f393c482d8be506430258d7afd4a0056611831f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-211-1/+1
|\| | | | | | | | | | | | | Conflicts: tests/auto/quick/qquickmousearea/BLACKLIST Change-Id: I3de2c6377d57f5f9204d2cfc688d50a7a0b4150c
| * Doc: Fix documentation warnings for Qt QMLTopi Reinio2020-02-201-1/+1
| | | | | | | | | | | | Fixes: QTBUG-82313 Change-Id: I7c2f30411ab8011254d7c232c87cb12a39761bda Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-171-37/+45
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Allow dynamic and static registration of same URI in any orderUlf Hermann2020-02-121-36/+44
| | | | | | | | | | | | | | | | | | Previously, a static registration would not go through if a dynamic registration was carried out before the first type of the statically registered module was referenced. Change-Id: Icf6a2b78dff7d0e5b29138501e04723510d6a668 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Process major versions as part of Q_REVISIONUlf Hermann2020-02-131-1/+1
| | | | | | | | | | | | | | | | 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-16/+17
|/ | | | | | | | | | | | | | 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>
* Replace call to deprecated QNetworkReply::error methodFabian Kosmale2020-01-171-2/+2
| | | | | | Change-Id: I14198038a01acdd415e90fd733dc03b122591179 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Defer loading of local qmldir files when intercepted to remote onesUlf Hermann2020-01-021-3/+7
| | | | | | | | | | | | The qqmltypeloader test checks this case. As long as the types are actually loaded by the plugin it worked as we didn't register the module before. When the types are loaded by static type registrations in QtQuick we need to detect whether we still need to wait for a remote qmldir file to appear in order to load color providers etc. Change-Id: I7aa10903c6c23d1c9be01ee7ddafbdc696975407 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add more trace points to Qt QMLMilian Wolff2019-12-131-0/+4
| | | | | | | | | | | | This patch aligns the trace points more with the existing coverage from the Qt QML profiler. The following things can now be traced: - file compilation time - binding execution - signal handling Change-Id: I5b7f1a495f0556482ccd5c07474391b291742ef1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make QML_FORCE_DISK_CACHE override isDebugging()Ulf Hermann2019-12-101-1/+1
| | | | | | | The way it was before, QML_FORCE_DISK_CACHE was rather useless. Change-Id: Id6be04ff1feaaced97455a797656bd041878fa9f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-261-1/+2
|\ | | | | | | | | | | | | | | Conflicts: src/qml/qmldirparser/qqmldirparser.cpp src/qml/qmldirparser/qqmldirparser_p.h Change-Id: Ia68a8d4f345e6e456eebc3f215fc90d3819ddd70
| * QQmlTypeLoader: Don't parse qmldir content multiple timesUlf Hermann2019-11-231-1/+2
| | | | | | | | | | | | | | | | | | | | The content of a qmldir file at a specific URL should really never change. If it does, we have bigger problems. In order to forget the qmldir contents we can already do QQmlTypeLoader::clearCache(). Fixes: QTBUG-30467 Change-Id: Ic1b3662695254d8be5beaa65ca9cd76eab56e2e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Register compiled-in QML typesUlf Hermann2019-11-071-1/+2
| | | | | | | | | | | | | | | | | | If we compile the QML types into the main application we cannot depend on plugin loading for triggering the registration. Rather, we need to register them immediately. Change-Id: I910fb13359f8b7524eafd7693c85205cb4ed4cd8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-261-7/+2
|\| | | | | | | Change-Id: Iaa7dbbe9926d25cfb1b1c51e7013e58cb71d86b5
| * QML: Consistently check for debugger before loading cache filesUlf Hermann2019-10-241-7/+2
| | | | | | | | | | | | | | | | | | In debug mode we don't want to load cache files. Fixes: QTBUG-79443 Change-Id: Ie3e2c70d54e66f24846070aee952a86934099695 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Extend typeloader file cache to also cover resourcesUlf Hermann2019-10-171-32/+40
| | | | | | | | | | | | | | | | | | | | Looking up resources is still expensive, less so than real files, but worth the optimization. Task-number: QTBUG-77237 Change-Id: I4dcc77bf63d3f03b7b5504668e879abd09373fa1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for semi-automatic QML type registrationsUlf Hermann2019-10-141-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"Qt Forward Merge Bot2019-10-081-1/+1
|\|
| * Small performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-1/+1
| | | | | | | | | | | | | | | | | | mostly add const &, a few std::move and in particular case, remove const so the std::move being done over the variable actually has effect Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Use qmlProtectModule to protect a module from further modificationUlf Hermann2019-10-081-7/+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>
* QQmlTypeLoader: Do some more sanity checks on file and path namesUlf Hermann2019-09-051-1/+3
| | | | | | | | | Apparently we can end up with null bytes in those names, and those really should not be valid. Change-Id: I5b84dbc412342dbfb23befd5417a8bd394d4fb4f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for implicit module importsSimon Hausmann2019-07-171-0/+21
| | | | | | | | | | | | This allows a module to make another module import with the same minor version and in the same qualified namespace. This will be used to make import QtQuick 2.5 implicitly import QtQml 2.5, to maintain compatibility. It used to be implemented by means of calling C++ type registration functions directly. Change-Id: I64c7bfe25d75b9a45f5d44a10d035fc2f86d30ca Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Clean up import resolution handlingSimon Hausmann2019-07-161-37/+40
| | | | | | | | | | | | | Instead of storing raw pointers into the compiled data and creating synthetic CompiledData::Import objects for implicit imports, this patch introduces a dedicated PendingImport data structure that removes the need of using raw pointers, reduces the amount of string index to string resolution and incorporates the priority field thus eliminating the need for a hash table. Change-Id: Ia59aad17687bc0935aafd36236bda85d5f4f82a2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-121-1/+5
|\ | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmltypeloader.cpp src/quick/scenegraph/qsgopengldistancefieldglyphcache.cpp Change-Id: I1a226d8738db2ec06e3cef240a0e040e7c144cad
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-051-1/+5
| |\ | | | | | | | | | Change-Id: I47735445e4d31ba47d596d964b3f050e263bd1d9
| | * Create a URL from the import string before adding the qmldir pathUlf Hermann2019-07-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise the path might get interpreted as some other part of the URL, for example the host name. Fixes: QTBUG-76441 Change-Id: I3edde96153403962db4576e5af794419c21b49a8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split qqmltypeloader{_p.h|.cpp} into a several filesUlf Hermann2019-07-111-2175/+23
| | | | | | | | | | | | | | | | | | | | | No one can read this mess. Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Port towards load/storeRelaxed atomicsGiuseppe D'Angelo2019-06-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plain load() / store() have been deprecated, so port away to their straight replacements. Task-number: QTBUG-76611 Change-Id: I79935b889cf7b2ba7698f70cc5e33994b034aa09 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Simplify errors and diagnosticsUlf Hermann2019-06-141-22/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only need two classes to describe all possible diagnostics: * A low-level private POD DiagnosticMessage. This is easily copied and passed around internally. It doesn't need to adhere to a stable API and it doesn't carry any extra baggage. * The high-level public QQmlError with its stable interface. This can internally also use a DiagnosticMessage as storage. Change-Id: I52be88d9b5d9855a661b8032b01eedb43a0fb0b3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove qqmlmemoryprofiler*Ulf Hermann2019-06-131-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've never seen it used and I've never seen the companion library required to operate it. Change-Id: I5a0e6aed9a416f1bd26dea97def9667a11a4d77d Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | | Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-161-37/+40
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Drop some dead bootstrap codeUlf Hermann2019-05-081-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dependencies are only hashed if a dependencyHasher is given. This is generally not the case when compiling ahead of time. There is also no need to hide the declaration of DependentTypesHasher from the bootstrap code. Change-Id: I0ea74c3079656ce1fe353956999820916c8ff626 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove last traces of QV8EngineUlf Hermann2019-05-081-1/+1
| | | | | | | | | | | | | | | Change-Id: I59f738402d51e39188bbbca2ef1fbc8a61612372 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Move compileModule() into qv4codegen.cppUlf Hermann2019-05-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a better fit for the method. In turn, remove all the V4_BOOTSTRAP conditions from qv4engine_p.h and make sure we don't include or compile it in bootstrap mode. Change-Id: I5933b0724e561313ca20c420b83e4d70e63bddf5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>