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>
Now using new NSButtonTypes and NSBezelTypes instead of the ones
that have been deprecated since macOS 10.14 (new types have been
available since 10.12).
Also uses pixmap(QSize, devicePixelRatio) in favor of the deprecated variant using QWindow.
Change-Id: Ia87dbcee0962267b3e279febe449e1f198172a14
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Using a QFlatMap for an enum-to-object mapping when the valid enum
values are {0, 1, 2} is complete overkill.
A std::array<T,3> has both a more convenient API, and much more
efficiency.
Add some assertions.
Pick-to: 6.3
Change-Id: I6958302d1a7d0fd591e38efeea8291b3e9cc7212
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Since we can neither rely on the C++20 replacement, [=,this], nor use
[&] here, name all variables explicitly.
Amends a318e6f354.
Pick-to: 6.3
Change-Id: Iecc8e9653b2e2f728b1dda7c34e48facc76ce835
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This code was actually ok (no UB), but it's in the way of making
QMutableEventPoint a befriendable namespace, so port from using
QMutableEventPoint to QEventPoint instances + QMutableEventPoint
static setters.
Task-number: QTBUG-99615
Pickt-to: 6.3
Change-Id: I7ddcf154cb5da9b6ea2f0f0d8cac130a28203371
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
...by putting each test case into its own file.
Task-number: QTBUG-98350
Change-Id: Ie77e07eacef1acbafd9c3a5e3613de21f5d39a78
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
...with an environment variable for now, to enable development and
testing.
Setting QSG_RHI_HDR to scrgb (or extendedsrgblinear) will request an
scRGB+RGBA16F swapchain. Setting it to hdr10 requests
HDR10(PQ)+A2RGB/BGR10. Otherwise the format stays the default SDR
RGBA/BGRA8.
When something is requested and is not supported for the window, print
a helpful message in the logs with QSG_INFO=1. When supported, the logs
will contain a Creating scRGB/HDR10 swapchain message.
In multi-screen configuration it is important to remember that the
position of the window may be important, depending on the windowing
system. Just having one HDR-enabled display does not mean the
application will launch with the requested HDR format - it may only be
successful if the window is positioned on that particular screen upon
startup. When in doubt, disable all non-HDR screens and try running with
the single HDR-enabled one.
Change-Id: Icf4994d86e39d0fafb3b1321229fc7be1500b372
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Be consistent in handling a failing create(). Do not try to enqueue
resource updates if we did not successfully built the buffer. Do not try
to render either.
With just a few checks we can now fully survive failing all vertex/index
buffer creation (i.e. warnings will be printed and nothing will be
rendered by Quick, but the application will continue to work). This
matches the behavior one gets when the uniform buffer creation fails,
that is already robust enough.
Pick-to: 6.3 6.2
Fixes: QTBUG-99477
Change-Id: I2ca0f3ada8a7449c5ac1346216a58b06658b5cd5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
If we haven't built the library ourselves, we can't find its qmltypes
this way.
Pick-to: 6.3
Change-Id: I2dba9cfa7a3574df5a34a6cfbd5d34aae9515171
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
I was running into a crash (it didn't reproduce with a minimal example,
and I'm still not sure exactly what caused it) related to models and
views, and saw that there m_count was negative, which shouldn't be
possible. Adding this new assertion allowed me to find the issue in my
code.
Pick-to: 5.15 6.2 6.3
Change-Id: Ie467e749dbf95799618bd04591e50b0038cf3399
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
If QQuickTextAreaPrivate::ensureCursorVisible() calls
QQuickFlickable::setContentY() while the Flickable does not yet know the
extents of its new content, it caused a crash when
QQuickScrollBarPrivate::visualArea() called qBound(0, 1, -something).
We need to wait until Flickable knows it can scroll that far. It turns
out ensureCursorVisible() is called several times anyway, so it's OK to
skip the calls that would ask the Flickable to scroll out-of-bounds.
Pick-to: 6.3
Task-number: QTBUG-99582
Change-Id: Ifb374a81591df49d3c571f55cb3076a78a808918
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This makes it a little bit easier to find information about the actual
code used for pushing/popping/replacing items.
Pick-to: 6.2 6.3
Change-Id: I34adee9a54f0675dcbb635b2448260ea9592f374
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
We need to check for the contents of the tag file, not its name. We need
to strip the contents before checking. We need to run git in the right
directory. We need to fail if we cannot find any QML_COMPILE_HASH.
Pick-to: 6.3 6.2
Task-number: QTBUG-99608
Change-Id: Ic42a073b196143f8576a84e7a4531b5f2927fb68
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
No setters are called on 'p'.
Task-number: QTBUG-99615
Pick-to: 6.3 6.2
Change-Id: I3bd9fe7e3d442577035a3112d7fbdeb5b2774a11
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
No (QMutableEventPoint-only) setters are called on 'point'.
Task-number: QTBUG-99615
Pick-to: 6.3 6.2
Change-Id: I7282bfeacae8ab568f7da9357498546f60d1a109
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>