Commit Graph

13100 Commits

Author SHA1 Message Date
Ulf Hermann 5ae82f7c04 QtQml: Fix code to assign lists to list properties
We need to figure out if the input is also a list, iterate that if
necessary, and deal with the various QVariant cases.

Amends commit b0fc028cb5.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136566
Change-Id: Iab7c2d18b7049eecd0327cbdb7e7c7592b2d2ad3
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-28 12:33:32 +02:00
Fabian Kosmale 3cd39249f8 tst_qmltyperegistrar: Ensure private config values are visible
When using private features like qml_xml_htpp_request, we need to
include the private config header.
This was most likely hidden in PCH build, as those would have added it
transitively.
Amends 8effdd97d9.

Pick-to: 6.10
Change-Id: I935c4ca6f17dcb334e934b28c932a4d5525dd287
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2025-07-25 13:30:56 +02:00
Fabian Kosmale ee089f7900 qmllint: Give root scope the correct type
So far, resolving the id of a root element would have yielded the base
type, which is problematic when you want to expose a property of the
new type initially pointing to that id (as we do in some examples).

Fix this by inserting a mapping from the element to m_exportedRootScope,
which is the scope of the actual root type.
This is similar to what we do with inline components.

Some care needs to be taken, though: if the file name does not yield a
valid QML type, this export should not happen. We also must be careful
to do this early, before processing non-base imports, otherwise we would
end up shadowing types with the same name from explicit imports (e.g.
there's a Connections.qml file in the qmltc test suite using Connections
from QtQuick). We also must not expose types which are lowercase; not
only are those not importable according to QML semantics, but we'd also
would run into issues with "var.qml" shadowing the var type.

Pick-to: 6.10
Fixes: QTBUG-138515
Change-Id: Ie4a2c160cf9eda847da87816a88b17f6a5f3a8a3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-25 13:30:55 +02:00
Fabian Kosmale c7eaffdea6 QQmlJSImportVisitor: Avoid faulty unknown property warning
In QQmlJSImportVisitor::processPropertyBindingObjects, we can encounter
grouped properties. So far, we used the whole compount expression to
look up the property. That would of course not find any property.
We now instead traverse the individual parts of the name, and look up
the property chain correctly on the corresponding types.

