aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qmldirparser/qqmldirparser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Accept .js and .mjs files in directory-listing qmldirsUlf Hermann2025-01-061-13/+16
| | | | | | | | | Since it's documented like this, we should actually allow it. Pick-to: 6.9 6.8 6.5 Task-number: QTBUG-132118 Change-Id: I2192f040b8fdf545b8dbb0687b6e618a9858ed07 Reviewed-by: Olivier De Cannière <[email protected]>
* QtQml: Allow basic name quoting in qmldir filesUlf Hermann2024-12-201-7/+59
| | | | | | | | | | | | | | | This adds support for quoted file names and for escaping quotes and backslashes with '\'. It breaks support for file names that genuinely start with a quote. [ChangeLog][QtQml] You can now quote file names in qmldir files using '"'. This is so that you can write file names with spaces in them. '\' functions as an escape character, allowing you to escape quotes that are part of file names and backslash itself. Task-number: QTBUG-131916 Change-Id: Ia89e60153d3fafa273034f81da37166f30284c76 Reviewed-by: Fabian Kosmale <[email protected]>
* Fix disambiguation of file-selected components and scriptsUlf Hermann2023-08-151-0/+123
| | | | | | | | | | | | | | In order to choose the right file-selected components and scripts when resolving types we need to drop all but the "base" ones from the qmldir. This has to be done right after parsing the qmldir, but only at run time. At compile time we need the extra information to determine that we cannot compile any access to such files to C++. Pick-to: 6.5 6.6 Fixes: QTBUG-113940 Change-Id: I734b865202b6241d5dd60c134214bdbe09ea10f4 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Doc: Remove duplicate words (typos)Andreas Eliasson2023-03-071-1/+1
| | | | | | Pick-to: 6.5 6.4 6.2 Change-Id: Ibd29739b894598e5d7837ed5f9150e08ca07fa35 Reviewed-by: Topi Reiniö <[email protected]>
* qmldir parser: Handle internal types with versionsUlf Hermann2023-02-071-5/+19
| | | | | | | | | There is no reason why internal types cannot have versions. Pick-to: 6.5 Task-number: QTBUG-110815 Change-Id: I7fa9790dc64dd785fc08ec7b22f68b4f961fdb00 Reviewed-by: Fabian Kosmale <[email protected]>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <[email protected]>
* qmldir: Allow for specifying default importsMaximilian Goldstein2022-02-141-0/+17
| | | | | | | | | | | | | | | | | Adds the option to specify default optional imports in qmldir for tooling to load. Previously we would just load all entries. This allows code that that relies on modules utilizing optional imports (i.e. everything utilizing QtQuick.Controls) to still be supported in a limited capacity. This change also adds the necessary CMake API to add these entries to qmldir files. It also disables loading optional imports by default and only leaves them enabled for qmllint. Change-Id: Iff6aaac9cb0ec72b7a2853b60840a4d28c84aa25 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* Move QObject and QQmlComponent into builtinsMaximilian Goldstein2021-12-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | Previously we had two versions of QObject and QQmlComponent: a hand-written version in bultins and one that is generated from QtQml. We now move the QtQml version into builtins in order to allow for representing the JavaScript extensions that are present in these types. We also add some logic so that unused types will still react properly despite the fact that those components are no longer in QtQml. This is done by introducing the concept of static modules. These are modules that have side effects beyond simply provinding components. This applies both to when some components are in builtins instead of QtQml or when the global object is modified in some way (i.e. by adding an image provider). This is a tooling-only concept and does not affect how these modules are handled at runtime. Fixes: QTBUG-99025 Change-Id: Ifacaa836e4d2eef0521494f5a41363e053c90007 Reviewed-by: Ulf Hermann <[email protected]>
* Allow QML plugin's CMake target name to be specified for qmldir fileCraig Scott2021-08-201-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | The current code assumes that the basename of the QML plugin is the same as the CMake target it corresponds to. This won't be the case for installed Qt packages due to the installed name including a namespace. It also won't match when a Qt library infix is used. The current code works around the former by trying to heuristically work out whether a namespaced Qt target exists for the plugin. The Qt library infix is more problematic because the plugin target name won't include the infix whereas the plugin library basename will. Address both of those issues by adding an internal option INSTALLED_PLUGIN_TARGET to qt6_add_qml_module() which allows the installed target name to be provided. When included in a qmldir file, qt6_import_qml_plugin() will use that name, otherwise it will fall back to using the plugin library's basename, as per the current behavior. The option may become public in the future, but for now it is only for Qt's internal use for the 6.2 release. Fixes: QTBUG-95140 Pick-to: 6.2 Change-Id: I5a057c80b70ee802c0f0840e9eea2e579193d126 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* Make most of QQmlDirParser inlineUlf Hermann2021-06-251-63/+0
| | | | | | | | There is no need to call functions simply to access members. Change-Id: I823ca9ebba063349be7b3da7c846f9d8d860a9d1 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Andrei Golubev <[email protected]>
* Add a "prefer" directive to qmldirUlf Hermann2021-03-041-0/+27
| | | | | | | | | | | | | | | | | | | | | The argument is the path from which further files from the module should be loaded. This allows us to load potentially pre-compiled files from a resource contained in a plugin. The qmldir file has to be stored outside the plugin in order for the QML engine to find it, but the QML files can now be stored inside the plugin. [ChangeLog][QtQml] You can now specify that QML files in a QML module should be loaded from a different place than the directory where the qmldir file is found. To do this, add a "prefer" directive to the qmldir file. The most useful application of this is adding the QML files as resources to a plugin, and using qmlcachegen to pre-compile them. You can then add their path inside the resource file system as "prefer" path in order to make the engine load the pre-compiled files. The plain files should still be installed next to the qmldir file so that they remain visible to tooling. Change-Id: Ib281b39230621b3762432095a47fb499412cbaa6 Reviewed-by: Fabian Kosmale <[email protected]>
* Allow optional imports in qmldir filesUlf Hermann2020-10-081-47/+58
| | | | | | | | | | 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 <[email protected]>
* QQmlDirParser: Return typeinfos as string listUlf Hermann2020-10-061-3/+2
| | | | | | | ... and notice that we don't use them so far. Change-Id: Id57c5a45307fb8425207635b266b81a942b7651c Reviewed-by: Fabian Kosmale <[email protected]>
* QQmlDirParser: Treat dependencies like importsUlf Hermann2020-09-251-22/+13
| | | | | | | In particular, allow auto and latest versions. Change-Id: I4a6b26112950d066ae2d8a37dc0e9fa1dec24724 Reviewed-by: Fabian Kosmale <[email protected]>
* qmlimportscanner: Use QmlDirParserUlf Hermann2020-07-081-4/+4
| | | | | | | | | | | | | | This gives us a reliable way to parse imports and versions. Apparently we can also have multiple classname entries in the same qmldir file. Reflect that in the parser. Also, drop the version field from the output. Nobody uses it and maintaining it while allowing partial, missing and auto versions would be rather difficult. Fixes: QTBUG-85304 Change-Id: Iab89a6d505a3c58174e623f02f0418899cb5fa2f Reviewed-by: Fabian Kosmale <[email protected]>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-241-4/+20
| | | | | | | | | | | | | 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 <[email protected]>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-3/+3
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Allow QML plugins to be optionalUlf Hermann2020-06-091-2/+19
| | | | | | | | | | | If a plugin does nothing but load the library that provides the types, we can skip the plugin loading by linking the library directly. State that in the qmldir file, and evaluate it when loading the module. Task-number: QTBUG-84639 Change-Id: I2097237866a50f66c55e4653ad119fe10e18a893 Reviewed-by: Paul Wicking <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Remove QT_CREATOR special casesUlf Hermann2020-04-011-3/+0
| | | | | | | | Always parse typeinfo entries from qmldir files, and export QQmlJS the Qt way. Change-Id: I3a87a8d0a9ed1014628df6eb906bde5ea23e5d9f Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-091-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+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 <[email protected]>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-23/+25
|/ | | | | | | | | | | | | | 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 <[email protected]>
* QQmlDirParser: Use QMultiHash when it was intendedMårten Nordheim2019-12-101-6/+6
| | | | | | Change-Id: Icc143badb492ce042149b561516d73ca7d5dcd52 Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QQmlDirParser: Fix lifecycle managementUlf Hermann2019-11-231-12/+11
| | | | | | | | | Remove pointless ctor and dtor, provide a clear() method that actually clears everything, call that explicitly where needed. Task-number: QTBUG-30467 Change-Id: I67c632af3a7a76d1d1a706a5ab6d1c446240405c Reviewed-by: Simon Hausmann <[email protected]>
* Add support for implicit module importsSimon Hausmann2019-07-171-0/+12
| | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* Simplify errors and diagnosticsUlf Hermann2019-06-141-16/+8
| | | | | | | | | | | | | | | | 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 <[email protected]>
* Make QQmlDirParser and QQmlError available in QmlDevToolsUlf Hermann2018-10-251-0/+399
We will need them for the QML language server. Also, always build all of QQmlDirParser. The QT_CREATOR condition is mostly useless. Change-Id: I476864b55f6ff3953c11e7887525a043a9405e00 Reviewed-by: Simon Hausmann <[email protected]>