aboutsummaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the import handling code out of qmllintUlf Hermann2020-10-029-342/+431
| | | | | | | We want to re-use this logic in other places. Change-Id: I63cbee86a83265ddd241a4fae9ce8c48f38b5f18 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix updating of parent propertyUlf Hermann2020-10-023-11/+13
| | | | | | | | | | | We need to check for the baseTypeName, not for the internalName. Also, this is not really the scope's business but a property of how qmllint sets up its scopes. Task-number: QTBUG-87116 Change-Id: I8f0e558a4a5861164c6e85f90e3d88e469ea0769 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Evgeniy Dushistov <dushistov@mail.ru>
* qmllint: Ignore grouped properties againUlf Hermann2020-10-021-4/+3
| | | | | | | | | | We cannot handle those, yet. Add tests that prove correct grouped properties pass and incorrect ones are expected to fail at causing qmllint to fail for now. Task-number: QTBUG-87116 Change-Id: I0aeed15d262e2c6226e27d5d92890c5385a38936 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Consistently spell "Warning"Ulf Hermann2020-09-281-1/+1
| | | | | | | There was one place where it was written in lower case. Change-Id: Id953fa6c260502ab5bca8cfa061c817bb5a70581 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Make imports localUlf Hermann2020-09-284-99/+167
| | | | | | | | | Imports are not transitive. qmllint gets this wrong so far. Fixing it reveals two tests where we use types we haven't imported. Import the relevant modules. Change-Id: I45f3229468d54137f97d6b699f3a98a1349bc412 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Use a hash for scripts read from qmldir filesUlf Hermann2020-09-252-5/+5
| | | | | | | You cannot use the same name multiple times anyway (for now) Change-Id: I957340273772a1c5cf0a9da840a305bc8b311e95 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* TypeDescriptionReader: Don't export C++ names as QML namesUlf Hermann2020-09-256-42/+62
| | | | | | | | | | | | | | This is just wrong. The types are not visible in QML under their C++ names. Indeed, this way we reveal a number of places where we confuse the names. Fix those in turn. Furthermore, one of the tests was incorrect. The qmltypes files did not contain an export entry for one of the types, and therefore the type was formally anonymous in QML. However, we did access it via its C++ name. Fix that by exporting the C++ name. Change-Id: I8dd96334076b90fb174daf5b285d622f96495f56 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Split available names into exported, imported, C++ namesUlf Hermann2020-09-254-44/+79
| | | | | | | | | | exported names are the names a component intends to export. imported names are the names the importing component sees, possibly adding a prefix. C++ names are only used in qmltypes files for non-composite types. Change-Id: I843e34f07a026a06931ed76d72a3cce98e3e5552 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlDirParser: Treat dependencies like importsUlf Hermann2020-09-253-4/+4
| | | | | | | In particular, allow auto and latest versions. Change-Id: I4a6b26112950d066ae2d8a37dc0e9fa1dec24724 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ScopeTree: Remove the "name" propertyUlf Hermann2020-09-255-23/+25
| | | | | | | It was rarely used and only caused confusion. Use internalName instead. Change-Id: I196b1d77db04a2cb6e3cd0447d34ce9bae0b9cd5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Clarify the meaning of the various names a scope can haveUlf Hermann2020-09-255-21/+25
| | | | | | | ... and notice that they are misused everywhere. Change-Id: I2254993dc5d11e967e7e83c6f0efb37fa17744be Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Keep scopes mutable until all the imports are resolvedUlf Hermann2020-09-254-13/+13
| | | | | Change-Id: I48601019d0e200eae9d52c3a9db45913cdd9d0f8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ScopeTree: Add provisions for supplying types to methodsUlf Hermann2020-09-252-9/+44
| | | | | | | | | We want to proactively fill in all the types when constructing the ScopeTree so that we don't have to carry an undue number of imports around. Change-Id: I209d88568434c36073c11216dcd052babe5e3dae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Mark scopes read from QML files as compositeUlf Hermann2020-09-251-0/+1
| | | | | Change-Id: I3e46a62595bfc05cdf9ee4233a27cd744b080ab9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Move import handling code into separate classUlf Hermann2020-09-252-64/+126
| | | | | | | | This still messes up the association between scopes and imports, but at least it encapsulates the issue better. Change-Id: I67239495e61ee10d18e6c4b3e837560a42650710 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't dump imported enums into the current scopeUlf Hermann2020-09-241-4/+0
| | | | | | | | | This bit of code has never fulfilled any discernable function. Enum access is done elsewhere. Add a test case to prove that access to enums from QtQml's plugins.qmltypes still works. Change-Id: I62fd6c1ec748c88205aa20367ee06d7a33502fa1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate projects before API changeAlexandru Croitor2020-09-222-28/+0
| | | | | | | Task-number: QTBUG-86815 Change-Id: I834513b93cf495ff9075d4cd541ed425e2ccbc15 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Install public qmake .prf files into the prefix mkspecs dirAlexandru Croitor2020-09-211-0/+12
| | | | | | | | | These are needed for qmake projects. Fixes: QTBUG-86802 Task-number: QTBUG-86498 Change-Id: I09c05a358fa580a3a9eab002c6ada42ad70e999c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlimportscanner: don't include QtQuick.Controls.xxx.impl as depdendencyAssam Boudjelthia2020-09-171-0/+4
| | | | | | | | | | | Since Qt 5 series include those modules QtQuick.Controls.xxx.Impl inside QtQuick.Controls.xxx, we shouldn't add them to the dependencies list. This also will silence androiddeployqt warning about invalid path for these modules. Pick-to: 5.15 Change-Id: Ic8c8aa1248b170ab1d455484effb38d24a1b4d35 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix additional warnings from usage of deprecated APIsVolker Hilsheimer2020-09-163-4/+4
| | | | | | | | Replace QLibaryInfo::location with QLibraryInfo::path, and remove usage of Qt::AA_EnableHighDpiScaling, which doesn't have any effect anymore. Change-Id: I347e8a83e0f4c2b4405f2512e569ad3234f05a98 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qmlformat: Fix multiline comment attachmentMaximilian Goldstein2020-09-042-2/+11
| | | | | | Pick-to: 5.15 Change-Id: I3ba8a4cd683df3309dd6df31b1fd426a0875f8fa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove use of deprecated High-DPI application attributesTor Arne Vestbø2020-09-022-16/+0
| | | | | Change-Id: Ibfb50fdcbb51ba93d6e5d11f9e8ce0e7b3bfde79 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix a bunch of compiler warningsLars Knoll2020-08-281-4/+4
| | | | | | Taks-number: QTBUG-86234 Change-Id: I4c945edecdbe55bc5587c18599d49dfb82ade1eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate load(qt_app) projectsAlexandru Croitor2020-08-261-6/+5
| | | | | | | | Use the new qt_internal_add_app function. Task-number: QTBUG-85757 Change-Id: I455443a29511c809d2ad87073b2ae685fdbf27ae Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove last remaining use of QStringRefKarsten Heimrich2020-08-231-1/+1
| | | | | Change-Id: I91685ac4cf1f5186d58252587fb8c7d7375372b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: fix import java scripts from moduleEvgeniy A. Dushistov2020-08-222-0/+11
| | | | | | Fixes: QTBUG-86183 Change-Id: I4809cb5a408eb4e668f802cf0d7b7a872d1ed4b7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: fix handling of "if else" inside "if" in "if else"Evgeniy A. Dushistov2020-08-202-14/+41
| | | | | | Fixes: QTBUG-86060 Change-Id: I7a191c451793bf4e1f6a2bd02ceb36b5957136c2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Improve the QML/JS type readerUlf Hermann2020-08-204-9/+8
| | | | | | | | Don't alternate between paths and URIs if we only need the URIs, and don't rely on casting from ASCII to QString or QChar. Change-Id: I4c206d5ff488939d5d2d78a3694d8eaf54ec5ec1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: handle signals defined in qml fileEvgeniy A. Dushistov2020-08-191-11/+20
| | | | | | | | | FindWarningVisitor for signal add property "signal" + "Changed", so it was impossible find "singal" and "onSingal" names. Fixes: QTBUG-83793 Change-Id: I5a62211f413f543fdb6bf00e0ab921561d7a9643 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Initial work on handling Qt Qml static pluginsAlexandru Croitor2020-08-135-208/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5 we added a QmlImportScanner package that provided a qt5_import_qml_plugins() function. Calling it with a target ensured running qmlimportscanner to find and link necessary qml static plugins for an application to work. This is the initial port of that to Qt 6, with a few differences. It introduces 2 function names, the version-less one and qt6_ prefixed one, qt_import_qml_plugins and qt6_import_qml_plugins. Implementation notes. In Qt 5 we figured out what link flags to pass by parsing the plugin prl files. In Qt 6, CMake can generate appropriate plugin targets with dependencies, as well as Config files that can look for the dependent packages. Use that information for finding the dependencies and linking. Note this relies on the assumption that find_package(Qt6Qml) will already include all available Qml plugin Config files, so that the targets exist in scope by the time qt_import_qml_plugins is called and links against those targets. The automatic inclusion is handled by a change in qtbase. In Qt 5 the function was available as part of QmlImportScanner package. In Qt 6 the function is moved to QmlMacros, so it's enough to find_package(Qt6Qml) to use it. A dummy QmlImportScanner package is provided for backwards compatibility, that simply finds the Qml package. Another change is to make the resource name added by qt6_target_qml_files unique (include the target name), because qmlcachegen generates a cpp file with a static initializer function name that includes the resource name. This caused duplicate symbol errors when linking more than one qtquickcontrols2 style plugin into an application when the resource name was not unique. There are a couple of TODOs left: - Figure out if it's possible to automatically call qt_import_qml_plugins for applications that link against Qml. Perhaps using our hacky scope finalizers. - Figure out how to handle scanning of resources. Task-number: QTBUG-85961 Task-number: QTBUG-85994 Change-Id: I42f61e4acc6f74a3cdc030dba9e41ce789bc28f6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move functionality to read types from QML files out of qmllintUlf Hermann2020-08-139-92/+223
| | | | | | | We want to re-use this in other tools. Change-Id: I2a8cd104d54c1fa9b2898213b0b9e09719e42bca Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Compile against latest qtbaseLars Knoll2020-07-091-1/+1
| | | | | | | Adjust to the lastest changes in QList and QString. Change-Id: I216b2746a3305222a21c5aead3aec6106ac1f035 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate projectsAlexandru Croitor2020-07-0920-56/+76
| | | | | | | | | We need the qt_add_tool changes to successfully configure qemu builds. The rest of the changes are just to be in sync with the .pro files. Change-Id: I7bcc08ac58f57a5761aedef09761428c55235289 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qmlformat: Allow for minor and major versions to be omittedMaximilian Goldstein2020-07-081-2/+8
| | | | | Change-Id: I85897930980bb98ba9f968cdf70696547493b1d5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlimportscanner: Use QmlDirParserUlf Hermann2020-07-081-67/+95
| | | | | | | | | | | | | | 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 <fabian.kosmale@qt.io>
* qmlplugindump: Fix handling of dependenciesUlf Hermann2020-07-081-58/+61
| | | | | | | | | Tolerate dependencies without version and don't write them into the output anymore. No one should read them as the same info has to be available from the associated qmldir files. Change-Id: I5e4cd93c83cb5e874a8a6e1467461d081b1a089c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Prepare Qt5QuickCompiler.cmake.in for Qt6Ulf Hermann2020-07-055-97/+17
| | | | | | | | | | Increment all the version numbers. Replace qtquick_compiler_add_resources with a warning and a call to qt6_add_resources. Task-number: QTBUG-85190 Change-Id: Ifed5449ab4d6312a57add870eee13175872146db Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qmlformat: Fix handling of empty blocksMaximilian Goldstein2020-07-021-1/+7
| | | | | | | | | | Empty blocks were often not handled properly. (i.e. in if, for and while blocks) Fixes: QTBUG-85321 Pick-to: 5.15 Change-Id: I4035dd239a095814362e0aec142b387dc113f282 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix template literalsMaximilian Goldstein2020-07-021-0/+6
| | | | | | | Fixes: QTBUG-85317 Pick-to: 5.15 Change-Id: I52589b681690a55f7bba7d7d9c675dc22ffa1587 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix multiline bindingsMaximilian Goldstein2020-07-011-0/+12
| | | | | | | | | | Some bindings may turn multiline while formatting. This change makes sure this is handled properly. Fixes: QTBUG-85289 Pick-to: 5.15 Change-Id: I6df98b926d69a23480003c3d9705bc34c3dd0d5d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Revive QTQUICK_COMPILER_SKIPPED_RESOURCESUlf Hermann2020-06-301-0/+12
| | | | | | | | | There are valid reasons not to compile some resources with qmlcachegen. Pick-to: 5.15 Fixes: QTBUG-85243 Change-Id: I9a1233864ed5dda0c264e61db596a9d8c80ea1f3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-4/+4
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Resolve enums from parent typesUlf Hermann2020-06-261-15/+20
| | | | | | | | Fixes: QTBUG-85185 Fixes: QTBUG-84036 Change-Id: If0989a85df93903fee6cb146a515cd362160ff49 Reviewed-by: Evgeniy Dushistov <dushistov@mail.ru> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Add files optionMaximilian Goldstein2020-06-251-4/+29
| | | | | | | | Adds a flag for formatting files listed in a file Fixes: QTBUG-85078 Change-Id: I235db3ad52291d2c211b092b8505340728be3949 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix nested functionsMaximilian Goldstein2020-06-252-4/+15
| | | | | | Fixes: QTBUG-85035 Change-Id: I5e1cb003b7b84547e3408a086eebf3be740e6860 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix inline componentsMaximilian Goldstein2020-06-252-0/+44
| | | | | | Fixes: QTBUG-85189 Change-Id: I2b30595b44d14b89406b126d3d148f51f8bfbca4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Properly process qmldir imports and dependenciesUlf Hermann2020-06-242-105/+83
| | | | | | | | | | | | | | | | | | We don't want to pick the dependencies from the qmltypes files. Rather, parse them directly from the qmldir. Do process versions, too. Also, import explicitly given qmltypes files only once, and don't expose QML types from dependencies as actual types. Hide them behind an inaccessible prefix. For the inaccessible prefix to work, we need to import the C++ class names without the prefix. The prefix doesn't make sense for C++ names anyway. In addition, properly process version-less imports. Change-Id: If582ad271db35351d219332c319571a814628fe0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Discern between "auto" and versioned imports in qmldirsUlf Hermann2020-06-241-2/+2
| | | | | | | | | | | | | 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>
* Do not resolve URLs when assigning them to a propertyUlf Hermann2020-06-221-1/+1
| | | | | | | | | | | | | | | We don't know in advance if a URL is part of the source code and should be relative to the current element, or if it is part of the application data and should not be touched. [ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or intercepted anymore when assigning them to a "url" property. Instead they are resolved and possibly intercepted when used to access an actual resource. Fixes: QTBUG-76879 Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: search methods and properties also in attached typeEvgeniy A. Dushistov2020-06-191-22/+45
| | | | | | | | | | | | | | I changed the strategy of traverse via related types. Before: traversal happens only via linked list type -> type->superClass After: traversal via binary tree formed by attachedType and superClass I use pre-order strategy, current type, then all attached types, then all super classes Fixes: QTBUG-84861 Change-Id: I4a8fce869bc541de6900514d29575174d2753f02 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>