We adjust the previously added test for unknown duplicate properties to
work with _really_ unknown properties (that don't exist), and instead
use an adjusted version to prove that the example is completely warning
free – mirroring the issue from QTBUG-138164 in a more minimal way.

Task-number: QTBUG-138498
Task-number: QTBUG-138164
Pick-to: 6.10
Change-Id: I75d17c3c412159f3f6da082f54d99bdf6b3b08e4
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-25 09:54:57 +02:00
Fabian Kosmale e657c7be9d Shortcut: Fix nativeText and portableText when using sequences
So far, nativeText and portableText only considered the singular key
`sequence` property; however, we nowadays promote `sequences` in the
case where you have multiple possible values (which notably happens
when using StandardKey enum entries that map to more than one entry).

To fix the issue, we pick the first entry of the `sequences` list
if it is non-empty, and otherwise fall back to the existing `sequence`
member. Moreover, we decouple the change signals for the two text
properties from the `sequenceChanged` signal, so that we can also signal
a change when `sequences` changes instead.

Amends 15a07dbd30

Pick-to: 6.10
Fixes: QTBUG-96350
Change-Id: I49f9b5a17020a8417a95652c759756cc7fdda1b1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-07-24 12:44:12 +00:00
Kai Köhne 090865a112 Make it explicit that TableView's rowHeight and columnWidthProvider's can also return undefined
Pick-to: 6.9 6.10
Change-Id: I074c817a9e29a385ba2b6b8ee32c06c84853ac99
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-07-24 08:58:51 +00:00
Tian Shilin 2d9db0d0b8 Fix typo: rename sucessful to successful
The function name had a spelling error. This change improves code
readability and follows Qt naming conventions.

Fixes: QTBUG-138625
Change-Id: I91c1153e028b5095ba913f2c7a74e7ce762ff279
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2025-07-23 13:24:57 +08:00
Alexandru Croitor afe28ca1cb CMake: More fixes for QT_CMAKE_EXPORT_NAMESPACE not being available
The _qt_internal_write_qmldir_part function is
deferred to be called in the root CMAKE_BINARY_DIR, where
QT_CMAKE_EXPORT_NAMESPACE is not defined if find_package(Qt6) is not
called in the root of the project.

Make sure to pass the value of QT_CMAKE_EXPORT_NAMESPACE to the
function explicitly, from a scope where it is available.

This avoids errors like:
CMake Error at Qt6QmlMacros.cmake:155 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:::qmltyperegistrar>

  No target "::qmltyperegistrar"

As a drive by, do the same for _qt_internal_deferred_aotstats_setup
and use that variable, instead of the hardcoded Qt6:: prefix.

Add test.

Amends b47555feff
Amends f2889262c8

Pick-to: 6.8 6.9 6.10
Fixes: QTBUG-138559
Change-Id: I9ecf2149737f3522fa61b7188403c8470b5a15d3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2025-07-22 18:07:10 +02:00
Laszlo Agocs e32d335c8f sg: Fix culling in layers
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136611
Change-Id: If2a0a0365ca24360d850ffce98c0bec4a3961976
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
2025-07-22 14:17:21 +02:00
Fabian Kosmale 8effdd97d9 Expose XMLHttpRequest to qmltypes
In QML, one can use XMLHttpRequest. Not so with a plain JS engine. The
reason for that lies in the fact that a JS engine did not have any
network access, because all network functionality was in the type
loader, and the type loader was coupled to the QV4::Engine.
This has changed in d2bc4a4330, but we
stil don't expose XMLHttpRequest to a plain QJSEngine.

Nevertheless, it conceptually lives in the global object, and we need to
collect information about it to enable code completion and linting.

Consequently, expose a function in QV4::Engine, which allows us to
manually trigger the registration, and call it in qmljsrootgen.

Going forward, we should arguably have a QJSEngine::Extension for
XMLHttpReuqest, after which we could remove the hack.

Note that as before, qmljsrootgen prints a few warnings, because we call
functions in contexts in which they must not be called. As before, we
ignore this for now.

As a side-effect, this adds a few more entries to the qmltypes file for
new entries on the global Qt object.

Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: I21e9d62bf075e8d4356db8f357502feb927717e7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-22 10:18:31 +02:00
Mitch Curtis 61d8f8fdf3 Merge BorderShape API into RectangleShape
This takes the code that was originally going to be BorderShape
and merges it into RectangleShape.

Fixes: QDS-15299
Change-Id: I8c1133ee5d916b46ba37b852a069b2034eee5a03
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-07-22 12:58:09 +08:00
Mitch Curtis 38f5e4ad47 tst_qquickmaterialstyle: add test for popup propagation to child item
As a sanity check to confirm that this works for a related follow-up
patch.

Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Ic62c19ba33bd24f0855a224d8120a9b4a324bc9b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-07-22 09:40:54 +08:00
Sami Shalayel 9a907040a0 qqmljsimportvisitor: give base types to attached scopes
It seems that our attached scopes have no base type: they don't inherit
the attached properties or methods because their baseTypeName is not
set.

Therefore, set their baseTypeName, and move the resolveTypes calls
inside of setScopeName() instead of potentially forgetting them after
enterEnvironment/RootScope() calls.

With the (resolved) base type, we know about inherited signals, like
in:
```
Keys.onPressed: { /*here is the "event" argument available*/ }
```
for example where we can insert the "event" JS identifier inside the
QQmlJSScope of the block of the signal handler, now that we now that
"Keys" has a "pressed"-method with one argument "event" on its base
type.

Add a test to make sure that the body of an attached signal handler
contains the JS identifier of the arguments of the attached signal to be
handled. This JS identifier is used later on in qmlls to provide
completions in the body of the attached signal handler.

Also fix LinterVisitor::leaveEnvironment() that starts complaining
about "Component" attached properties that have no child, now that
attached properties have base types.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137736
Change-Id: I8de0158ca9946d5e0e4f4f0a46614385f0edca69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-21 15:21:58 +02:00
Santhosh Kumar fd7b7498c8 Benchmark filters and sorters in QML SFPM
Change-Id: Ia3f3105e58f1fda07b986e5de2f0d2f9b3cce988
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-07-21 11:22:28 +02:00
Oliver Eftevaag 51c5bc0122 PointerHandler: Add handler to parent also on componentComplete()
It was possible for a handler to not be added to its parent item via
data_append() when the handler is created as a property binding:
```
Item {
    id: parentItem
    property HoverHandler handler: HoverHandler {
        parent: parentItem
    }
}
```
In that case, the HoverHandler won't be added to the parent item's
default list property (data), since it's being assigned to a different
property instead (handler).

data_append() was the main way that pointer handlers installed
themselves to items, but it is skipped in this case.

Now we also call QQuickItemPrivate::addPointerHandler() in
componentComplete() if the pointer handler was not already added.

Pick-to: 6.10
Change-Id: I5c797f6abcfb19af7e897354fba39dd536e66140
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2025-07-18 21:17:52 +02:00
Dilek Akcay f28adbaf1d SearchField: Add highlightedIndex and fix ambiguous currentIndex behaviour
The new highlightedIndex property enables control over the highlighted
item in the SearchField. This property follows the same logic and behaviour as the Combobox's highlighted API.

Fixes: QTBUG-137862
Pick-to: 6.10
Change-Id: Ifb2a4fd52f126c6ea6b7e36b2b47e4b0f0115428
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-07-18 11:59:42 +02:00
Semih Yavuz fe8b5d2e4e qqmltoolingsettings: refactor search()
Return structured result instead of bool from search(). Update search()
and read() to adapt the return. Add an isValid() convenience method to
return type. Refactor search implementation into separate helper
methods.

Task-number: QTBUG-107212
Change-Id: I858951f0d4a7714eff01a3e6fcf96f92e2684ae1
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-18 11:59:42 +02:00
Fabian Kosmale 3ab60f40d5 qmllint: Avoid spurious warnings when file selectors are used
When file selectors are used, we loose too much information currently,
as we completely discard everything we know about the type.

[ChangeLog][qmllint] qmllint and the LSP now no longer print warnings
about ambiguous types if file selectors are used, and instead use the
"plain" version. The QML script compiler will still conservatively
reject such QML files. If warnings about such cases are desired,
the new "importFileSelector" warning category can be enabled.

Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: Ia87d5ab62003fe8d7d2ab9569fac2942fb1c7c14
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 11:59:42 +02:00
Fabian Kosmale d7288cbe97 qmllint: Avoid confusing duplicate property assignment warning
If we have no clue what a certain property might be, do not warn about
duplicate binding assignments to it.
It might be a genuine error, but it might also be:
- a property of a type we couldn't resolve; that should warn about the
  type, but not here – it might after all be a list property if we were
  able to resolve the type
- a binding assignment to an instance of a custom parsed type

Note that the attached test case currently would still complain about
the property being unknown, as it fails to correctly handle the grouped
binding. That will be addressed in a follow-up commit; for now we
silence that additional warning with a qmllint comment, putting the
focus on the duplicate list warning.

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: Ib06a4baaef0813a45a20738cbb6efe4cf5e5952c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-17 16:11:53 +02:00
Fabian Kosmale 7dc433b193 qmllint/Quick: Prevent attached property warning in custom parser
Using attached properties in PropertyChanges is not the most common use
case, but it is supported. It should thus not create any warnings.

In general, any custom parser can do whatever it desires with the
bindings it receives. Consequently we skip validation of attached
properties when inside a custom parser.

Task-number: QTBUG-138164
Pick-to: 6.10
Change-Id: I5a523518b6983adb96c2e1ccac7d7944c1956aa5
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-17 08:48:50 +02:00
Sami Shalayel 6109b3a58a qmlls: implement go to definition for singleton types
Implement go to definition for singleton types defined from C++ or QML.

Fixes: QTBUG-130801
Task-number: QTBUG-128393
Change-Id: Ib1f44886d2028c23ef60084ff045b44e99d897bc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-15 13:58:15 +02:00
Frédéric Lefebvre b74e821906 Remove ImHiddenText from password echoMode to enable virtual keyboard
ImHiddenText when using the password echoMode makes virtual keyboard
unaccessible if not tagged as accessibility tool, such as the gnome
keyboard for example.

Remove it to enable the use of virtual keyboard.

This change does not have any effect on the text displayed and does not
impact the security/confidential aspect when entering sensitive data in
a textInput.

Enable users who do not have access to a physical keyboard to still
input senstive data, such as passwords, on their machine.

Characters are shown as bullet dots with or without this patch, disregarding what the ImHiddenText flag might suggest.

Fixes: QTBUG-88367
Change-Id: Ifd2a45e90ae022139a8ca89401b278e35bdc6a03
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-15 09:33:07 +01:00
Fabian Kosmale b26916bd35 tst_qmllint: Add withFlags helper to Result
That's more readable than explicitly initializing badMessages and
replacements, and is used by the following commit.

Pick-to: 6.10
Change-Id: I11be2ab0f547364d8cb7600844c2fe2817dd47fa
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-15 10:33:07 +02:00
Olli Vuolteenaho 3837355aed QtQ4A: Update Gradle and Kotlin plugin versions in examples
Gradle 8.10 -> 8.14.2
Kotlin Android Gradle plugin 2.1.0 -> 2.2.0

Pick-to: 6.10
Task-number: QTBUG-137782
Change-Id: I62b54d2730b1fc48139057d1a4ef0ce4061aaeb0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2025-07-15 11:33:07 +03:00
Matthias Rauter f0f2e8fdb1 Remove unused variable in test
Pick-to: 6.10
Change-Id: I6f47343c039c0d8e61aae6029773c3e634eaa426
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-07-15 10:33:07 +02:00
Alexey Edelev 7f426867e1 Consider QT_USE_ANDROID_MODERN_BUNDLE in tst_androidassets
Test copies Android assets to the Android application build directory.
If the QT_USE_ANDROID_MODERN_BUNDLE is enabled application build
directory is different and we should use
_qt_internal_android_get_target_deployment_dir to get it.

Change-Id: I0e02279aa289fbc5b8e0a00bd444604f7ca91e7a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-07-15 07:10:36 +02:00
Alexey Edelev af1b4eead8 Disable QT_USE_ANDROID_MODERN_BUNDLE for unsupported tests
tst_qtquickview_basic and tst_qtquickview_signallistener
use custom android deployment procedures which require update
to support modern Android bundles. Disable the option for these
tests.

Change-Id: I1fe36f4156e655c0e551f280b9b8259617948b9f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-07-15 07:10:34 +02:00
Fabian Kosmale 0051e751c3 cmake/qt_add_qml_module: Fix QtQuick auto dependency setup
We need to actually defer the code which attempts to detect whether we
are linking against QtQuick to the point where we write-out the file, as
the user is not unlikely to use target_link_libraries _after_
qt_add_qml_module.
Amends 065b784cab.

To test that this works, we run the all_qmllint target of on an example
project. We need to add a .qmllint.ini file to let qmllint fail the
build if there are any warnings.

Pick-to: 6.10 6.9 6.8
Change-Id: I7e00583b3a5b38549db2be13b1a8817b8489496d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-07-14 15:26:54 +00:00
Mitch Curtis f51fda1f1e Move qActiveFocusFailureMessage into a Private namespace
Addresses header review feedback:

https://codereview.qt-project.org/c/qt/qtdeclarative/+/651782/1/src/qmltest/quicktest.h#86

Amends 386e085114.

Task-number: QTBUG-137478
Pick-to: 6.10
Change-Id: Ie16fcac17b29280e47ef9e4362b877f3b4c61b74
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2025-07-12 09:06:17 +08:00
Santhosh Kumar 1aefea26e5 Propagate ignored shortcut key events in quick text edit to parent
The delivery agent generally accepts key events before sending them to
the quick item; the corresponding item can further accept or ignore
those events.

The reason that the user can't override the shortcut key event in the
quick text edit is that these events are marked as accepted by default
in the delivery agent, and the quick text edit also doesn't explicitly
handle the read-only case, which causes the event state to remain as
accepted.

This patch ignores the shortcut override event by default in the
delivery agent. Also, make the quick text edit to execute the
configured key handler to either accept or ignore before processing
the events. This gives the chance to execute the required shortcut
actions.

Fixes: QTBUG-136959
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ib6400f083f4e21d1b23db87b002acb1cbd4ac82b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-07-11 20:22:24 +02:00
Luca Di Sera c9631ce9b4 Avoid unsetting environment variables in tst_qv4mm
Some of the tests currently use environment variables to configure the
garbage collector.

In doing so, the test indiscriminately unsets those configuration
variables on exit, which has the side effect of possibly unsetting them
even if they were set outside the test case itself, and especially could
unset them for later test cases, possibly affecting them.

To avoid the issue, the test cases now configure the GC through the use
of private API instead of indirectly passing by the relevant environment
variables.

Change-Id: I3b20badf754638dc8e4206de711c214e13e78c1d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-11 16:02:56 +02:00
Luca Di Sera 27feb8ba88 JIT: Always zero out the accumulator when an exception is thrown
Currently when a JITtted function throws an exception, on exiting, the
accumulator is not zeroed-out if we don't have an exception handler and
is zeroed out when we do have an exception handler.

In the case where an exception handler is missing, this means that if
the caller is making use of the result of the function call, it might be
dealing with garbage memory.

Many times this isn't an issue as the result of the call would correctly
be ignored in the face of handling the presence of an exception.

Nonetheless, not directly using the result is not necessarily enough to
avoid issues with the possible garbage.

In particular, if the result of the call is put on the JS stack and
handling the exception allocates, the GC might be run as part of the
allocation and read the elements on the JS stack, one of which would be
the garbage memory that was returned.

One case where this can happen in the current code-base is during the evaluation
of a non-signal `QQmlJavaScriptExpression`, which does put the result of
a call on the JS stack while later handling an exception in a possibly
allocating way, with the garbage result still on the JS stack.

Furthermore, the interpreter currently isn't affected by the same issue,
as the interpreter always zeroes out when unwinding without running an
handler.
This adds the additional problem of the behavior differing between the
an interpreted function and its JITted version in the face of an
exception when the result of the call is voluntarily or not inspected.

To avoid the issue, the code generated by the baseline JIT was modified
to always zero out the accumulator before exiting a function call after
an exception, independently of the presence of an exception handler.

This further aligns the behavior of a JITted function to that of the
interpreter when no handler is present.

A test was added to `tst_qqmlecmascript` that exemplifies the issue by
passing by `QQmlJavaScriptExpression::evaluate` with a JITted throwing
function.

Fixes: QTBUG-138242
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I969dc790f8a274364ae124afaeae8e2381fc82ae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-11 14:02:56 +00:00
Ulf Hermann 8a29649cb7 QtQml: Look for existing imports even without redirection
It makes no sense to prohibit multiple imports of the same QML module
with the same version. We can just re-order the imports according to
prcedence when we detect this.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138391
Change-Id: I5ad94e1181f6a2beb278e421c1bbf06678fd863b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-11 16:02:56 +02:00
Ulf Hermann 64cd070c8c QmlPreview: Drop existing CUs on main thread, not on debug server thread
Doing this on the debug server thread can cause deadlocks since we may
need to serve a file request stemming from type registrations that also
lock the QQmlMetaTypeData.

Amends commit 618720a3a9.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138349
Change-Id: Iaa6c8cbf9270989aeca0cb84a4a77cd2aee36804
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-11 16:02:55 +02:00
Ulf Hermann eb9ab1b596 Replace btoa() and atob() with better implementations
The current btoa() and atob() perform UTF-8 conversion of the data and
therefore produce different outputs than the relevant Web APIs. That's
not helpful for a format which was explicitly invented for data
exchange. However, since they are compatible with each other, we cannot
simply change their behavior.

The actual problem stems from the fact that those functions take strings
as their inputs. Strings in JavaScript as well as Qt hold 16-bit data,
while base64 can only process 8-bit data. This makes it necessary to
deal with invalid characters in the first place.

Add additional overloads that take QByteArray. At least for btoa() we
don't need to check the input for compliance this way. However, since
it's difficult to obtain a QByteArray for random data in JavaScript,
also add overloads that take a few more common array-likes and convert
them. These overloads actually check the data for compliance and throw
the "Invalid character" excpetion if it's found to be non-compliant.

In turn, deprecate the broken implementations and print a warning when
they are used.

[ChangeLog][QtQml] The Qt.btoa() and Qt.atob() methods were subtly
broken and produced different output than the common Web APIs. They have
been deprecated in favor of overloads that take array-likes.
Array-likes, especially ArrayBuffer, are a better fit for expressing raw
data than strings.

Fixes: QTBUG-135329
Change-Id: I4d48c84b3a87cb615f78aa1a8c1eddfedcd306f9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-11 16:02:55 +02:00
Ulf Hermann 8ea6e9e5a9 QtQml: Fix leftovers from V8
Some comments and header guards still had V8 in them.

Change-Id: I71e888fb72916fcd948a293d9fd50fb54a9499c3
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-11 16:02:55 +02:00
Ulf Hermann 5d8a3c1367 qmltyperegistrar: Do not process duplicate metatypes.json files
If we get the same file twice, that's generally the effect of a linkage
cycle. Either we're dealing with a static build where this is fine and
we don't need to complain about it, or the linker will complain anyway
and we don't have to.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-132518
Fixes: QTBUG-127133
Fixes: QTBUG-134292
Change-Id: Iad8b3b5c694d96ebdcbf03522ce2318ae8d24fb2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-11 11:25:37 +02:00
Fabian Kosmale 740d67fbca qmllint: Do not warn about unnotifiable properties outside bindings
It doesn't cause any harm if we are not inside a binding. There's a
slight issue with the fact that we now don't warn if one extracts the
read into a separate function, and calls the function inside a binding,
but that is still better than spurious warnings.

Fix this by checking in which context the read occurs. We currently rely
on a "magic" name we give to the function's scope if it as a binding,
but this will be fixed in a follow up commit introducing new scope
types. We don't want to do introduce them here, as they would be new API
not suitable for picking back to 6.10.

Another open issue is that the onRead handler gets the outer QML scope
as the context, which necessiates that we traverse its child scopes to
find the actual function. Fixing that would necessiate some larger work
in the QQmlTypePropagator, and is consequently deferred to another
patch, too.

Pick-to: 6.10
Fixes: QTBUG-138346
Change-Id: I29ea39eb32a18d9b54ded8d5e2c9a5f66051374f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-10 09:29:03 +02:00
Tim Blechmann 4985e06e53 tests: fix cmake build
The manual test svg was renamed, which breaks builds with manual tests
enabled.
Amends 7b44231f33

Pick-to: 6.10
Change-Id: Ib03e4036718c49297e88ab35c43aa411963a41a1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-07-10 11:35:08 +08:00
Santhosh Kumar 931d634c46 Propagate modality to the non-native quick dialogs
The non-native quick dialogs don't block input to the windows even after
setting the modality as ApplicationModal/WindowModal. This is because
non-native platform dialogs (QuickPlaform*Dialogs) didn't set modal to
its respective window (QQuickPopupWindow).

This patch fixes that issue by setting the modality to the non-native
platform dialogs.

Task-number: QTBUG-127605
Pick-to: 6.10 6.9 6.8
Change-Id: Idb3374e881766ae92adc0360c9b9af5c498dd6df
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-07-09 22:31:35 +02:00
Fabian Kosmale 0e1c884904 Relax duplicate binding check
It is actually possible to have mutliple ValueSources on the same
propery, as long as they are not all active at the same time.
We can't really know whether that's the case (that can only be known at
runtime), but we can employ a heuristic to avoid most spurious warnings.

Pick-to: 6.10
Task-number: QTBUG-137946
Change-Id: Ie39a1368c68e1ba9aecf582df00680ae3e8c68f3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-09 14:09:35 +02:00
Ulf Hermann 2d5b21b5e9 QQmlTypeLoader: Also populate directory cache on directoryExists
Previously, QQmlTypeLoader had different cache entries for
directoryExists() and fileExist() in the same cache. The ones for
fileExists() had an extra slash appended to their path.

This was entirely pointless because a path is a path and if it exists,
we can use it for file lookup. Furthermore, it was wasteful because it
halved the capacity of the directory cache while adding duplicate keys.
However, it did mask one bug: The entries for directories could stay
unpopulated without disturbing the ones for files.

The masking was not complete, though. When inserting a directory entry
that ended in a double slash, one of the slashes was removed, leaving
the entry in the form expected for files.

Now we always remove all trailing slashes, and always populate the cache
when an entry is first inserted.

Task-number: QTBUG-134652
Change-Id: I333c81655d6f6dfff1e46dae8eef3c46a33d97ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-09 10:06:42 +02:00
Lars Schmertmann bfe8169b07 Remove unnecessary assignment in tst_qquickapplicationwindow.cpp
This was missed in df2c402979.

Task-number: QTBUG-137823
Pick-to: 6.8 6.9 6.10
Change-Id: I177147e7d949065824339aee275b1144eeb0f7d8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-09 05:57:17 +02:00
Frédéric Lefebvre 28b134a5e9 Fix flaky dragHandlerInSiblingStealingGrabFromMouseAreaViaTouch
tst_MouseAreaInterop::
dragHandlerInSiblingStealingGrabFromMouseAreaViaTouch exhibits
occasional flakiness on openSuSE 15.6.

Fix the flakiness on openSUSE 15.6

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I823b522b54710e34788b718aa9f0a22254981f5c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-08 17:40:04 +00:00
Frédéric Lefebvre dc90dfad74 Fix flaky dragHandlerInSiblingStealingGrabFromMouseAreaViaMouse
tst_MouseAreaInterop::
dragHandlerInSiblingStealingGrabFromMouseAreaViaMouse is flaky on
openSuSE 15.6 and is blacklisted on that platform.

Fix flakiness on openSuSE and unblacklist the test.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I1f0c8935a1b95d773cf5364ec4eba0c20918d41b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-08 17:40:03 +00:00
Tor Arne Vestbø 9352ef3c16 Allow recursive layout of ApplicationWindow
The safe areas require recursive layouting of the ApplicationWindow
menu bar, header, and footer (in particular). We added guards preventing
that in 6dc9539979, to fix QTBUG-87708,
but the fix for that can be in QQuickLayout itself.

Pick-to: 6.10
Task-number: QTBUG-87708
Change-Id: I0dc25d779fe76619591f35063826d50dff2e3d28
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-07-08 19:40:03 +02:00
Frédéric Lefebvre ef75f234d2 Fix flaky tst_QQuickTextEdit::largeTextObservesViewport on openSuSE
tst_QQuickTextEdit::largeTextObservesViewport is flaky on openSuSe and
fails.

Verify the window is active after being shown before continuing with
the test.

Pick-to: 6.10 6.9
Change-Id: I2c842338ffdbe7be466060e0260ae92759da0b34
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-08 17:40:03 +00:00
Frédéric Lefebvre 565292341a Unblacklist tst_QQuickDrawer::position on openSuSE-leap
tst_QQuickDrawer::position is no longer flaky on openSUSE-leap.

Change-Id: I6ee5a0c8feda87f24ff9a07227a6fffdec27524b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-08 17:40:03 +00:00
Ulf Hermann 61ab316944 Quick: Fix path element handling
We need to check the existing path elements before adding the new one to
determine whether we need to connect the new one.

Amends commit bc58686176.

Pick-to: 6.10
Fixes: QTBUG-138233
Change-Id: If99bbd5ad6f4646e4a36c94d547f6bdc1fb73542
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2025-07-08 17:40:03 +00:00
Sami Shalayel dfb6642aaa qmlls: support go to definition for C++ components
Implement go to definition for components defined from C++.
Add a helper method in QQmlCodeModelManager that returns the workspace
with the shortest url that contains a file: this workspace folder is
used when searching for headers referenced by .qmltypes files.

Task-number: QTBUG-130801
Task-number: QTBUG-128393
Change-Id: Idaac7dcf9d71701a01533ceaaec31d8f142f99ab
Initial-patch-by: Xavier BESSON <developer@xavi-b.fr>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-08 11:50:10 +02:00
Sami Shalayel 808d4d7128 QQmlCodeModelManager: add method to find project root
Add a method that returns the project root for a file. The project root
is the workspace with the shortest url that contains some file.

This will be needed when searching for C++ headers, as they might be in
a different subproject/workspace than the currently edited file.

Task-number: QTBUG-128393
Change-Id: I63ce3895abb20c9851dc77da3b4d0c4bd267c871
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-08 11:50:10 +02:00
Sami Shalayel 54844d4d01 qqmllsutils: limit recursion in findFilePathsFromFileNames
Limit the file recursion in findFilePathsFromFileNames, and allow users
to modify the limit via environment variables. Implement the code inside
a static findFilePathsFromFileNamesImpl method that will be reused later
when searching for a C++ header for go-to-definition.

Task-number: QTBUG-128393
Change-Id: Ic5ba5929329434e079c70bdee9c2c2d343d381d5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-08 11:50:09 +02:00
Fabian Kosmale 787fd85ce3 qmlimportscanner: Optionally add version to output again
This is not needed by our own tooling, and in the case of major version
only imports might lead to funny results.
It is however used by Linux distro tooling, and can't cause issuse with
older QML projects that never used the more advanced import features.
The feature is only enabled when the  add-version flag is passed, as we
don't want to risk confusing our own tooling which might not expect the
value to exist.
Amends 6aa4c83bdb

Note that we need to adjust the rootPath.json file, as the new file
causes us to find more modules.

Pick-to: 6.10
Fixes: QTBUG-115170
Change-Id: I20d39dacc87f18fc5bbec93aaec5bdaef0c77c4b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-08 11:50:09 +02:00
Mate Barany 7fb77c9f10 Do not use versions in QML import statements in TableModel tests
According to Qt6 best practices these are usually leftovers from Qt5.

Task-number: QTBUG-137746
Pick-to: 6.10 6.9 6.8
Change-Id: I7df6b16bf2a1c8fbd13a80c0ca4cb77583f07d42
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-08 08:42:55 +02:00
Ulf Hermann 560bacbc93 qmltyperegistrar: Manually register names for Q_ENUMS
Flags declared with Q_FLAGS lack the methods for properly extracting the
typedef'd name. We need to manually register the typedef.

Amends commit 8bf5aae19b.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138174
Change-Id: I7c373f4d810a0c9a5590f39cc629015662a69ed4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-07 19:35:20 +02:00
Sami Shalayel 210f2c8a40 qqmljsscope: add line number for Components
Add Component line number information from MOC into QQmlJSScopes. That
is needed for qmlls to find definitions of QML components defined in
C++ headers.

This change adds the line number information into the generated qmltypes
from MOCs JSON, and reads it back into a QQmlJSScope.

Instead of adding an extra member, re-use the QQmlJSSourceLocation that
is inside the QQmlJSScope. Set the column to 1 for it to be valid and
to simplify some code on the qmlls side. This allows to treat a
sourcelocation in the same way, independently if the component described
by the QQmlJSScope was defined in QML or C++.

Avoid an assertion in QQmlJSImportVisitor::checkRequiredProperties()
where printFix assumes that a file can be opened if its source location
is valid: this change adds have valid sourcelocations to qml components
defined in C++, but QQmlJSScope::filePath() can't be opened because it
only contains the filename, not the file path.

Task-number: QTBUG-128393
Change-Id: Idf4acc32cff60730528322286ad4ba726b502ac1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-07 19:35:20 +02:00
Ulf Hermann 2bd3a62fd0 QQmlTypeLoader: Re-implement fileExists using QDir and QDirListing
This has the benefit of being case sensitive even on case-insensitive
file systems. Since the creation of a QDirListing is more expensive
than simply checking for existence with QFileInfo, we use the iterator
to its maximum effect and more aggressively cache directory contents
now.

Task-number: QTBUG-134652
Change-Id: I4b707d2adc5492f90466b831a14f17efa26a50c2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-07-07 16:06:45 +02:00
Sami Shalayel b9125c07b8 tst_qmlcachegen: unify behavior for cross compiled tests
Create a new macro that skips the test, and use it consistently around
the tests, instead of sometimes skipping and sometimes failing the
tests.

Also add a macro that prints the same message and returns false for the
generateCpp and generateCache helpers, to help in the case someone
forgets to add the skipping macro to their new test.

Change-Id: I91d35a32f345df1ebb0616046923a8c9b6b515e6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-07 12:34:50 +02:00
Sami Shalayel ed005e2904 qqmlcodemodel: only contain one rootUrl
Now that we have introduced QQmlCodeModeManager, we don't need to
support multiple rootUrls in the same QQmlCodeModel. Make each
QQmlCodeModel have one unmutable rootUrl.

Task-number: QTBUG-137869
Change-Id: I474cbd2d3b72bd511c3f4a643cb99d5e141f7f2c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-07 12:34:49 +02:00
Sami Shalayel bc236d900d qmlls: move initial workspace opening code to WorkspaceHandlers
Move the code that opens the initial workspace into WorkspaceHandlers.
Add support for some deprecated ways of declaring the workspace root
folder in the LSP.

Also use workspaces in tst_qmlls_modules, instead of using a deprecated
rootUri.

Task-number: QTBUG-137869
Change-Id: I8ce5334fcc459493b6f165b0166e7a6bdeaee142
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-07 12:34:49 +02:00
Sami Shalayel 4b389314ee qmlls: swap QQmlCodeModel with QQmlCodeModelManager
Replace all usages of QQmlCodeModel with the newly introduced
QQmlCodeModelManager, and add qmlls tests for the WS feature.

Adapt the calls to m_codeModel->registeredTokens() and helpManager
to pass the uri so the manager can call the method on the correct
codemodel.

Add tests where qmlls is run on multiple workspaces.

Fixes: QTBUG-134308
Change-Id: I6ba918bd37f78f892bfaead86a0e216cbca7d7f1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-07 12:34:49 +02:00
Marc Mutz ffc332825a Include what you need: qquaternion.h
qmatrix4x4.h will lose its qquaternion.h include, so include
qquaternion.h explicitly in all files that mention 'QQuaternion',
unless, for a foo.cpp, the own foo.h has already included it.

Picking all the way back, even though the include removal won't be
picked as far back, because it's the correct thing to do and cannot
fail.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I21bc2ddfda326455d36d5510df596169e1c2d5dc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-04 12:53:30 +02:00
Mitch Curtis fa8bfd6ed5 Fix heap-use-after-free in Container when using ListView transitions
Container's removeItem function removes and deletes items immediately.
This has caused issues in the past, like QTBUG-46798. QTBUG-133256 is
similar to that, except it also involves transitions.

This patch fixes the crash by listening for the destruction of items
created within an ObjectModel and removing them so that views don't
have dangling pointers to them.

Add removeAndDestroyObjectModelItem to tst_qquicklistview2, which is
similar to the test added for 1e3924d8f5
but adds more thorough checks and transitions.

Fixes: QTBUG-133256
Task-number: QTBUG-46798
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I9777713edfc6f82a4e9edefe2fd6c9831f03c261
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-07-04 13:02:04 +08:00
Olivier De Cannière d41f97e867 ScriptFormatter: Preserve user spacing around comments
We want to respect the formatting and spacing of the user around
comments. Comments already contain the information about spaces and new
lines before and after them and they are included when writing the
comment.

However, this conflicts with the need the add spaces around tokens in
the non-commented case. We need to only ensure a space if it doesn't
come immediately before or after a comment since the comment already
includes the spacing. Otherwise we would be duplicating the spaces.

In order to do this, keep track of whether the last write was a comment
and defer actually adding the spaces until we know no comment follows.

This fixes errors where extra spaces were inserted around comments.

Tests needed to be updated to adhere to the rule that we respect user
spacing around comments.

The SpaceBeforePostComment option is also no longer needed now and was
removed. The remaining options were also renamed to better reflect their
behavior.

Task-number: QTBUG-133315
Change-Id: I38e7fb65ac76ead6287c9dcb2f43f8fdd09347da
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2025-07-03 22:53:44 +02:00
Luca Di Sera 64b3748b39 Avoid accessing garbage memory on the js stack
When allocating an object on the JS heap the garbage collector might be
run as part of the allocation, in particular as a way to possibly make
space when the memory space is starting to get filled up.

When the garbage collector runs, it is possible, as part of its normal
processing, that it will access the JS stack, and try to interact with
the objects that are stored on it.

In particular, while collecting from the JS stack, the garbage collector
will need to mark all Managed objects that are found on it.

When allocating on the JS stack it is possible that the allocation and
the initialization of the allocated memory are performed in separate
steps.
When this is so, it is possible for the allocated element on the stack
to represent garbage memory in between being allocated and being
initialized.

Since the garbage collector can inspect all elements on the stack as
part of its processing, it is possible for it to inspect an element that
represents garbage memory if it runs in between the allocation and
initialization of that stack element.

Furthermore, since each allocation might run the garbage collector, then
any allocation in between the allocation and initialization of such a
stack element can access garbage memory.

In particular, if the garbage memory represents a pointer to a
previously existing Managed object that was swept, the garbage collector
might try to mark an object that shouldn't be marked.

There are a few cases of this currently in the code-base.

While instantiating a QML file, `QQmlObjectCreator` keeps track of
objects that are created in the process, to avoid premature collection.
As part of this, `ObjectInCreationGCAnchoList::trackObject` will be
called, in turn allocating on an element on the js stack and then
initializing it separately by the creation of `QObjectWrapper`.

The creation of a `QObjectWrapper` generally allocates, such that it can
incur into the above problem.

As part of dealing with the JS spread operator, in particular when
processing the spread element, we juggle with multiple allocation of
uninitialized elements on the js stack.
During this processing multiple part of the code can allocate.

For example, the spread element is handled through the use of an
iterator that, during its creation, might allocate as during the
creation process we might convert the spread argument to object so that
the iterator can deal with it, which would be the case for a spread
argument that is a string.

When allocating an element on the js stack that is bound to a certain
scope, we sometime allow a conversion to be performed on the original
element.
This conversion routine might allocate, and it does do so for the
currently existing conversion to a String and to an Object.
The conversion routine is called after an uninitialized element is
pushed on the stack, and can thus incur into the above issue.

To fix the issue, an additional method was added, `construct`, that
ensures that allocation and initialization happen sequentially with no
allocation in-between, using an initialization value that is passed as
an argument.

The new method was applied to the code affected by the bug, in practice,
reordering the operations in the affected cases such that the
bug-producing allocations happens before the allocation on the stack
such as to avoid the bug while keeping the same semantics.

An exception was taken for the handling of the spread argument, which
has a more complex control flow, where the solution that was used is to
initialize the memory to the empty value as part of the allocation.

A series of test cases showing an example of the issues were added to
`tst_qv4mm`.
The tests make use of the fact that we assert when we find a Managed
object on the js stack that is not in use, as that is a logical error
for the garbage collector, to observe the issue and are thus skipped
when assertions are not enabled.

Change-Id: Id478e16ee22e20e77d01fdfae9a0269d6d709892
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-03 19:24:23 +02:00
Alexey Edelev d176aec80f Specify the OUTPUT_DIRECTORY for tst_qmlcachegen_aotstats
Ensure that we produce the correct directory structure for the
QML module. This suppresses the tooling-related warning.

Pick-to: 6.8 6.9 6.10
Change-Id: Ia391663806e4d3428ca3ae2a5bfa8dda95f833da
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-03 10:12:27 +02:00
Eskil Abrahamsen Blomfeldt 79de947888 tests: Keyboard navigation in vector image manual test
This makes it possible to just use the arrow keys to navigate
back and forth between files, since doing this with the mouse
can get tedious.

Pick-to: 6.10
Change-Id: I48bd4c644d1acddb6b46293b72b154d4e87001a8
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2025-07-03 10:12:27 +02:00
Semih Yavuz 9eea617113 revisit semantic highligher: add pragma check for outer ids
If components are unbound, highlight id's of parent component as
QmlExternalId.

Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137116
Change-Id: Ibd95d927c4871d8ac3575b602b8a4973ecb699bc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-03 01:23:24 +02:00
Semih Yavuz c8521e32e9 revisit semantic highlighter: property chains
Prior to this commit, we were performing semantic analysis for each
field in a property chain expression. With this commit, only do semantic
analysis for the first part of the qualified expression. However, methods
and attached type identifiers are exempted from this rule.

Introduce new highlighting type FIELD which represents the fields in the
property chains. In QtC, they will be mapped to C_FIELD type while other
IDE will highlight them as PROPERTY (Accoding tot VSCode Semantic
Highlighting Guide, the property semantic token type is intended for
non-static member variables and member fields. Fields, therefore, align
better with property type. .

Add debug helpers to test.

Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137116
Change-Id: Id49adf461e3a6cc6c0c32ebd33bbe082d420d71b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-03 01:23:24 +02:00
Semih Yavuz 5ce826b347 revisit semantic highligher: Restructure the entry point
Let visitor own the highlights data and invoke visitTree in the
constructor. This makes it more structural and easier to test. Rename
highlights() into tokens() to prevent confusion, as the owner class'
name is also Highlights.

Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-137116
Change-Id: Ifed9a40c04fa1a86c3314bd172995246208a4756
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-03 01:23:24 +02:00
Jan Moeller df2c402979 Change order of menuBar/header/footer to match visual order
Currently, the tab navigation order is confusing as the footer is
focused before the actual content of the ApplicationWindow. By adjusting
the stack order, the tab navigation now matches the visual order.

Fixes: QTBUG-137823
Pick-to: 6.8 6.9 6.10
Change-Id: Ibe6fe9305181fe7ed42d7f8ca2da689b1b6ccf41
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-02 22:11:41 +02:00
Olivier De Cannière 5935a83948 QtQml: Correctly track alias resolutions skips
When trying to resolve all aliases on an object, we iterate over them
one by one. If all are resolved successfully, we return
AllAliasesResolved and consider this object done, if an alias fails, we
return NoAliasResolved or SomeAliasesResolved and we will try again
later. This can be the case for aliases to aliases. We defer resolving
the first one until the target alias is resolved first.

There was a bug in the logic that counts how many of the aliases were
successfully resolved and how many were skipped. When skipping an alias
to an alias, we cannot count it among the completed ones.

This leads to an alias not being resolved and added to the property
cache. Thankfully, a runtime assert then catches the discrepancy between
the number of aliases in the property cache and in the compilation unit.

Early exit when detecting that the alias points to a non-local
unresolved alias to try again later. Also update the aliasIndex as part
of the for loop update.

Amends 9e1378260a

Pick-to: 6.10
Change-Id: I6ee7a796a0b4890393d5b17ebea2686c55955394
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-02 14:44:04 +02:00
Olivier De Cannière 6ead474c83 tst_qmlformat: Rename QEXPECT_FAIL test files to show that they now pass
Amends a3863b2d8b

Pick-to: 6.10 6.9 6.8
Change-Id: I756621e2ac6d57a555395cb69914e2d0b4431d0e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-02 10:37:28 +02:00
Ulf Hermann bc58686176 QtQuick: Optimize path element handling
The path elements need to implement removeLast and replace. Otherwise
such operations are extremely slow. Furthermore, we can add nullptr to
the path list. Don't try to connect or disconnect those.

Pick-to: 6.10
Task-number: QTBUG-137554
Change-Id: I15352861d62f1b716954a482444fe71dc4518ea3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-02 08:37:28 +00:00
Sami Shalayel a8b64c41f1 qqmltoolingssettings: add locked variant QQmlToolingSharedSettings
Add a new QQmlToolingSettings class that locks all its methods. This
allows to use the same settings object in multiple qqmlcodemodel that
each loads files concurrently in their own threads, without data races.

Task-number: QTBUG-134308
Change-Id: I28664a8bd8fe755f21a9c5626d7b7b4fe3db15be
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-02 10:37:28 +02:00
Sami Shalayel dab8cf4c80 qmlls: introduce QQmlCodeModelManager
Using one QQmlCodeModel is not enough to be able to support multiple
Qt projects opened in the same qmlls instance: different projects might
require different import paths.

The previous behavior is to load every opened file in the same
QQmlCodeModel, which means that all opened files end up in the same
DomEnvironment, and share the same (potentially wrong) import path.
This leads to bugs like QTBUG-137705.

Also, the QQmlCodeModelManager reads the .qmlls.build.ini files and
therefore can load different QML modules from the same project into
separate CodeModels. That should solve problems where different
QML module have different import paths, for example when IMPORTS TARGET
or DEPENDENCIES TARGET is used.

Therefore, introduce QQmlCodeModelManager, whose responsability
will be to manage the different code models that have different import
paths, and to "re-route" calls to the code model responsable for the
passed url.
QQmlCodeModelManager has almost the same public interface as
QQmlCodeModel: a later commit will swap all usages of QQmlCodeModel with
QQmlCodeModelManager. Some method of the public interface of
QQmlCodeModel, like fileNamesToWatch and ignoreForWatching for example,
seem to be only used in testing, so leave them out from
QQmlCodeModelManager. Some methods need an extra-url argument to be
correctly rerouted to the correct codemodel, like registeredTokens for
example.

Each QQmlCodeModel will end up in its own QQmlWorkspace.

We distinguish between two types of Workspaces: the client managed ones
and the server managed ones.
The client managed workspaces are passed via the LSP and are supposed to
separate different projects using potentially different qt versions,
like in the use case of the VS (non-code) extension. They can be closed
by the LSP client once they are empty. Closed client workspaces are not
used for opening new files, and are destroyed once they don't contain
any more open files.

The server managed workspaces are created from the found
.qmlls.build.ini files to handle different QML modules inside a project
that may have different import paths. Empty server managed workspaces
are automatically destroyed.

Task-number: QTBUG-134308
Change-Id: Ia873856fed96e88f04b46e13af6e16da0d2ee574
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-07-02 10:37:28 +02:00
Eskil Abrahamsen Blomfeldt b5c5f21811 test: Make file selector combo in the vectorimage manual test
Instead of just showing the current file in a label, make it a
combobox, so that you can skip directly to the file you want.

Pick-to: 6.10
Change-Id: Ia9c48414541bb3e8ad70d685e6e426446ce4c1a8
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2025-07-02 10:37:28 +02:00
Ulf Hermann 054873dfea Loader: Also drop engine when clearing contexts recursively
Simply clearing the expressions is not enough. We might have internal
signal/slot connections in addition. The main protagonists of such
behavior listen to context invalidation, though, and a context without
engine counts as invalid. At the same time, we leave the context object
in place so that we don't re-open QTBUG-66822. The currently running
binding will still be able to complete this way.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-118188
Change-Id: Ia973be26f0e4e3244adc71f95df7e0b4bef412c3
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-02 10:37:28 +02:00
Sami Shalayel 81eaaa24fc tst_generate_qmlls_ini: add throw on fail
See comment on 455f3169e3 about throwing
during QVERIFY/QCOMPARE: The test framework will still record that there
was a failure, but without throw follow-up code will still be running,
which might obscure the failure reason.

Change-Id: I58a6e59a40369ef3a15ebb4707f0140c5827212b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-01 16:56:49 +02:00
Jan Moeller ad17c15c18 Extend autotest of QML ApplicationWindow
To test (show) the current tab order behavior, the ApplicationWindow
of the autotest is extended by setting the menuBar, header, and
footer properties. Consequently, the autotest will now test the tab
order by traversing all the ApplicationWindow's content. Additionally
the test now ensures correct z-stacking of the contents.

Cleanup QKeyEvent creation lines by removing redundant parameters and
use consistent assignment syntax.

Fixes: QTBUG-137823
Pick-to: 6.8 6.9 6.10
Change-Id: I156397c00c308e2abd5e1f0acefd4889330f7619
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-01 08:20:00 +02:00
Mitch Curtis 2ed569070e testbench: add SearchField
Pick-to: 6.10
Change-Id: Ieafa5b40a3c43646ec89649afec80d0748ccfa2f
Reviewed-by: Dilek Akcay <dilek.akcay@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-01 09:13:50 +08:00
Olivier De Cannière a3863b2d8b qmlformat: Fix comment handling around enums
Add more regions for comments to attach to.

Remove special casing preventing comments to attach to the braces of an
enum. It is no longer needed.

The comma token belong to the enum entry after it. The opposite was
assumpted to be true before which led to comments being attached to the
wrong item and moving around.

Task-number: QTBUG-133315
Task-number: QTBUG-123386
Pick-to: 6.10 6.9 6.8
Change-Id: I32f8c49aff6a4c88c323450beec9aa0f5bc5bbe5
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-30 19:40:44 +02:00
Olivier De Cannière 240d2d190e Dom: Create region for the colon token in signal param type annotations
Task-number: QTBUG-133315
Task-number: QTBUG-123386
Pick-to: 6.10 6.9 6.8
Change-Id: I65dc2056b46b1b7a2b381805b53a6ef32c457aa3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-30 19:40:44 +02:00
Olivier De Cannière 5f2cf0940f qmlformat: Prevent superfluous space after Object name with comment
Task-number: QTBUG-133315
Pick-to: 6.10 6.9 6.8
Change-Id: I2c3752fe900c65133a12470c567196640e142b31
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-30 19:40:44 +02:00
Volker Hilsheimer 5e00454739 tst_ActiveFocus: replace an unnecessary qPrintable
We already have a QByteArray that we can print directly, so no need to
go through a QString.

Amends 386e085114.

Task-number: QTBUG-133858
Pick-to: 6.10
Change-Id: I89768a1faf1ead2e763215348f8defbbeaeaa93e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-06-30 16:23:35 +02:00
Volker Hilsheimer 8201bd21b0 QQuickTest: return QByteArray from qActiveFocusFailureMessage helper
The primary use case for this function is to print diagnostics in case
of test failure, so don't go through from UTF8 to QString and back,
and instead return a QByteArray directly.

Amends 386e085114 to address header
review comment.

Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: Id5e242be274ef173bc89e281e6e6db5ce758914c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-06-30 16:23:35 +02:00
Petri Virkkunen 95777dad9e QQ4A: Skip spam signallistener tests due to reference table overflow
Skips crashing signallistener test.

Task-number: QTBUG-138104
Pick-to: 6.10
Change-Id: I64e58f5e0cdd5d64254271543a479054f5f118e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-30 10:13:56 +00:00
Fabian Kosmale 58265ef602 LoggingCategory: Ensure that name is set early enough
Every LoggingCategory needs to have a name. However, it might be used
before QQmlParserStatus::componentComplete has run. In theory, it might
even be used before the binding has been installed.

To fix this, force the completion logic to run early if the category is
used.
Given that the name of the logging category must never change, we make
the assumption that no complex bindings are used for name, but only
literal strings. Consequently, we don't introduce the overhead of
flushing bindings, which would be necessary if we were to support them.

Fixes: QTBUG-116539
Pick-to: 6.10
Change-Id: Ic194a7dcbae25b5f982198e9ea27f806c84e5cac
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-30 11:58:43 +02:00
Petri Virkkunen f00372269f Android: QQ4A: Fix synchronization issue with statusChanged signal
Do not allow Qt Event Loop to continue spinning until the
QtQmlStatusChangeListener has been notified about the status change in
QQuickView or 1000ms have passed, whichever comes first.

This timing issue could cause signals to not be received by the user in
cases where QML signals were fired too quickly after the QML view was
done loading, especially if the Android UI thread was under high load.

This was due to the fact that the QtQmlStatusChange event was queued on
the Android UI thread, after which the Qt event loop was allowed to
keep spinning, emitting signals and such. In cases where the Android UI
thread was under load, processing the queued QtQmlStatusChanged event
could take long enough to lose the earliest QML signals. This was
detected on the CI Android emulators during signallistener tests.

Fixes: QTBUG-137025
Change-Id: Ibf04b71a556a7e4a2b5b0338e6ac7876b0228ae1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-30 09:43:08 +00:00
Petri Virkkunen f409468938 QtQuickView: Add tests for disconnecting signals
Add QtQuickView tests to verify that QtQuickViewContent can disconnect
and reconnect signals correctly.

Task-number: QTBUG-130768
Change-Id: I26446be1ab534233aeba0492800bee72484e8bf9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-30 09:43:03 +00:00
Petri Virkkunen 62cf01a107 Android: QQ4A: Add support for multiple signal arguments in QML
This commit adds support for QML signals with multiple arguments to be
used in the QQ4A context.

In the QtQuickView[Content] layer, this commit adds a new overload for
the connectSignalListener API. This new overload takes a Class<?>[]
parameter instead of the Class<T> parameter of the old API. To support
this, the corresponding QtAndroidQuickViewEmbedding native function has
been replaced with one that takes a jclass array as well. There is a
new implementation for the old single-class-argument API that calls the
new API, instead of reimplementing the logic in two places.

Signal connection and disconnection logic has been moved to
QAndroidViewSignalManager, which is called from the
QtAndroidQuickViewEmbedding namespace native functions.

In QAndroidViewSignalManager, the signal connection now happens by
connecting to the qt_metacall QMetaObject function, which the class has
overridden.

In QAndroidViewSignalManager::qt_metacall, the signal is handled by
detecting the type of signal and parsing the data sent by the signal,
either by reading the property of the sender of the signal that the
signal is linked to, or parsing the void* arguments passed into
qt_metacall.

Task-number: QTBUG-124489
Change-Id: I416bb266b3ffe5c947264d942b1afe3349bca2d7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-30 12:42:57 +03:00
Ulf Hermann cee8332885 Fix handling of animations in QQuickTransition
We need to implement all the QQmlListProperty methods, and we need to
guard against nullptr to avoid crashes.

Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137554
Change-Id: I9a222085b4848a9f0ebe59d9e029cabdedc46512
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-30 11:32:12 +02:00
Mitch Curtis 57325020f6 MonthGrid: fix dates being incorrect for certain timezones
When a QDate is passed to QML, it becomes to a JavaScript Date.
As Dates are stored in local time, the QDates we were passing to
QML had the potential to be one day off in certain timezones.
For example: 00:00 UTC converted to UTC-8 is 20:00 the day before.

Fix this by storing and providing dates as QDateTime so that we can
give it a time of day that can't possibly result in a different day
when converted to local time. It's fine to change the C++ API since
it's private, and nothing will change for the type that users see,
since they always get a Date.

Add a SystemEnvironment singleton to QQuickControlsTestUtils
(Qt.test.controls) to allow reading and writing environment
variables from QML.

Fixes: QTBUG-72208
Pick-to: 6.8 6.9 6.10
Change-Id: Idb4ab26568d8f1eddd5ab4cebe691e38173d02a9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-30 13:31:50 +08:00
Ulf Hermann aa1d3e416e QtQml: Don't check binding bit when searching value type proxy bindings
Value type proxy bindings don't set the binding bit in the first place.
Therefore, we'd never find one this way. When different bindings set
properties of the same value type property in different places, this
would crash.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137326
Change-Id: Ie5ddb840f3f056ce5c9e04689511986e0eb28123
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-29 19:46:38 +02:00
Ulf Hermann b9974d82cd QmlCompiler: Preserve external side effects across jumps
Now that we discern internal and external side effects, we cannot
implicitly rely on every jump to generate a side effect anymore. We need
to actually update the virtual registers and also merge the side effects
(along with other flags).

Amends commit 6b14ba5c2f

Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: I6b46c7a4773759c8f6f30308ba72082555ce3e61
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-27 21:56:31 +02:00
Fabian Kosmale b1bdad8096 QtQml: Avoid infinite recursion in Array.join
So far, self-referencing arrays can lead to infinite recursion in
Array.join. The standard allows us to throw an exception in this case,
just like we already do in ObjectPrototype.toString(). This is not what
browsers do, but arguably they are diverging from the spec.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-124157
Change-Id: Iac241a90ba7e583e53f52ec635add7b5cf05b200
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-27 14:20:05 +02:00
Fabian Kosmale a4aee68776 qmllint: Catch JS variable declarations in QML elements
JS variable declarations in a QML element are not allowed.
The engine rejects them in the IR builder. As the linter doesn't run
this part of the compilation pipeline, it would never report the issue.

This commit fixes the issue by adding the necessary check.
It also avoids an assert in insertJSIdentifier when assertions are
enabled.

Fixes: QTBUG-137030
Pick-to: 6.10 6.9 6.8
Change-Id: Iff7a6e02bf852cf3a9affcac6ec40b7bd98cda83
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-27 11:41:07 +00:00
Ulf Hermann fc0bf5a9fd Templates: Disconnect menu bar items when clearing
Otherwise we get change notifications for half-dead change listeners and
subsequent crashes.

Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137554
Change-Id: I194ca0f8c3a540b1bfc41fa969d0cd3b9e6c24e4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-27 13:30:11 +02:00
Fabian Kosmale 69fb18357c compiler: Avoid invalid C++ code generation
inlineConsoleMethod's stringConversion needs to create a string, so that
we can later append to it. Because we were missing parentheses, this did
not happen, and we would end up with code looking like
u']'.append(...)
which obviously isn't valid C++. Fix this by always adding parentheses
around the expression.

Found while trying to prove that QTBUG-109279 was fixed.

Task-number: QTBUG-109279
Pick-to: 6.10 6.9
Change-Id: I67fce5b2c1f1460a5d6b617824f3c36f9804ea76
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-26 20:36:14 +02:00
Eskil Abrahamsen Blomfeldt 7b44231f33 Rename svg manual test to vectorimagetest
This now shows Lottie files as well, so it should have a more
generic name.

Task-number: QTBUG-135267
Pick-to: 6.10
Change-Id: Ibb6a17cf215dde7c0c32b4cdfd37e6227ec3cd9a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-06-26 20:36:14 +02:00
Eskil Abrahamsen Blomfeldt 1ad9116ea7 Also support Lottie files in manual test
Task-number: QTBUG-135267
Pick-to: 6.10
Change-Id: I505ae072ed61e39ec43370cfd1b538f24b3b7926
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2025-06-26 20:36:14 +02:00
Eskil Abrahamsen Blomfeldt 5f27c8983e Remove QML generator from SVG manual test
The QML generator code path in the test has some bugs due to how it
generates embedded images. In addition, it does not map to loading
other file types such as Lottie in the same application, since
that would need special handling.

Since it is now tested through the item generator (the item
generator uses it internally), we don't need a separate UI for
this in the test.

Task-number: QTBUG-135267
Pick-to: 6.10
Change-Id: I9e35bccebcd9e763c74ce44cf9d4e89fc0d1a802
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-06-26 20:36:14 +02:00
Alexey Edelev d387dd898c Fix tst_androidassets so it considers QT_USE_TARGET_ANDROID_BUILD_DIR
tst_androidassets hardcodes the Android build directory. Use
_qt_internal_android_get_target_android_build_dir instead to evaluate
the path for qml assets.

TODO: Avoid using the private method in tests. See QTBUG-135973.

Change-Id: If65b6ea359a4ef4bddd8e76071cde46cea9ad5d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-26 15:39:28 +02:00
Ulf Hermann 8bc307e8ed API Review: Expose delegateModelAccess from QQmlInstantiator
It mirrors the same property from any own delegate model. If you
explicitly set an external DelegateModel to be used by the instantiator,
that one's delegateModelAccess is used. This is in line with how the
delegates behave.

The lack of the property in Instantiator is an API inconsistency and
therefore the fix has to be picked back to 6.10.

[ChangeLog][QtQml] Instantiator now has a new property
delegateModelAccess. Setting it to DelegateModel.ReadWrite allows you to
write values into the model via required properties just as you could
with context properties.

Pick-to: 6.10
Task-number: QTBUG-132420
Change-Id: I44b480182339bff8aef8aba385d2bde63f825ff9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-26 06:44:23 +00:00
Michael Weghorn db2792dd86 QQuickAbstractButton a11y: Strip mnemonic for accessible name
When setting the accessible name for a QQuickAbstractButton,
don't include the ampersand ('&') character that denotes the
mnemonic character, and don't escape literal ampersand characters
by doubling them.

Use the same helper function also used by widgets in qtbase
to strip those extra ampersand characters.

Add a corresponding test.

Fixes: QTBUG-134208
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0da58564ef028cda3c1cc1cecbaacbb4e9d92c17
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-25 17:36:59 +02:00
Dmitrii Akshintsev 65bd842ab0 tst_qqmlparser: add tests for the property declarations
This commit introduces a range of small unit-tests mostly focusing on
covering existing grammar rules with regard to property attributes.
This is a preparation step before introducing new keywords like virtual
and override.

propertyDeclarations test aims to test parsing of properties as isolated
as possible by employing parseUiObjectMember function of a parser.
Moreover additional test helpers like unified parseAs function and
Syntax::Phrase and Syntax::Word and corresponding toString* functions
 provide an easier way to create and manipulate the test data, while also
minimizing the possibility of misspelled token / test data.

Task-number: QTBUG-98320
Change-Id: I0e2d916be7f848c4a8c312c3c0d09e71b97e9ffb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-25 12:52:13 +02:00
Eskil Abrahamsen Blomfeldt baaa6f2171 Make sure we propely dereference all glyphs in distance field cache
When we reference glyphs in QSGDistanceFieldGlyphCache::populate(),
we do this before they are added to the cache, so the cache coords
have yet to be registered. So even for empty glyphs that cover a
0x0 area, they will be still be registered as referenced in the
cache.

However, when dereferencing the glyphs, we would skip if the glyph
did not occupy any space in the cache.

This asymmetrical behavior could lead to a glyph cache mistakenly
being counted as active even after deleting all nodes that reference
it were gone. Thus it would stay around in the glyph cache when it's
invalidated, even though all references are actually gone.

As a simple fix, we make sure the referenceGlyphs() and
releaseGlyphs() are always called for all glyphs. This means that
the list of unused glyphs may sometimes contain empty glyphs, so
when we recycle the unused glyphs, we need to make sure we skip
that for glyphs that do not occupy any space.

Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-132108
Change-Id: I919d8b6a6a2de9bb1f0fccd7c6ffa00436e6ffa5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-06-25 12:52:13 +02:00
Mitch Curtis 5d3f3fdbdb Add easingCurve value type and Easing singleton
This allows defining easing curves from QML, which is useful
for e.g. FrameAnimation or use cases that require non-linear
progression.

[ChangeLog][QtQml] Added the easingCurve value type
and Easing singleton.

Fixes: QTBUG-137468
Change-Id: I2f9c4c2269c80c31a70700dd3a2475c53ba8a930
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-25 18:52:13 +08:00
Ulf Hermann ad6d2bc496 QtQml: Do not evaluate bindings in invalid contexts
If the context is gone, we are technically still able to evaluate
QProperty bindings, but we really shouldn't.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137270
Change-Id: I323c26d59788e4b318ec4733e1593e761beb4b6f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-25 12:52:13 +02:00
Mitch Curtis 270bd4dc05 Don't delete component delegates
This makes it impossible to e.g. swap between two delegates.

Similar to 80f1186338 except for
QQmlComponents.

[ChangeLog][Controls][Important Behavior Changes] Old QQmlComponent
delegates (not the item instances created by them) are no longer
destroyed when a new one is set, as they are technically owned by user
code. They will still eventually be garbage-collected as expected,
assuming there are no references to them.

Fixes: QTBUG-137777
Change-Id: Icbe6971727d684a266b12a0b41474397e536bfdc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-25 06:45:18 +00:00
Ulf Hermann e0620d4d67 QtQml: Allow access to base object members from VariantAssociationObject
Pick-to: 6.10 6.9
Fixes: QTBUG-137328
Change-Id: I6bb58dc58a8e29eed4d73b51104deb4d58f4cec0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-25 03:46:49 +02:00
Shawn Rutledge 0f02ce33f9 Only activate DragHandler if drag starts within it
Previously, starting a mouse drag outside a DragHandler's parent and
moving inside would activate it. This is unexpected behavior,
inconsistent with touch behavior, and might interfere with other drags,
so we only activate a DragHandler if at least one point was pressed
inside the parent.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-127863
Change-Id: I2215636397ce9fc6a29b9a35165507e5b8d886f4
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-06-24 20:14:48 +02:00
Ivan Solovev b8fd380724 Add tests for QQmlSslConfiguration::sslOptions
The tests show that the sslOptions property is out of sync with the
underlying QSslConfiguration.

Amends b44f466621.

Task-number: QTBUG-137900
Pick-to: 6.10 6.9 6.8
Change-Id: I2a34b373ea868c7e76c7470f872d3ba0233394ea
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-24 20:14:48 +02:00
Ulf Hermann c1924afcd8 QtQml: Move ExecutionEngine in to QJSEnginePrivate
The ExecutionEngine can live without a QQmlEngine or a QJSEngine, but
not vice versa. Therefore, the ExecutionEngine has to outlive QQmlEngine
and QJSEngine on shutdown.

Since the ExecutionEngine lives longer now, we also need to postpone the
pruning of the type registry. The engine might still hold on to types
after all.

Task-number: QTBUG-137848
Change-Id: Ib574cac84b5f2d974cbc24ed79550a58b69a7a1c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-24 14:38:07 +02:00
Assam Boudjelthia f84f10259a Android: fix Quick tests handling for for safe area margins
Account for top and bottom safe margins in Quick tests.

Pick-to: 6.10 6.9
Change-Id: Id1cb4486780f3fc42a96e2efb854d3700de619a0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-06-23 19:48:42 +00:00
Ulf Hermann 6b14ba5c2f QmlCompiler: Discern between different kinds of side effects
A mere jump does not cause all value types and lists to be invalidated.
Only calls to other functions or writes to other properties do that.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137540
Change-Id: I069c6873455c51bbea59cf876d2bc7ecd188f81b
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-23 15:44:42 +02:00
Ulf Hermann 32602bef7c QmlCompiler: Sharpen side effect detection
Stack-created lists of primitives or pointers cannot be affected by side
effects. We cannot write a value affected by side effects to a list that
isn't, though.

Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: I99ab4337cabc6111a81b8164fd94962edc0db25e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-23 15:44:38 +02:00
Ulf Hermann 9035d1cb2a QmlCompiler: Restore support for writing to temporary arrays
We use the JavaScript extension as "read" type to signify that the code
generator will accept any type with such an extension. This requires
some adjustments in the type resolver.

Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-137540
Change-Id: Ia34ca0a24c417c5372852268ba2f55825484639d
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-23 11:17:06 +02:00
Ulf Hermann ea39961f74 QQmlInstantiator: Add test for setting the delegate after the model
This reveals an inconsistency: Instantiator retains any delegate of a
DelegateModel passed in as model and stores its own delegate separately.
Other views update the delegate of any DelegateModel passed in and do
not store their own delegates.

Task-number: QTBUG-132420
Change-Id: Ifa27170ea2ff47b5adeec7ac5a065839bdd1d143
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-23 11:17:06 +02:00
Dheerendra Purohit f680527e69 Remove text selection / selection itself on Ctrl+Backspace in TextInput
Remove the text and clear the text selection when the Ctrl+Backspace used on TextInput.

Fixes: QTBUG-81803
Pick-to: 6.9 6.10
Change-Id: I506b12714f13d2758f38e2366dbc898f570ea89f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-21 04:51:41 +00:00
Shawn Rutledge 472eb06f70 Allow SelectionRectangle dragging if TableView doesn't flick via mouse
Setting `interactive: false` on TableView is drastic (except perhaps in
some mode that the user can enter somehow), but setting
`acceptedButtons: Qt.NoButton` should be the default, to have flicking
on touchscreens but avoid dragging by mouse. This is possible since
cbc694491b (but the default was not
changed, for fear of surprising users with a behavior change).

So now QQuickSelectionRectanglePrivate::updateSelectionMode() allows
dragging in either case, via all devices if the TableView is not
interactive, or mouse-only if the flicking is touch-only.

Long-press has so far been allowed to select only in the case when
dragging cannot select. But if the TableView has interactive: true,
then you can flick it on a touchscreen, regardless of how
acceptedButtons is set, even though we may expect the user to select
dragging the mouse. So now if `selectionMode: Auto` is declared, and
touch flicking works, we allow the long-press to select, because
otherwise there would not be a way to make a selection on a touchscreen.

We should not consider `interactive: false` to be normal (unless the
developer finds a need to disable scrolling in some unique modal use
case that can be exited somehow). `acceptedButtons: Qt.LeftButton`
is not a very useful setting either (even though it's still the
default).

The snippet is improved to illustrate, along with some drive-by's.
Docs explain the behavior in more detail. Test coverage is added in the
manual test and the autotest.

Pick-to: 6.9 6.10
Task-number: QTBUG-97111
Task-number: QTBUG-132268
Change-Id: I912dbc7bf8de536794b5bdcc1269bf2860645de9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-06-20 17:43:03 +02:00
Shawn Rutledge e5522fe5bd Add PinchHandler and DragHandler 2-finger inside/outside tests
These should already behave the same with much-older Qt versions:
so far, multi-point handlers require all points to be pressed inside the
parent Item.

Although DragHandler has long supported setting minimumPointCount to
require more than one finger, we didn't have test coverage for that.
So far the main "real" use case is the 2-finger tilt gesture in maps
(in which case target is null), but it can also be used for dragging
a target with more than one finger.

Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-127863
Change-Id: I2d4734f12a31a4b720bd11c05a61bc0cdc3b84ce
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-06-20 17:42:43 +02:00
Wang Chuan de1e849d09 QQuickFlickable: fix jump back when scrolling to edge
Since de591d440c2f43a7e94ef4c93db757d254fa7947, we use [vMoved] to check
if it is the first move in dragging. However [vMoved] can be reset to
false during dragging, and this causes the content to jump back when
scrolling to the edge of the flickable.
(for example when pixel delta is zero, see the code in QQuickFlickable::wheelEvent)

And this issue became more obvious after ec4368adb7.
Since [vMoved] can now be reset to false in all boundsBehavior.

So we need to also check [vData.dragging] to make sure we are correctly in the first move.

Pick-to: 6.9 6.10
Fixes: QTBUG-137323
Change-Id: Ie2222e42c6628df62221ae8f63a55e7bf70d80f0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2025-06-20 14:53:52 +00:00
Dheerendra Purohit 1177ec78d0 Emit TextArea::cursorPositionChanged() when a word is deleted
Emit signal cursorPositionChanged() whenever cursor position has
changed after a word is deleted.
Add an autotest.

Fixes: QTBUG-104829
Pick-to: 6.9 6.10
Change-Id: I174e97f5b320dfdddca8805fa807a8f323a0ef16
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-20 14:57:10 +05:30
Tim Blechmann 0bf9833053 compile fix for manual tests
QLibraryInfo was used, but the header was missing

Pick-to: 6.10
Change-Id: I141f7b5340b92df5bb757f2caed22b8375ee05e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-20 17:27:10 +08:00
Luca Di Sera f1e17903d5 Add a validation mode for the garbage collector
A new environment variable, "QV4_MM_CROSS_VALIDATE_INCREMENTAL_GC", is
introduced that turns on, when set, additional debug behavior in the GC.

In particular, when the mode is enabled and the GC is running in
incremental mode, after every mark phase, some additional validation will
be performed to catch some amount of issues that could be introduced by
the usage of the incremental garbage collector.

In more details, a snapshot of which object was marked by the
incremental run is stored, the mark phase of the GC is then run a second
time in a stop-the-world manner.
The result of the second phase is then compared to the original, making
sure that supposedly bug-induced discrepancies are logged.

Generally, any discrepancy should indicate something that has gone
wrong in one run or the other, possibly both independently.
Nonetheless, for this mode, we assume that non-incremental runs of the
GC can be considered to have a baseline correctness that can be used as
a verifier for the output of the mark phase of a GC run, and in
particular a run of the incremental mode of the GC.

A new state was added to the GC that is intended to run between the end
of the mark phase and the start of the sweep phase.

The implementation for the execution of the `markReady` state was
modified to traverse to this new state during an incremental run when
the relevant environment variable was set during the creation of a
`MemoryManager` instance.

The new state generally implements the algorithm described above.
In particular, a copy of the black bitmaps of each allocator, which are
the result of the mark phase and are enough to pinpoint which part of
the memory was marked, is stored away.
The relevant state that is hold by the GC, is reset to a state that
allows running the mark phase again.
The mark phase is then run from start to finish and the new state of the
black bitmaps of each allocator is compared to the one produced by the
latest run.

Errors are reported when we find that the incremental run has not marked
an object that was considered alive by the non-incremental run, that is,
that we are going to collect an object that is still alive.
Cases where the new run has found an object, that was considered to be
alive by an incremental-run, to be dead, are ignored.
This is due to the incremental run of a GC sometimes being unable to
directly identify an unreachable object as dead, for example when
allocations are performed at certain points in the incremental run.

The implementation of `Managed::className` was modified by extracting
the formatting part out so that it can be accessed as part of the newly
added error reporting.

Some documentation for the new environment variable with a brief and
generic description of the new mode was added to the "Configuring the
JavaScript Engine" documentation page, where similar GC-related
environment variables are documented.

A test was added to ensure that the specific case of discrepancies that
we are interested into are caught by enabling the validation mode.

To allow for the testing process itself to be performed by the
fictitious introduction of bugs of the class we intend to uncover, we
ensure that the entry of the new state in the relevant `GCState` enum
is positioned as if it was part of the sweep phase.
Normally, the state that performs the verification will need to redrain
the stack to take into account changes that can have occurred between
the last state and the start of the verification state, as otherwise
false positives could be introduced by the partial snapshot of the black
bitmaps.
Nonetheless, a redrain can and should re-observe some objects that could
have already been marked in precedence. When this is so, any object that
is unmarked fictitiously, could be marked back again, preventing the
test, which has to mutate the the state at the boundaries of the
computation, from correctly observing the process.
By ensuring that the validation step is performed as if "it was part of
the sweep phase", it will use, during a normal run, the general redrain
process that is commonly part of the execution loop (as performed by
`transition`), so that the embedding of the redrain in the validation
step itself can be avoided.
The test can then perform the necessary run of the GC without passing by
the normal execution loop, knowing that it controls when allocations are
performed, so that it can introduce the necessary mutations at the
boundaries without the risk of some of them being overwritten.

To simplify the testing process, and in particular to avoid having to
capture `qDebug` output during the test run, test-specific code that
saves an intermediate state that can be used as a witness of the
algorithm working correctly was added to the GC, behind the
"QT_BUILD_INTERNAL" flag.

Fixes: QTBUG-135064
Change-Id: If3f9ef029b51b77aaa5b68f349cbb1b20330be70
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-19 15:19:03 +02:00
Ulf Hermann cd89ebc95f Clean up ECMAScript test runner
Remove some unused code and allow it to run without QProcess. We can use
threads after all. Also, activate the "filter" mode via an environment
variable. Running only a subset of the tests is very handy at times.

Most of the dead code was supposed to be used with the qjstest
executable from d9c4a52724, but
d08ede57dd removed qjstest in favor of
using tst_ecmascripttests itself for all ways of running the tests.

Change-Id: I0d220964a98c3f49e97fc6650cf3169db5644af5
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-18 19:16:05 +00:00
Ulf Hermann 491f8a6333 QQmlPropertyValidator: Check inline components first
As mentioned in the comment, we cannot rely on the type registry for
property caches of inline components. So, whatever we find there is
necessarily outdated. Check the compilation unit's inline components
first to avoid this situation.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137115
Change-Id: I708435823428fd9f1cdae4b5bffda36d51ab1982
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-18 11:48:20 +02:00
Ulf Hermann 51e50ec86f QtQml: Avoid direct file access in ECMAScript test runner
We want the type loader to do this job rather than poorly duplicate it
in the test. In particular, the local implementation didn't properly
register the dependencies of loaded ECMAScript modules.

So far we could only load ECMAScript modules using the type loader if
their file names ended it ".mjs". The ECMAScript test suite does not
follow this convention. In order to deal with that, we need to add a
second characteristic. ECMAScript modules can now also be marked using a
URL fragment "#module". Furthermore, since JavaScript files loaded
outside any QML document get full access to the global context, we
introduce another URL fragment "#global" to discern them from the same
files loaded from a QML document.

Change-Id: I625088335d16d5b8eeaa2673f07718367dca1605
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-17 22:11:24 +02:00
Even Oscar Andersen d245a7c0c7 Add missing call to beginResetModel()
QQuickFolderListModel::beginResetModel calls endResetModel
automatically to avoid consequtive calls to beginResetModel.

However, the same logic is not done for endResetModell. This
triggers a endResetModel without a preceeding beginResetModel
which (apparently) causes problems with updating the view
contents in some cases.

Fixes: QTBUG-134600
Pick-to: 6.8 6.9 6.10
Change-Id: I9fe3034b784d83ee2ed5b65bdad3a77545891bc2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-06-17 18:44:41 +02:00
Frédéric Lefebvre 7e551c272c Fix flaky tst_QQuickOverlay::pressedAndReleased on openSuSE
tst_QQuickOverlay::pressedAndReleased is flaky on openSuSE where the
un-updated position of the window is used when the pressedSpy and
releasedSpy are called.

Use helper function ensurePositionTopLeft to give a fix position to
the window and verify that it has been updated.

Pick-to: 6.10 6.9
Fixes: QTBUG-134704
Change-Id: Ibec9f6f2857220d174744f80a11fc7552c1f2ece
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-17 16:44:37 +00:00
Frédéric Lefebvre 6870b8044d Set flag FramelessWindowHint to tst_mouseAreaInterop::createView
Set the FramelessWindowHint flag to tst_mouseAreaInterop::createview.
Removes flakiness from
tst_mouseAreaInterop::dragHandlerInSiblingGrabFromMouseAreaViaMouse.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I2cdbc9701a9e463bcf0a5f326df5726deb8fa093
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-17 16:44:37 +00:00
Frédéric Lefebvre 0309e81fa6 Unblacklist tst_touchMouse::touchButtonOnFlickable on openSuSE-leap
tst_touchMouse::touchButtonOnFlickable is no longer flaky on openSUSE
leap.

Change-Id: I28d25150aabfa938507c1c2750d73cd159b7038c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-17 16:44:37 +00:00
Frédéric Lefebvre 1f522d1502 Unblacklist tst_touchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne
tst_touchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne is no longer
flaky on openSuSE 15.5.

Fixes: QTBUG-118059
Pick-to: 6.10
Change-Id: Ic1a0c89ee60336cbef677e2c065114ef38911fc7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-17 16:44:37 +00:00
Alexandru Croitor b47555feff CMake: Make QT_CMAKE_EXPORT_NAMESPACE available in deferred call
The _qt_internal_write_deferred_qmlls_build_ini_file function is
deferred to be called in the root CMAKE_BINARY_DIR, where
QT_CMAKE_EXPORT_NAMESPACE is not defined if find_package(Qt6) is not
called in the root of the project (like in the Qt Creator super repo).

Make sure to pass the value of QT_CMAKE_EXPORT_NAMESPACE to the
function explicitly, from a scope where it is available.

This avoids errors like:

  Error evaluating generator expression $
    No target "::qtpaths"
    CMakeLists.txt:DEFERRED

Add a test case to the RunCMake.qt_target_qml_sources test to ensure
this doesn't regress.

Amends ddcafa0a51
Augments 9b9a2398f30b6c35ef6be3ce929c352afb682910

Pick-to: 6.10
Fixes: QTBUG-137577
Change-Id: I5b70822576a4f26f24c37c0a866b97cb57150291
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-06-17 18:44:37 +02:00
Mitch Curtis 05664b843f Positioners: hide zero-width or height items
The documentation for e.g. Row says:

    If an item within a Row is not visible, or if it has a width or
    height of 0, the item will not be laid out and it will not be
    visible within the row.

Before this patch, the item wouldn't actually be hidden if its width
or height was zero, but just moved into a list of unpositioned items
and treated as if it was.

This patch fixes that by culling the item.

Fix and add rows to tst_qquickcontainer::zeroSize, which would
otherwise fail.

Fixes: QTBUG-132607
Pick-to: 6.8 6.9 6.10
Change-Id: I04c8a3f1ffb9e4a649024087626c4d7846ca01a0
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-06-17 18:44:37 +02:00
Ulf Hermann 2692b14cfb QtQml: Allow remote JavaScript files in WorkerScript
Fixes: QTBUG-19407
Change-Id: I482689396db82332e50c41e6404d58376f4dc118
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-17 07:00:37 +02:00
Ulf Hermann d2bc4a4330 QtQml: Hold QQmlTypeLoader in QV4::ExecutionEngine
... rather than QQmlEngine. This paves the way for having the type
loader attached to ExecutionEngine rather than QQmlEngine.

Also, reference the execution engine in the type loader, in turn.

Task-number: QTBUG-19407
Change-Id: I04e571c5c6ac5bce5e82537cb96c6940c7186f3a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-17 07:00:33 +02:00
Fabian Kosmale 781ea26485 QQmlJSImportVisitor: Add constructor without target
In many cases, we were passing a fresh scope to the QQmlJSImportVisitor
as the target.
Add a new constructor whih takes care of this, and use it wherever
possilbe. This allows disambiguating between call-sites that update an
existing scope, and those which will create a new one.

Change-Id: I140c349ac2f17371b7916d38225170420053a718
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-16 21:09:31 +02:00
Sami Shalayel 032a2e6bf0 dom: workaround mixed import paths in commitToBase
CommitToBase was modifying the QDeferredFactory to point to the base
environment instead of the temporary child environment. This can lead to
weird behaviors in case the import paths in the temporary environment
were differing from the ones in the base environment.
Therefore, pass the import paths along to allow loading the file in the
base environment using the import paths of the temporary environment.

This avoid mishaps where lazy Qml files populated after their
commitToBase calls use a different import path than if they were
populated before their commitToBase calls.

This commit is a workaround for qmlls loading files that require
different import paths into the same DomEnvironment.
A proper fix should come with QTBUG-134308: qmlls should load
files that require different import paths into different
DomEnvironments/QQmlCodeModels. QTBUG-134308 seems to introduce too
much new code to be picked back and will take some time to be ready,
therefore this workaround.

Fixes: QTBUG-137705
Pick-to: 6.10 6.9 6.8
Change-Id: I9ddcc73558778d373a5de23c4fe90ec98bc99af3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-16 10:19:27 +02:00
Michael Weghorn 245f4d1d8b a11y: Report QQuickControl locale
Implement support for QAccessible::Attribute::Locale
(newly introduced in a previous qtbase commit) for
QQuickControl objects by introducing a new
QAccessibleQuickControl class that subclasses
QAccessibleQuickItem and implements
QAccessibleAttributesInterface to handle that
one attribute.

Add a corresponding unit test.

Pick-to: 6.10
Task-number: QTBUG-137144
Change-Id: I3d94df920d5c965d6d803512e8e37234be79a8fc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-16 05:57:10 +02:00
Ulf Hermann 9f1f147789 ECMAScript tests: Add option to use threads instead of processes
This is a handy way to torture test the type registry. Also, you can
attach a debugger to the tests without gymnastics this way.

Change-Id: I6b6e273d2b640ad28c22714b3aea9a9833b92917
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-14 09:22:49 +02:00
Ulf Hermann 943f9ca3c5 Disable tst_qquickcontextmenu::menuItemShouldntTriggerOnRelease
Blacklist it on opensuse and skip it on android.

Task-number: QTBUG-137400
Change-Id: I8da8352e210d80734f5b0f9b3ab4e43799dda84d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-13 22:59:26 +02:00
Michael Weghorn 3759d323d3 QtQuickView statuslistener test: Use version-independent include
This amends e4971b51f8
and should fix build failures like the Android one seen
for the Qt submodule update in [1]:

    agent:2025/06/13 05:11:49 build.go:412: /opt/android/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=x86_64-none-linux-android28 --sysroot=/opt/android/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMETA_LIB -DQT_QMLMODELS_LIB -DQT_QMLTEST_LIB -DQT_QMLWORKERSCRIPT_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DQT_TESTCASE_BUILDDIR=\"/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/qtquickview/statuslistener/android-build/build/qt_generated/qml\" -DQT_TESTCASE_SOURCEDIR=\"/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/qtquickview/statuslistener/android-build/qml\" -DQT_TESTLIB_LIB -Dtst_qtquickview_statuslistener_qml_EXPORTS -I/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/qtquickview/statuslistener/android-build/build/qt_generated/qml/tst_qtquickview_statuslistener_qml_autogen/include -I/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/qtquickview/statuslistener/android-build/qml -isystem /home/qt/work/install/target/include/QtQml -isystem /home/qt/work/install/target/include -isystem /home/qt/work/install/target/include/QtCore -isystem /home/qt/work/install/target/mkspecs/android-clang -isystem /home/qt/work/install/target/include/QtQmlIntegration -isystem /home/qt/work/install/target/include/QtNetwork -isystem /home/qt/work/install/target/include/QtQuick -isystem /home/qt/work/install/target/include/QtGui -isystem /home/qt/work/install/target/include/QtQmlMeta -isystem /home/qt/work/install/target/include/QtQmlModels -isystem /home/qt/work/install/target/include/QtQmlWorkerScript -isystem /home/qt/work/install/target/include/QtOpenGL -isystem /home/qt/work/install/target/include/QtQuickTest -isystem /home/qt/work/install/target/include/QtTest -isystem /home/qt/work/install/target/include/QtQuickTest/6.11.0 -isystem /home/qt/work/install/target/include/QtQuickTest/6.11.0/QtQuickTest -isystem /home/qt/work/install/target/include/QtTest/6.11.0 -isystem /home/qt/work/install/target/include/QtTest/6.11.0/QtTest -isystem /home/qt/work/install/target/include/QtCore/6.11.0 -isystem /home/qt/work/install/target/include/QtCore/6.11.0/QtCore -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -O2 -g -DNDEBUG -std=gnu++17 -fPIC -fvisibility=default -Wall -Wextra -fPIC -pthread -MD -MT CMakeFiles/tst_qtquickview_statuslistener_qml.dir/tst_qtquickview.cpp.o -MF CMakeFiles/tst_qtquickview_statuslistener_qml.dir/tst_qtquickview.cpp.o.d -o CMakeFiles/tst_qtquickview_statuslistener_qml.dir/tst_qtquickview.cpp.o -c /home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/qtquickview/statuslistener/android-build/qml/tst_qtquickview.cpp
    agent:2025/06/13 05:11:49 build.go:412: /home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/qtquickview/statuslistener/android-build/qml/tst_qtquickview.cpp:4:10: fatal error: 'QtQuickTest/6.10.0/QtQuickTest/private/quickforandroidtest_p.h' file not found
    agent:2025/06/13 05:11:49 build.go:412: 4 | #include <QtQuickTest/6.10.0/QtQuickTest/private/quickforandroidtest_p.h>
    agent:2025/06/13 05:11:49 build.go:412: |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    agent:2025/06/13 05:11:49 build.go:412: 1 error generated.

[1] c72502c9a2/test_1749788448/log.txt.gz

Pick-to: 6.10
Task-number: QTBUG-133439
Change-Id: I58e0ce19e49b8f5ea286283e953392772cbd7a05
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 18:48:57 +02:00
Mitch Curtis 6e6cfe4f96 Improve "Cannot assign object to list property" error message
Before:

    Cannot assign object to list property "animations"

After:

    Cannot assign object of type "QQuickFrameAnimation" to list property "animations"; expected "QQuickAbstractAnimation*"

Fixes: QTBUG-137469
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Iddf52d4262720236ffc610b6f7326bb126c53509
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-12 16:18:24 +08:00
Dmitrii Akshintsev f649231204 QML Language: qqmljs.g update future reserved keywords
Initial implementation was based on the 3rd edition of ECMAScript.
Many things have changed since then and most of keywords were removed
from that section, even starting from the 5th edition of the standard.

This commit removes most of these reserved keywords, while leaving out
some which might potentially be useful for QML in the future.

Change-Id: I0190a6ea6d08b5d0797eb46c6636ffdb295b4565
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-12 10:18:24 +02:00
Michal Seben b4641ef403 Tests: ommit accessibility tests based on config
If accessibility feature is disabled, also don't build the related tests.

Pick-to: 6.8 6.9 6.10
Change-Id: Ieb34b481f8638a484d1b1b0672b7047d3c6ea3fb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2025-06-12 08:18:24 +00:00
Ulf Hermann 5137c85f1b QtQml: Do not crash when registering native modules on QQmlEngine
We need to tell the type loader that this is an ECMAScript module since
it cannot determine it from the file name.

Amends commit dc60c305a2

Pick-to: 6.10 6.9 6.8
Change-Id: Ie91bce86a08a81ff3df6c11d016308e3e380f15f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-12 06:33:21 +02:00
Fabian Kosmale a4ef8ef8f7 qmllint: Recognize transparent as a color in quick plugin
Besides the named constants and (A)RGB representations,
QColor::fromString (which is used to parse valid strings) also supports
using "transparent". The linter however did not handle this special case
so far.

This commit adds the missing support. We don't add "transparent" to the
list of known color names to mirror the documentation in
QColor::fromString: "transparent" is not actually a color keyword, but a
separate check.

Amends 53ccd32136

Fixes: QTBUG-137054
Change-Id: Ic031144b888d3fa892a87c44b4bffdc4c21bebf8
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-11 17:05:24 +02:00
Ulf Hermann 063cb0becd tst_qmlcachegen: Produce nicer failure messages
Change-Id: I74b12066ba34f744958bb8170579197cbb915dee
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-11 11:28:21 +02:00
Mitch Curtis b4e80edc64 tst_QQuickFile/FolderDialogImpl: use canonical paths
This adapts to 7bd7df5aa170c240061144a9210a13b62949935c.

The test was expecting e.g. this path:

/var/folders/0r/vd385j117f949qnfm4h_539w0000gn/T/tst_qquickfiledialogimpl-dqvSBE/sub-dir

But the actual path was this:

/private/var/folders/0r/vd385j117f949qnfm4h_539w0000gn/T/tst_qquickfiledialogimpl-dqvSBE/sub-dir

Fixes: QTBUG-137416
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I31b929017ebb1a672a614f8b409dc5c4e8d5e000
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-11 13:50:00 +08:00
Fabian Kosmale 5bec6a1d0c gc: Assume less if hasConstWrapper is set
QQmlData is attached to a QObject, and consequently can't be used to
track engine local state. Whether a _given_ engine has a const wrapper
for a QObject is an example of such local state.
False assumptions based on hasConstWrapper in turn led to asserts when
using multiple engines.

Fix this by changing the meaning of hasConstWrapper: It now only
indicates that at some point, a given engine had created a const
wrapper. If that flag is not set, we know that we can skip lookups in
m_multiplyWrappedQObjects. If it is set, we can't assume anything, and
have to consult our engines m_multiplyWrappedQObjects to truly know
whether we have a const wrapper or not.

Pick-to: 6.10 6.9 6.8
Change-Id: Id26823bdc942b227c991571334f45f45b8b109c3
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-10 13:25:50 +02:00
MohammadHossein Qanbari e53a22722d tst_QQuickMenu::contextMenuKeyboard: Fix flakiness on xcb platforms
This patch addresses flaky failures in the context menu keyboard test
on xcb platforms. Previously, after opening the menu, the menu was
sometimes not opened as expected. Additionally, simulating a Tab key
press after opening the menu did not always give focus to the first
menu item.

The root cause was the focus timing inconsistencies on xcb: when the
window is shown, it may not receive focus immediately. This can
deactivate the application's focus window, causing popups/menus to
close unexpectedly or preventing the Tab key from correctly focusing
the first menu item.

To fix this, the patch processes pending and deferred events before
opening the menu, but only on xcb platforms, ensuring the window
receives focus in time.

Pick-to: 6.10
Task-number: QTBUG-133858
Change-Id: I648c72b484852d23c84e41dc6450c1f50cc4bdc2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-06-10 11:25:50 +00:00
Olivier De Cannière 2a6e8582fc qmllint: Warn about using enums as type annotations in functions
Until we support a proper representation of enums in the type system,
all we can do is warn the user that enums can't be used as types.

After the improved runtime warning added in a recent commit, this patch
adds a qmllint warning to warn about the same issue but at
'compile time'.

Fixes: QTBUG-135255
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I02266f21266e59eb6d4a4dbe0e4335b845c62133
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-10 13:25:50 +02:00
Olivier De Cannière f64ba5dec8 Qml: Warn about using enums as type annotations in functions
The warning emitted when calling functions with parameters type
annotated with enums does not communicate what's wrong or how to fix
it:

"1 should be coerced to void because the function called is
insufficiently annotated. The original value is retained. This will
change in a future version of Qt."

Until we support a proper representation of enums in the type system,
all we can do is warn the user that this does not work.

Add another warning that fires once when the function is constructed
that has a better description of what is going wrong. This should
provide the user with the info to solve the issue unlike the original
warning.

This does mean that we warn more for the same issue but it should still
be beneficial overall.

Task-number: QTBUG-135255
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Icd8f8d80c6a4b9bd2b33c660394b9cf5a228a346
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-10 13:25:50 +02:00
Ivan Solovev 52086f74e6 QQuickMultiPointTouchArea: fix grab threshold calculation
Ths logic of deciding if we need to grab a gesture was using
scenePosition() and scenePressPosition() and comparing the diff to the
styleHints()->startDragDistance().

If the scene is scaled, the returned points are also scaled, but the
startDragDistance() value is not affected by the scale. As a result,
the logic for grabbing the gesture was broken, starting it too early
(if scale > 1.0), or too late (if scale < 1.0).

Fix it by calling mapFromScene() on both points.

Fixes: QTBUG-131886
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ie7c7472f9d9806d18728b4059e23ec279090db6f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-06-10 13:25:50 +02:00
Mitch Curtis 07096eef54 IconLabel: ensure that items declared as children are painted on top
This is what users would expect, as it's how Qt Quick behaves in
general.

Fixes: QTBUG-133924
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I2af6d48f5fa6fb15ee93efe1eac0ae950872834e
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-06-09 11:11:59 +08:00
Ulf Hermann db7a74d7dc QQmlBind: Store all values as QV4::PersistentValue
We can't store them as QObject because that may result in dangling
pointers. We need the heap wrappers to track deletions.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-135295
Change-Id: Id53932aec834ad59104bd867c0056fb8da94d827
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-08 08:53:56 +00:00
Jan Arve Sæther 250ee00574 Fix mirroredCombobox for FluentWinUI3 style
Pick-to: 6.10
Change-Id: I6c923b11362d3ddf37ea1ccb8fa5775f5533b57b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-06-06 13:04:41 +02:00
Sami Shalayel c9713681e8 qmlcachegen: fix crash on unresolved type with required property
qmlcachegen can't resolve all types when importing QtQuick.Controls, so
scopes from QtQuick.Controls might be unresolved.
Check the scope before creating a fix suggesion when checking the
required properties, and add a test that tests a file with required
properties on an unresolved base type "Tumbler".

This also fixes the crashes from QTBUG-137196 and QTBUG-136998 it seems.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137411
Fixes: QTBUG-137196
Fixes: QTBUG-136998
Change-Id: Ibf461b54abf84ba13bff8c4833940c7359cf2d8e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-06 13:04:40 +02:00
Sami Shalayel cb1eaacd19 qmlformat: fix crash on StatementLists
The pointer returned by ensureCommentForNode() is invalidated when the
m_commentedElements map is modified, for example when inserting a new
comment via another ensureCommentForNode().

In the StatementList, we actually don't need to create a comment, we
just need to lookup one comment, so partially revert the apparently
drive-by change from b91ca3e0bc.

A separate commit will make ensureCommentForNode() private to avoid
similar crashes in the future.

Fixes: QTBUG-137413
Pick-to: 6.8 6.9 6.10
Change-Id: I6e281cc155e2179a880fa4a876133d90c4afae75
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-06 13:04:40 +02:00
Ulf Hermann 5068a675c4 QtQml: Do not store type references for properties
This allows a type A to have a property of type B while B also has
a property of type A. This is very helpful for list-like or otherwise
linked data structures. For example the BaseConstraint type in the
DeltaBlue benchmark wouldn't have been necessary if this feature had
been available before.

It has the side effect of making it impossible to validate inline
component types before they're instantiated. We don't actually have
the type at the point where a property is declared. However, since
you certainly want to instantiate at some point and qmllint will still
help you find the problem, this is acceptable.

We also have to intercept URLs before we create QQmlType instances now.
This is because now we only have the URLs to identify types. Having
multiple QQmlType instances referring to the same logical type wsd a bad
idea anyway.

[ChangeLog][QtQml] You can now have cyclic type references in QML
documents. A QML type A can have a property of type B while B has a
property of type A. You can still not cyclically inherit or
instantiate types in QML documents, of course

[ChangeLog][QtQml] Your URL interceptors may get called more often now,
for URLs QML neglected to intercept before. This means that more URLs
may be constructed from already-intercepted base URLs. URL interceptors
should check for this condition.

Change-Id: I84753a883c2de98e16d1c3826e7e56e897eeafb8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-06 13:04:40 +02:00
Richard Moe Gustavsen e3ef5ef2f1 QQuickTableView: use correct model when checking if an item is editable
When TableView needs to resolve if a model item is editable, it needs
to call QAbstractItemModel::flags(modelIndex). But as it stood, it would
call this function on the internal proxy model set by TreeModel, using a
QModelIndex from the application model (tappedIndex).

Since tappedIndex belongs to the application model, this patch
makes sure that we ask the application model, and not the proxy
model, if the given model item is editable.

Fixes: QTBUG-136492
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0011c46f1b07470ebcb83d93aa3d592e7339345e
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-06-06 13:04:40 +02:00
Fabian Kosmale 0c705ac038 qmllint: Quick plugin: Recognize more acceptable colors
QColor::fromString does not care about the casing of named colors, and
conseqently neither does the QML engine. Unconditionally lower case the
color in the check to accomadate it.

Pick-to: 6.10
Change-Id: I35aa4162bcd8682bbea86776c9929e00f891cdb9
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-06-05 20:58:21 +02:00
Ulf Hermann 18d370ffb1 QtQml: Better encapsulate QV4::Script
Make members private, add accessors, add m_ to member names, etc.

Change-Id: I497db10b62bbfb32f55dca227af9a518da6eaa70
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-06-05 20:56:15 +02:00
Elias Toivola 9d7f189b99 Windows 11: blacklist tst_qquickiconimage::sourceBindingSourceSize
This amends 9d3a157cf5

Pick-to: 6.10
Task-number: QTBUG-136447
Change-Id: I1b30256c9be5382cda63da4416edb8c631279cf6
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2025-06-05 10:43:11 +03:00
Doris Verria 61050349bf QQuickSlider: Normalize near-zero values when setting slider value
Normalize near-zero values to 0.0 first before doing a fuzzy compare,
as the latter may give false when comparing near-zero values to 0 eg:
0.0 and 1e-15.

Fixes: QTBUG-134635
Pick-to: 6.8 6.9 6.10
Done-with: Jasuhan-Yoganathan <yasuhan.yoganathan@qt.io>
Change-Id: I81474760dded319d41280c3ef8dbff340ae649e3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-06-05 09:33:01 +02:00
Mate Barany a3156e57f0 Fix a comment in setDataThroughDelegate.qml
The second column refers to "age" which is supposed to be an int,
not a string.

Pick-to: 6.10 6.9 6.8
Change-Id: Ie21e9efa89b541e5b58ff9450c12dd66fe1c6700
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-06-05 04:39:37 +00:00
Paul Olav Tvete f5140d6208 Fix for global position in hover events
The hover event delivery logic is based on scenePosition, so the global
position has to be calculated. Using item.mapToGlobal(scenePosition)
will apply the item's position twice. This change first calculates
localPosition and then uses item.mapToGlobal(localPosition).

Fixes: QTBUG-134099
Pick-to: 6.10 6.9 6.8
Change-Id: I83f1382784300a1c73ab2b6f50e0288dcf99689b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-06-04 09:37:29 +02:00
Richard Moe Gustavsen da9de7c13e tst_qquicktableview: fix copy/paste bug, where EditKeyPressed is tested twice
In the affeted row in the patch, it should be QQuickTableView::AnyKeyPressed,
and not QQuickTableView::EditKeyPressed.

Change-Id: Ib8493bbfbdf0528b740974c3a5f2f1c22371ac9f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-06-04 09:24:18 +02:00
Sami Shalayel ddcafa0a51 cmake: map module to import paths in build folder for qmlls
Add a .qt/.qmlls.build.ini file into the top-level build folder that
maps locations of QML modules to their import paths.
This avoids generating .qmlls.build.ini files in all QML modules build
folder and only generates one file.
This will allow qmlls to know the extra import paths set via "IMPORTS
TARGET" and "DEPENDENCIES TARGET" in CMake just by knowing the build
folder, so that the import paths don't need to be passed by the editor
or .qmlls.ini to qmlls. A separate commit will take care of making qmlls
read the .qmlls.build.ini file.

This could be extended in the future if we realize that qmlls needs more
information from the build system.

Add a test.

Task-number: QTBUG-134307
Change-Id: Ic10fb6088894e13388a96bc4922048fa7bb89d6b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-04 09:00:30 +02:00
Olivier De Cannière 3e61e4f11a qmllint: Only recurse into QML scopes when searching inline components
When searching for inline components, we perform a BFS starting from a
type and recursing into its base types and children. We previously
didn't check the scope type of the children. This is wasteful as there
is no point in recursing into scopes such as enum or script scopes.

This also has the side effect of fixing an infinite loop in certain
cases where a grouped property's base type is one of its parents. That
type would then get readded to the list of to-be-visited nodes over and
over. The question of the base type of the grouped property will need to
be dealt with in another commit. Created QTBUG-137327.

Amends bfdf1bf797

Fixes: QTBUG-137035
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic56087e2cb5ffd33b4659b411ad8954a4c15e0fa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-04 08:23:58 +02:00
Marc Mutz 51f647eb34 Normalize signal/slot signatures 2025
This is the result of running util/normalize on the code base. The
following manual edits were needed:

(none)

Pick-to: 6.10 6.9
Change-Id: I222460afe00375733f2e5064d0dcbe51d58cdf7f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-04 06:12:30 +00:00
Fabian Kosmale 217439c2d1 VariantAssociationObject: mark own member during gc
We were missing the DECLARE_MARKOBJECTS macro, which could lead to heap
corruption if the mapping was actually in use.

Pick-to: 6.10 6.9
Fixes: QTBUG-137350
Change-Id: Idd9184a3a3c35faa7caf35d0e3ac8c901f99afb7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-04 07:56:54 +02:00
Tor Arne Vestbø c6351d481a Enable expanded client area by default in iOS style
[ChangeLog][iOS] The iOS style now enables expanded client areas by
default. To override this, set the ApplicationWindow's flags explicitly
to e.g. Qt.Window.

Change-Id: I333e36d2959b2ff8029cc685ec2b5610d11e6069
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-06-02 23:11:37 +02:00
Fabian Kosmale 70a38fc67a QQmlJSScope: Create list type for enums
When creating the QQmlJSScopes for enums, we would not resolve their
corresponding list type, leading to confused qmllint warnings about the
type not being found.
Fix this by immediately creating the corresponding list type when an
enum tpye is created.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-137256
Change-Id: Ic0479b19467820838426a6f6fe5288cad62e3ff7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-06-02 16:38:05 +02:00
Dilek Akcay 8576166145 Introduce SearchField for Quick Controls
Add a new QQuickSearchField as part of the Qt Quick Controls to
simplify implementing search functionality for lists of items.

Task-number: QTBUG-126188
Change-Id: I634131161447616a2d66e7f301bd8a24adac2d7f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-06-01 20:21:39 +00:00
Tor Arne Vestbø 43821db663 tst_QQuickApplicationWindow: Base expected element size on content item
Now that Android takes safe area margins into account on startup,
as of qtbase e96a4b84e136d065054600c07bf5fae17f3049ce, we can't
assume the size of elements placed into the content item is the
same size as the screen's available size.

What these tests seem to test is that the root elements of a
window fill the available space in the window correctly, which
we can check by comparing the size to that of the content item,
which is automatically inset based on the window's safe area
margins.

Pick-to: 6.9
Fixes: QTBUG-137285
Change-Id: I6f40ba824426f0acec73e50cdc9984c05a44bf91
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-31 11:36:43 +03:00
Fabian Kosmale a4da2d2294 QQuickWindowAttached: warn when trying to attach to non-Item
As documented, the Window attached property only works with item derived
types. The attached object is however still created, so there is no
runtime failure. Print a warning message to give the developer a hint
about it.

Task-number: QTBUG-134800
Pick-to: 6.9 6.8
Change-Id: I359e665c2add5a80e9f986f96f90176d93cfc865
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-05-31 10:36:42 +02:00
Olivier De Cannière 5e312953f6 Qml: Add key <-> string helpers to Qml enums
[ChangeLog][QML] It is now possible to map between the value of enum
keys and their string representations by calling the enumStringToValue,
enumValueToString, and enumValueToStrings methods on the Qt global
object.

// Main.qml
Item {
    enum E { Black = 0, White = 1, Grey = 2, Gray = 2 }

    // 1 (White)
    property int i: Qt.enumStringToValue(Main.E, "White")

    // "Black"
    property string s: Qt.enumValueToString(Main.E, Main.E.Black)

    // ["Grey", "Gray"]
    property list<string> ss: Qt.enumValueToStrings(Main.E, Main.E.Grey)
}

Fixes: QTBUG-116513
Change-Id: I78d9cdcfb2761e0cf4b22f2402701a0972686eb2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-31 10:36:42 +02:00
Olivier De Cannière a35b0e44ae Qml: Allow accessing unscoped enums values as <Component>.<Enum>.<Key>
[ChangeLog][QML] It is now possible to access unscoped enum values in a
scoped way as <component name>.<enum name>.<key>. Previously, it was
only possible to access them in an unscoped way.

Task-number: QTBUG-116513
Change-Id: Iff56cd3365516215e1e195a147fae66ee17d39e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-31 10:36:42 +02:00
Sami Shalayel 455f3169e3 make tst_generate_qmlls_ini a data test
Massage the test to become a data test, so that it can be more easily
extended and changed.

Change-Id: I7eca260b9ba4b73fd4d474ed18ebd0bed46afb5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-31 07:02:18 +02:00
Sami Shalayel 64bc8887f2 qmllint: implement MaybeWarnEqualityTypeCoercion
Warn in qmllint when encountering "==" or "!=" about possible type
coercions between JS objects, numbers, strings and booleans.

Task-number: QTBUG-129307
Change-Id: Ib9b8057c1b4eca760c4f40825f4053aa35f1680b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-05-31 07:02:15 +02:00
Sami Shalayel cdd5cc9437 qmlls: read import paths from .qmlls.build.ini file
Find and read the import paths and documentation directory from the
.qmlls.build.ini file in qmlls.

Add a test.

Fixes: QTBUG-134307
Change-Id: I0a61bc7fa7ce1fec63165419883d62601cf5b286
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-31 07:02:14 +02:00
Olivier De Cannière 2e00bc40cc qmllint: Warn about unintentional empty blocks
If a property binding is a js block without any statements, it could
mean that the user intended to create an object literal instead of an
empty block that returns undefined.

Task-number: QTBUG-129307
Change-Id: If242ddac140cce6479062194b785096ba1f6c0a6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-05-30 22:25:39 +02:00
Mate Barany afc5a1c6f4 Test QQmlTreeModel::setData through delegates
Task-number: QTBUG-130571
Change-Id: I5992b1e89c931e22f9b9e55ec104a3f443855520
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2025-05-30 21:46:12 +02:00
Mate Barany c30c879ede Test QQmlTreeModel::setRows on a non-empty model
Task-number: QTBUG-130571
Change-Id: I42ce77523d6f9cacf60f53159171965b6942bc2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-30 21:46:06 +02:00
Oliver Eftevaag 28c5e3482b Popup/Overlay: Filter no events for non-popup children of Overlay
Previously in 01de987039 we allowed
MousePress and MouseRelease events to be passed to non-popup children of
the overlay, but no other pointer event types.

Allowing just MousePress and MouseRelease events seems arbitrary, since
we should either tell users that they can put items on top of the
overlay, or discourage this kind of use case altogether.

Since 81e53a7e9c we documented that this
is a practice that should work normally, and thus it would make sense to
allow all types of events to be sent to items that are on top of the
overlay.

Fixes: QTBUG-132644
Task-number: QTBUG-134545
Pick-to: 6.9 6.8 6.5
Change-Id: Iad29b9abb694bd0653da220f2922b294219396bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2025-05-30 18:38:56 +02:00
Olivier De Cannière 5f3545d930 qmllint: Implement StateCannotHaveChildItem warning
Task-number: QTBUG-129307
Change-Id: I3c6cabb85b8c33f59e42fcc9c969937a9884ccc1
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-05-30 18:29:50 +02:00
Olivier De Cannière 005848a0c8 qmllint: Suggest specific types instead of var
A test was slightly adapted as a result.

Task-number: QTBUG-129307
Change-Id: I07ac61b183d9d7d237e9cf51ce3a0c6c280daa45
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-05-30 18:29:44 +02:00
Olivier De Cannière 7c97e932e1 qmllint: Warn about Components that don't have exactly one QML child
Two other tests needed to be updated as a result.

Task-number: QTBUG-129307
Change-Id: I1470a5ae93cc20ef90ffd63471bd36408b61af57
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-05-30 18:29:31 +02:00
Mate Barany fc225a2a9f Test QQmlTreeModel::setRows on an empty model
Task-number: QTBUG-130571
Change-Id: I933286a5ee07cfd1bf71c29d20646be6a74b38cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-30 18:16:27 +02:00
Mate Barany 7ead5e585f Test appending to an empty QQmlTreeModel
Append a subtree to an empty model. The first input is not verified,
but subsequent appends are validated against this first input.

Task-number: QTBUG-130571
Change-Id: I7ea3b327ef2ad392dbff32c2277d95817e183066
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-30 18:16:14 +02:00
Jan Arve Sæther 9efc1fb4ac Provide a way to sieve data in QML through the SortFilterProxyModel
Enhance QSortFilterProxyModel to be available in QML with changes
as mentioned below and export the type as SortFilterProxyModel
(Note: adopted most of these features from existing project -
https://github.com/oKcerG/SortFilterProxyModel)

   * Inherit QQmlSortFilterProxyModelPrivate from
     QSortFilterProxyModelHelper and use the mapping logic
     of source to proxy indexes from it.
   * Allow the model to be configurable with multiple filters and
     sorters. The filter and sorter components shall be inherited
     from QQmlFilterBase and QQmlSorterBase respectively.
     The components are maintained within the respective compositor
     classes. The filter and sorting operation from
     QQmlSortFilterProxyModel will be forwarded to the compositor
     which then iterate through the configured components to sieve
     the data. This patch allows the following filters and sorters
     configurable in SFPM,
       Filters:
         ValueFilter - Filters the data that matching with the
                    provided value or role name or combined
		    together if both are specified.
         FunctionFilter - Filters the data according to the result
		    of the evaluated js method.
       Sorters:
	 RoleSorter - Sorts the data according to the provided
		    role name.
         StringSorter - Sorts the data by considering the locale.
	 FunctionSorter - Sorts the data according to the evaluated
		    js method.
   * Add support for 'enabled', 'column' property for both filters
     and sorters, and 'priority' property for the sorters.

Task-number: QTBUG-71348
Change-Id: I65b84936642e5f0f382d83413648d2c6794c18aa
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-05-30 08:17:04 +02:00
Mate Barany 536588fa0f Add tests to QQmlTreeModel::removeRow
Task-number: QTBUG-130571
Change-Id: I7246bf41039256895be1e0ae547d7ee21a26b15a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-29 22:31:37 +02:00
Mate Barany 2302a50f81 Add tests to QQmlTreeModel::setRow
Also try some invalid indices and values.

Task-number: QTBUG-130571
Change-Id: Ie24561a1e4fc1162d750f6690b307a6b8482493c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-29 22:31:31 +02:00
Mate Barany a10a3f7364 Add tests to QQmlTreeModel::appendRow
Try to append to invalid indices and some malformed data as well.

Task-number: QTBUG-130571
Change-Id: I5aa7d5f93f8f69e953ac398aa2d84e55dc7a3f68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-29 12:57:51 +02:00
Mate Barany 7fecbeb97f Add some test cases when appendRow is appending to root
Try to add a node, a subtree and some invalid values.

Task-number: QTBUG-130571
Change-Id: Ibe3d0d9f59386fc6c5e2f8ac85420e54b4da707f
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
2025-05-29 10:57:46 +00:00
Mate Barany cde7e1a059 Add tests to QQmlTreeModel::clear
Clear should erase all the rows but the column data should remain
unchanged.

Task-number: QTBUG-130571
Change-Id: I436538173f14bfa4c3315483176a3ebcb8322317
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-05-29 08:19:25 +02:00
Mate Barany 7bdcb4a89e Add test cases for QQmlTreeModel::getRow
Test for both valid and invalid indices.

Task-number: QTBUG-130571
Change-Id: Id79e7877c0d59cd75bace57c95efa16f2da7b605
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-05-29 08:19:20 +02:00