Use the animation driver subclass as the only place that calculates
the vsync interval. Do not replicate (in a slightly different way) the
same logic in the threaded render loop. Make it possible to query this
value via the context interface. Also fix up some types.
Change-Id: I80257499ad95d3c043f5467c0b8d5b107f0c06a1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Just like we have e.g. QSG_NO_DEPTH_BUFFER, it is highly useful to
have a QSG_NO_VSYNC which is folded into swapInterval=0 which is then
mapped to QRhiSwapChain::NoVSync, i.e. both OpenGL and other APIs will
be happy. Thus one can, if so desired, try disabling vsync-based
blocking without modifying the application.
Now, since we know if there is at least one window that has
swapInterval == 0 set, the threaded render loop can recognize and
handle this: the same way it falls back to the system timer based
animation advancing when there are more than 1 visible windows, having
a no-vsync window can trigger the same. This way the animations
advancing too fast issue disappears (at the expense of potentially
more stuttering) whenever explicitly requesting the disabling of
vsync-based throttling.
In addition, expand the scenegraph docs around this topic.
Note however that this does nothing for animators (the render thread
animators). Those do not have a fallback option at all. If the render
thread spins too fast, they will advance too fast.
[ChangeLog][QtQuick] In addition to setting the swapInterval to 0 in
the QQuickWindow's QSurfaceFormat, one can now also set the
QSG_NO_VSYNC=1 environment variable to achieve the same (applies
globally to all Quick windows in the application). The threaded render
loop can now recognize that one or more windows have vsync-based
throttling disabled explicitly, and if so, it will fall back
automatically to using system timers to advance animations in order to
prevent animations from running too fast when the presentation rate is
not throttled by vsync.
Fixes: QTBUG-99950
Fixes: QTBUG-99951
Change-Id: Iddda81b467b48dbb8d87748868daa8d922ad1bd0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
isList is a possible property of Parameters in qmltypes files and is
used by QtCharts, for example. This adds it to our tooling module
so qmltypes using it pass qmllint's tests.
Pick-to: 6.2 6.3
Change-Id: Ie25e8550ecc3fa84e0150cbf05df3631337f504d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
It's tool, which means it's not built when cross-compiling. However,
it's to be desired on a target to run QML-only projects.
The earlier way to build app for a cross target was to set
QT_BUILD_TOOLS_WHEN_CROSSCOMPILING to ON. That seems like overkill.
Task-number: QTBUG-100040
Pick-to: 6.2 6.3
Change-Id: I64236fb00a5d69862ce0c34ef9afca092d5d0436
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously it was only excluded on ANDROID, but cross-compiled for
other platforms.
The executable should only be built when the target Qt is meant
to be used as a development SDK, to be executed on some host machine.
Because at the moment we lack a proper abstraction for that, as a work
around, we exclude building it when cross-compiling.
The executable is not called automatically by any test, it is only run
manually by a developer.
In the future, the qt_internal_add_tool call should likely be replaced
by a customized qt_internal_add_app call, installing the executable
into $prefix/libexec rather than $prefix/bin.
Amends 5a55e52638
Pick-to: 6.2 6.3
Task-number: QTBUG-92591
Task-number: QTBUG-100040
Task-number: QTBUG-100047
Change-Id: If20e73fe378acd51fe41d181078d273a7842fc81
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Always use FindPython instead of find_program because the former
looks for Python in more locations (like the Windows registry).
We switch to FindPython instead of FindPythonInterp because the latter
is deprecated, and the former is available in our minimum support
CMake version (3.16).
Because find_package is called in configure.cmake that is called by a
function() call, we need to make the found interpreter a cache
variable to make it available outside of the function.
Pick-to: 6.2 6.3
Fixes: QTBUG-99273
Change-Id: Idb6620a01b4b5764f130f9dc5780d73cd2151965
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Provide convenience wrappers for access to const/mutable data, properly
discern between the "buffer" object and the actual data, especially
regarding shared/detached state.
Change-Id: I48f1f1eb8c204c29277746e5dee63892cbf3ac89
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Log the differing hashes in case of a mismatch.
Pick-to: 6.2 6.3
Task-number: QTBUG-99608
Change-Id: Id85306d3cfdb08d235c8717b441105c5d0b68cf3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Problem:
The first delegate after a section delegate would have the same position
as the section delegate, if the section delegate is invisible during
initialization.
In case the section delegates become visible later on during program
execution, the delegates would be re-positioned again in the
QQuickListViewPrivate::layoutVisibleItems function.
But this would not call setPosition for the first item (delegate).
It would only call setPosition for all delegates after the first one.
This would mean that the position for the first delegate would never be
updated, after the delegate was first created.
Solution:
Call FxListItemSG::setPosition() for the first item in
QQuickListViewPrivate::layoutVisibleItems, just like we're already doing
for all the items after the first one in the for-loop.
Fixes: QTBUG-94848
Pick-to: 6.3
Change-Id: I34a5ada336ab507b31e3675a1c11eba066fa139a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Apply the same exceptions for macOS that are used for windows in select
places, and increase the timeout in changeDirectionWhileRunning().
Fixes: QTBUG-81938
Change-Id: Idae5ae8d125f106dcb74b75be2df0c417363e7cc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add initial qmltc tool documentation with introduction,
compilation process picture, description and limitations
To simplify the description, we can consider some simple
application. The same app can additionally become a test
scenario for qmltc and a showcase of its capabilities
Task-number: QTBUG-84368
Pick-to: 6.3
Change-Id: If6d586a8c68f48d17133b25170d0fff627e2066c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Otherwise we end up with unmatched curly braces in the generated code.
Pick-to: 6.2 6.3
Change-Id: I4c24d4062a8ed54cd6a9ecb43dfd2b5d0a26c9e1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
The previous code gave the impression that we actually had a C++ type
there. We haven't. The whole metatype is built only on QObject. Admit
that and simplify accordingly. Also provide a way to retrieve the
correct metaobject. A metatype for a QObject* that doesn't provide a
metaObjectFn is unexpected and causes crashes elsewhere.
Change-Id: Iccb0b72d325ea77fb0cf83f7acbe2ef9fe0e06b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
That's where the data resides. This allows us to lock the mutex only
once for all those methods, and it makes a large number of engine
pointers unnecessary.
Finally, we can now find the element type of a QQmlListProperty without
supplying an engine.
Change-Id: If1ae8eafe8762a112d1ca06f9c92ab8a727d1bda
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It is just in line with the other propertyCache() methods, and should be
treated the same way. The comment made no sense anymore. This allows us
to drop more engine pointers.
Change-Id: I2e9b479b555c7f771b619e4693d59cbfcf244df6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
There is no reason to drag an engine around for those.
Change-Id: I02100b207f197e75dfd458ff1cce5c4920dd94bd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The only type needed for resolving enums is builtin "int". The base type
of a composite type is always identified by QML name. Trying to resolve
it based on C++ names does nothing at best.
Pick-to: 6.2 6.3
Change-Id: I943e2bdac75b9258c5eafaaa8760993e61e59d99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is how URIs are defined and how we store them in our caches.
Without this, we cannot find modules with multi-part URIs imported using
-i.
Pick-to: 6.3
Change-Id: I86b02b2c2102a2d4edd8c20388c6cd9b1e92b0ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We only need to compare with nullptr for that. So far it did a
{to|from}ScriptValue.
Pick-to: 6.3
Change-Id: Ie09fd0e912a1e4ca695c7126b8cbf87a470d921c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In most cases we won't intercept. Calling a function just to figure out
that there are no interceptors or that the call type doesn't match is
expensive.
Also, better encapsulate the class and initialize members inline where
possible.
Pick-to: 6.3
Change-Id: Id545c98bc52690c75014b1283edb72a241750960
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The two types are equivalent in what we can store in them. However, as
var properties are considered to be QVariant, falling back to QVariant
results in fewer type conversions when returning from binding functions.
We rarely want to handle QJSValue explicitly.
Pick-to: 6.3
Change-Id: I0afed723e02982e28b33e35671224fd04689d09c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Re-defining them for each single sequence object is quite expensive.
Pick-to: 6.3
Change-Id: Ia7a602aada6f9904dd3a72ad5788482576170d9e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Assigning to a QQmlListProperty does not do what you think it does.
Pick-to: 6.3
Change-Id: Ie6ac3208d552d8f40d9f2f4d7fb33c1cd64e4b79
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Previously we treated null as a generic primitive value (in functions)
or as a var type (in literal bindings), this change ends this practice
by introducing an uniform null type used everywhere and defined in
builtins.
Now we can also properly warn about setting properties to null if they
aren't variants.
Fixes: QTBUG-98409
Change-Id: If32420a59948696491f24521bbc0f251095a9699
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Makes qt.labs.platform use declarative registration which also allows
the plugin to become optional now.
Change-Id: I800b567c52e118485e08cf350509e312c7d01b5f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Automatically suggests fixes if a user has a typo in the naming of a
component, property or binding.
Also now warns about calling undefined functions.
[ChangeLog][qmllint][New Feature] qmllint will now automatically suggest
fixes if it thinks a component, property or binding was not found due to
a typo.
Fixes: QTBUG-97693
Change-Id: Ia66c1ba84e187a2eb31bbdf33ca30d7e5141bea9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If a file sets pragma Strict, it expects to be fully compiler
compliant, so let's enable the warnings for that by default.
Fixes: QTBUG-97081
Change-Id: I0b388f64d99846ee0c03e24397b3a997d4b0173b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This caused clang warnings and doesn't seem to have any
use anymore.
Pick-to: 6.2 6.3
Change-Id: Icc34cddbd32b2e59df662ae1e3796c7b3aae1155
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
It's only used for the image provider. All other uses are pointless
because the respective functions are either re-entrant or protected by
other mutexes.
Change-Id: Id1d2f58955e0439421081764dff6ce6152006fda
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This way we can retrieve them without an engine. Since we construct a
new QMetaTypeInterface for each composite type we load, those
QMetaTypeInterfaces will still be unique even if the same type is used
in different engines. Therefore, we can store them all in the same
container.
This exposes the fact that we don't actually register composite types as
"custom" QMetaTypes in registerInternalCompositeType(), but we expect
them to be registered later on, in particular in
unregisterInternalCompositeType(). Retrieve the IDs once, in order to
have the types registered right away.
Change-Id: Ib8e875a5c950f105996877ea597a6de2b01aa1f5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QML sequences are required for named lists of value types. The original
reason for the introduction of this feature was the template code
explosion caused by the way the sequence types were registered in Qt5.
As we register them differently now, the code size overhead should be
smaller. It makes very little sense to switch sequence types off these
days.
[ChangeLog][QtQml][Important Behavior Changes] The qml_sequence_object
feature flag has been removed. Omitting sequences from the QML language
does not make much sense now that we use them for lists of value types.
The original reason to allow it was that the sequence support took up a
lot of space in the binary. This is not the case anymore since 6.0.
Change-Id: I2f1d43cdd29ba63853316b06113cb49ed30aa410
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use multi-arg arg(), make local functions static, move defition of
operator== to the type it compares.
Change-Id: Idb75247c0ae3e7132724d5a6351ab5d5fa8a9144
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
There is no clear mapping between qmake and CMake build types.
Therefore, apply a heuristic to find the best one for a given build.
Conversely, if we have an infix build, the explicit infix is
missing from the metatypes file names. Therefore, strip it in
qmltypes.prf, too.
Furthermore, remove the special case for building Qt modules with
qmake. This is rather unlikely to work.
Pick-to: 6.2 6.3
Task-number: QTBUG-91706
Change-Id: I6f43225e94930fc960d51792b7b7b1a5db8de1e8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It's a bad idea to import a plugin without loading the module it belongs
to.
Change-Id: I878e7aa9320285c1061b223db5a8399c774f7583
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
It's not particularly slow. It probably was when we were using
QQmlListReference or JavaScript arrays.
Pick-to: 6.3
Change-Id: I1a4575a5b84cdfb732a6c3615d00bbe2abaffc94
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
In QQuickItem, added an opportunistic std::move() as a drive-by.
Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: Ib9426ae7e749036541d5f97824800636b5ccfb5e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
In that case we can just hash all the source files in src/qml to get a
reasonable approximation of a compile hash.
Pick-to: 6.2 6.3
Change-Id: Ifaf2c8145ab16d9f8d23570fa9acbb7a76ebda03
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
...to better match the Qt 5 behavior. For example, trying to assign a
Qt.point() to a vec3 works in Qt 5, setting the 3rd component to 0,
because it just does a blind call to glUniform2fv. In Qt 6 this was not
done initially, and the data copy is based on the value's size, so
one either gets an assert in debug builds, and perhaps a crash or some
strange behavior in the shader in release. Make this safer.
The handling of QTransform->mat3 was broken as well, although it is
unlikely anyone ever used that in practice. Fix it so that we properly
map the 9 floats to the 4-float-per-column layout.
Pick-to: 6.3
Change-Id: Ia4a24bff0e54d94ddb2f5db276f0ed0a2cde0efd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
If we listen for size changes we also need to remove the object listened
to when it's deleted.
Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-99644
Change-Id: I613855ebd986b1e67685088020b88d8b070659cf
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Otherwise qmllint in user code would report missing types.
No type found for property "nameFilters". This may be due to a missing
import statement or incomplete qmltypes files.
QuickTemplates2 has this dependency properly so it should be intact.
Pick-to: 6.3 6.2
Change-Id: I13fadddb053874cc615f071eec473d5641b12d1a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Previously we would not generate an error when an unknown function was
called.
Pick-to: 6.2 6.3
Change-Id: I31845a642afe0fd6038228c4aabf2ef5c6f1140e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Some of the settings tests were broken in a way where they could never
fail, even if the feature was broken. This is fixed now.
Also expanded the tests to also cover the additional qml import path option.
Change-Id: Ibd5b8fde36362ccf0cc3b9d7d639c2485fd6ae77
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>