The argument "-a" passed after "--" was being interpreted as the -a
option of the qml tool itself instead of being passed along to the qml
program as a positional argument.
Fixes: QTBUG-136120
Pick-to: 6.9 6.8 6.5
Change-Id: I602aea84e4766abeb47adce0f739f12315a70b24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Due to unknown reasons, if the qml_tool target links twice to
the Qt6::Qml target, the qml_tool_autogen target loses almost all
dependencies on other autogen and sync_headers targets, but most
importantly on Qml_sync_headers.
This can cause bad race conditions during the build.
Apply a hacky workaround of removing the duplicate linking to Qt6::Qml
which appears to resolve the issue, and brings back the correct
dependency.
This might be an issue in upstream CMake, but requires further
investigation.
This change is meant to unblock merges to qtdeclarative.
Pick-to: 6.8 6.9
Task-number: QTBUG-133725
Change-Id: Ib6b41d36a19f5d9e1c9fa96aabfbc00f5870990f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
We are sporadically seeing weird failures on macOs that the types from
the module are not available. This could not be reproduced reliably, but
we suspect that the linker might discard the (static ctor invoking the)
registration function.
Avoid this by calling it explictily.
Change-Id: Ic405dd5f226af3580efe7dd5d8202a6a263a367e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Target was previously named `qml`, which overlaps with the target name
in `src/qml`. At least in the case of the (officially unsupported) MSVS
generator, this resulted in an invalid build configuration (generated a
solution file containing two projects with the same name).
The target name was used to determine the name of the app's executable
file (e.g. `qml.exe` in Windows). This is now achieved through the
`OUTPUT_NAME` target property.
Change-Id: Ifbccceab11c8ad23e7f1b7a8cc7570d66cb6941f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It works since 6.6 regardless, but the help text had no mentioning of it
at all.
Also use the nicer "opengl" instead of "gl" (both are accepted by
QSG_RHI_BACKEND anyway)
Pick-to: 6.7 6.6
Change-Id: Ibf6de9411d8641d244b8750fd7a015781a9297b1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
According to QUIP-18 [1], all tools file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I109277d926cb95d45306fd0fe176451baee201cc
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Resize guards were prohibiting the initialization of the top level
item size to the window size in a qml script when executed with
the qml tool. This is usually fine because the window size is set
to the item size. However, if this is not possible (minimum window
size from the system, no explicit size on the item), the item has
a different size than the window. The item would only be adapted to
the window size after resizing the window.
This patch removes the resize guards to make the item always fill
the window on startup. The resize guard should hopefully not be needed;
the QQuickItem setters for width and height return early if it's
unchanged; QWindow::resize() does not emit changed signals if there
is not yet a platform window and width or height is unchanged;
and we hope all the overrides of QPlatformWindow::setGeometry()
will avoid making unnecessary changes. However the guards were added
in 8d9a7e47aa and I don't remember
exactly why.
Adds the test tst_qml::itemAndWindowGeometry to check combinations of
--config, --qwindowgeometry and qml files whose root item has or doesn't
have its own dimensions, or changes its dimensions after being shown.
Done-with: Matthias Rauter <matthias.rauter@qt.io>
Pick-to: 6.5 6.6
Fixes: QTBUG-114068
Fixes: QTBUG-116753
Change-Id: Ib972e0bfc25809441d378c53dabb60653314f5a6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This handles the --version, --help and --help-all options.
Apparently there's no other way to handle --help-all, because
addHelpOption() adds two options but only returns one of them.
Amends bb6602bca2
Fixes: QTBUG-100678
Pick-to: 6.2 6.5 5.15
Change-Id: Iddd1ba2dae975d7256935d8d357e2f3ac6c013d6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Use qt_add_qml_module correctly, apply a standard resource path, and
move the files into the same directory as the module. Use upper case
file names for the (re-usable) container definitions and lower case file
names for the configuration entry points. This way we only need one
directory and therefore only one QML module.
Change-Id: Ic45dd0e8866f8f62bbaa639b6f138e9a75e05863
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Otherwise we leak a lot of memory if any of the exit() calls is
triggered.
Change-Id: I338abe2ef63217e6b80ffc2f8fe65d9cac03d994
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The QTranslator was destructed right after it was loaded because it was
inside a scope
Pick-to: 6.5
Change-Id: I8c9d1604652f18f7d15aa7a0045f580cd8a25063
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Restore the --transparent and --multisample options. Also make the
default QSurfaceFormat setting universal (no need to tie it to the
option of forcing a core profile context), and prevent the warning
that is printed when the default surfaceformat is changed after the
application is already created with AA_ShareOpenGLContexts set. This
involves having to handle the relevant arguments manually early on,
not through QCommandLineParser.
All this matches the qmlscene behavior.
NB qmlscene requests 16 samples with --multisample which is completely
pointless in practice. Use the common 4 now.
Change-Id: I671e5f22846a715675ea936bb7cf2a31a849dc28
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
When shaders are generated dynamically, such as with QtQuick3D, cached
shaders may get out of date if the QML file is changed.
Change-Id: I2c5484765e30da5c13fd175a9fcbad2473d55e62
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
We're not actually interested in whether an object is a window, and we
don't really care how many objects are created. The only thing we need
to know is whether at least one object is alive after all files have
been processed.
Pick-to: 6.5
Fixes: QTBUG-110112
Change-Id: I8d79359f3fb7ec5a54545dc5858cf310b0f52935
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
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 <fabian.kosmale@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Since "/qt" is reserved, we can use "/qt/qml" as the default path for
user QML modules.
[ChangeLog][QtQml] The AUTO_RESOURCE_PREFIX option was added to
qt_add_qml_module(). It places your QML modules in the otherwise
reserved resource directory /qt/qml. This directory is also added to the
default QML import path. By using it you don't have to specify custom
import paths anymore. Specifying neither AUTO_RESOURCE_PREFIX nor an
explicit RESOURCE_PREFIX will generate a warning now because such QML
modules are likely invisible in the resource file system.
Fixes: QTBUG-95145
Fixes: QTBUG-103452
Change-Id: Ie27dec5cbf34ea06258d55c659d202cdd61e54b2
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
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 <shawn.rutledge@qt.io>
If you do QUrl::fromLocalFile() on a file name starting with ":" you get
a rather curious URL.
Change-Id: I07d35e792b87a66fffc9c992462d92a4c0c8040d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Before, they were tools, which means they are not built when
cross-compiling. However, all these tools are likely to be desired on a
target to run QML-only projects.
The earlier way to build these apps for a cross target was to set
QT_BUILD_TOOLS_WHEN_CROSSCOMPILING to ON. That seems like overkill.
Pick-to: 6.2
Task-number: QTBUG-96454
Change-Id: Ibbdc4e4599b0c798ddbd96804a0bbb821f546415
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
[ChangeLog][QtQml][qml] The QML Runtime tool's --dummy-data option
is now deprecated, because context properties are deprecated. This
option will be removed in a future version of Qt.
Task-number: QTBUG-96800
Change-Id: Id6ef8a384f6239ddeebd6c4f84854bbeaf630279
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Also, --list-conf will now list the conf files that it finds;
and --verbose will show more information about the path(s) to them.
[ChangeLog][QtQml][qml] The QML Runtime tool's -c / --config option
now can find a directory containing a file called configuration.qml
under QStandardPaths::AppConfigLocation, in addition to being able to
give the full path to the configuration file, as before. I.e. on
Linux you could write a custom configuration into
~/.config/QtProject/Qml Runtime/myconfig/configuration.qml
and then use it via qml -c myconfig somefile.qml. The --list-conf
option will list the configurations that can be found in this way.
Task-number: QTBUG-26366
Fixes: QTBUG-96740
Change-Id: I72798b22255b71b9d4184a67f86b249766b64233
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Instead of std::exit() use the early return mechanism we already have so
that any existing objects are gracefully destroyed.
Change-Id: Icb197879cc33ab22f07fc1486da44f9ff5b177bc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The new option allows the caller to state more clearly that they do not
want a plugin at all. Previously, the NO_CREATE_PLUGIN_TARGET option
had to be given to prevent the command from trying to create a plugin
target, but that option is meant for when the project will create the
plugin target later.
Now that the caller has a way to explicitly say they don't want a
plugin, require PLUGIN_TARGET to be given if NO_CREATE_PLUGIN_TARGET
is present. This forces the project to provide the name of the plugin
target that they will be responsible for creating.
Fixes: QTBUG-95141
Pick-to: 6.2
Change-Id: I84e036074f3e2785f17a8d33ad87ee0b7e016173
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The existing CMake API for qml modules had a number of
shortcomings. Refactor it to achieve the following:
- Clearly separate public and internal aspects.
- Re-use code from qtbase for adding plugins and module
targets rather than reimplementing close variations.
- Provide more robust and complete support for qmllint,
qmlcachegen and automatic generation of qmldir files.
- Reduce the steps needed for more common scenarios.
- Encourage the use of separate backing library and plugin
targets.
- Automatically generate the plugin class .cpp file where
possible.
- Specify .qml files directly through qml-specific API
elements rather than assuming they can be extracted
out of a set of resources.
[ChangeLog][QtQml] The qml CMake API has changed from 6.1
and is now out of Technical Preview status. The most
notable change is that .qml files should no longer be
specified as resources, there is dedicated handling for
them in the qt6_add_qml_module(). A related change is
that the qt6_target_qml_files() command has been replaced
by qt6_target_qml_sources(). More complete integration
with qmlcachegen, qmllint and qmldir generation is also
part of the CMake API.
Fixes: QTBUG-91621
Task-number: QTBUG-82598
Task-number: QTBUG-88763
Task-number: QTBUG-89274
Task-number: QTBUG-91444
Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Rather, parent them to the watcher. The watcher lives in the main()
function's scope.
Change-Id: I2ac1d14d80d4100756a3ad94b6502d46fda30074
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The .pro files corresponding to the .prev_CMakeLists.txt files
have already been removed.
Change-Id: I254eafe4c7de1a516e33bd9cb3d9879e73fa83b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The qml utility now uses context sharing by default, as previously done by qmlscene.
It can also be disabled in the same way, by specifying --disable-context-sharing.
This is needed for compatibility with QtWebEngine among other things.
Fixes: QTBUG-85107
Change-Id: I6155d32dfc55b385d33e1c805dae601b9710427e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Already possible to do the same using environment variables but this ensures greater compatibility with qmlscene
and better ease of use.
Change-Id: I214aec41aad4369f54bca887e91ccb879153c8be
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The "qml" tool was the only way of loading QML files that would respect
a shebang line. This is problematic as this way you cannot load such
files programatically using QQmlComponent, limiting their re-use. Common
tools like Qt Creator, but also qmllint, qmlformat, qmlcachegen, etc
would not recognize files with shebangs.
By moving she-bang support directly in the lexer all tools implicitly
support it.
Note that we could just as easily support '#' as extra comment
character along with //, but here we narrowly add support for in
the first line only, as node does (this means that javascript files
using she-bang accepted by node, are now accepted also by qml).
The only tool needing some adjustments is qmlformat, that has to emit
the she-bang again as she-bang and as first line.
Add tests for qmlformat, and sprinkle some she-bangs in the other
tests just to be sure it doesn't affect anything.
Change-Id: I1f6d881c7438bdb23163b5dbe829d59a35d11132
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Remove all qmake project files, except for examples which are used to
test that qmake continues to work.
Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Make sure all properties are added when cross-compiling the tools.
Pick-to: 6.0
Change-Id: Ifec0d2e2a1de2c3302ccf71ba897993d57bed205
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Modify special case locations to use the new API as well.
Task-number: QTBUG-86815
Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
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>
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>
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>