Commit Graph

13102 Commits

Author SHA1 Message Date
Petri Virkkunen 9fd9e881b2 QQ4A: Allow QML functions to be called from Java
This commit adds an API to QtQuickView and QtQuickViewContent which
allows users to call QML functions, with the following limitations:
     * The function parameters must have type information
     * The function parameters must be supported types: real, double, int,
     boolean or string.
     * The function cannot return a value

In the case of functions in QtQuickViewContent descendant classes,
these limitations are enforced by the code generation in
androiddeployqt.

To continue the journey of a function call from Java to QML, this
commit provides a JNI function which takes the view memory address,
the function name and a list of parameters, which may be empty.

When called, the JNI functions will look for a function with the given
name and parameter count, and if found, will convert the data from JNI
types into the expected QML types.

After converting the data, the data and QMetaMethod are passed to
QMetaMethodInvoker::invokeImpl which actually invokes the QML function.

Task-number: QTBUG-137112
Change-Id: I6617e3f5e1ebfcec7e44887d4e01b5137245ac0d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-09-01 20:25:21 +03:00
Frédéric Lefebvre d14031a8a9 Stabilize tst_QQuickTextEdit::inFlickableTouch on openSuSE 15.6
tst_QQuickTextEdit::inFlickableTouch is flaky due to the view being
repositioned after initialization, which shifts the window downwards.
This new position causes the flick gesture to fail.

Unblacklist tst_QQuickTextEdit::inFlickableTouch on openSuSE 15.6

Fixes: QTBUG-118066
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0d85d756594aa1976fff1f06f21b54a909474150
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-09-01 13:32:51 +00:00
Ulf Hermann cca07aa788 QmlCompiler: Fix access to optional QVariantMap
Without this, it tries to resolve the metaObject of QVariantMap, which
crashes.

Fixes: QTBUG-139626
Pick-to: 6.10 6.9 6.8
Change-Id: I9248f57c428810024f9983df959f475e6557576c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-09-01 14:11:57 +02:00
Mitch Curtis d8d55cd69a tst_qquickanimatedimage::playingAndPausedChanges: bump timeout to 2 seconds
e7b90cfc31 changed the default to 1
second, which results in a failure:

FAIL!  : tst_qquickanimatedimage::playingAndPausedChanges() QTestLib: This test case check ("!obj->isPlaying()") failed because the requested timeout (1000 ms) was too short, 1050 ms would have been sufficient this time.

Bump it to 2 seconds.

Task-number: QTBUG-138662
Change-Id: I3ccbc5c6a13ac45752b252263e925ceb9edc6a5c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-31 15:41:49 +08:00
Mitch Curtis 0781477d51 tst_TouchMouse::pinchOnFlickable: bump defaultTryTimeout to 2 seconds
e7b90cfc31 changed the default to 1
second, which results in a failure:

FAIL!  : tst_TouchMouse::pinchOnFlickable() QTestLib: This test case check ("(flickable->isFlicking()) == (false)") failed because the requested timeout (1000 ms) was too short, 1200 ms would have been sufficient this time.

Bump it to 2 seconds.

Task-number: QTBUG-138662
Change-Id: I3e9b0e600bac879c506d23255e8587197e171d21
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-31 15:41:45 +08:00
Oliver Eftevaag 54f9f6818f Fusion File&FolderDialog: Give the FolderBreadcrumbBar a maximum width
The fusion styled File and FolderDialog's FolderBreadcrumbBar would grow
in width as the number of nested directories in the currentFolder path
would grow. The other styles would give it a maximum size, which would
limit how much it could grow, but not the fusion style.

The FolderBreadcrumbBar's width also affects the entire FileDialog
default (implicit) width, which would cause the entire dialog to expand
as you'd enter more directores. This was unintuitive, and not something
that any other file dialogs do.

Let's make the fusion style FileDialog behave like the other
FileDialogs.

Pick-to: 6.10
Change-Id: Icd67803b6e205ac9224b2561417667b4893a4e87
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-30 03:20:04 +02:00
Santhosh Kumar d3936e5e93 Fix flaky warning message in tst_qquickmenu::loadMenuAsynchronously
The test case tst_qquickmenu::loadMenuAsynchronously is getting flaky,
w.r.t warning message, sometimes depending on the platform, and so it's
required to extend the regex to consider that case.

Amends patch: 28553473cf

Task-number: QTBUG-139552
Change-Id: I4766c7ac52a586dcf5b470ce5a676a51e2503cb5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-29 19:01:51 +02:00
Mitch Curtis 89bdaa7fdc Blacklist tst_QQuickPopup::fadeDimmer on macOS
It's causing a lot of flaky failures, so blacklist it until it can be
fixed.

Task-number: QTBUG-131695
Change-Id: I81835fe1af677899abcc26534c5fd95dc69004cb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-29 04:00:16 +08:00
Assam Boudjelthia c4766f26e8 Android: adapt tst_QQuickApplicationWindow to safe area margins
The test was still not account for safe margins in few places,
it seems it didn't account for the fact that Android apps will
have the margins set from the start.

Fixes: QTBUG-139583
Pick-to: 6.9 6.10
Change-Id: Ia04a0ca2e7ad96a1e72a0d7fe9416634fb24e116
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-08-28 22:59:56 +03:00
Alexey Edelev e00a8c3920 Use updated _qt_internal_android_get_target_deployment_dir exclusively
_qt_internal_android_get_target_deployment_dir no considers
QT_USE_ANDROID_MODERN_BUNDLE and produces correct target deployment
path even if the flag is disabled. In this case path matches to
the top-level Android target build directory.

Change-Id: Ia5817bf02dc7a8844fb8671d1945f1592af6b675
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-27 21:11:33 +02:00
Santhosh Kumar 28553473cf Skip warning from the loader for the test case loadMenuAsynchronously
The test case added as part of patch
36216db956 shows up warning
"There are still \"n\" items in the process of being created at engine
in destruction.\". This patch allow this test case to pass if fail
on warning enabled for the quick menu auto test.

Task-number: QTBUG-137160
Task-number: QTBUG-139552
Change-Id: I7f31ffd096cc10b514542092a85f346e413b40dd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-27 20:04:16 +02:00
Oliver Eftevaag da777a75f6 Run tst_qquickfiledialogimpl tests for multiple dialog styles
We were only testing the non-native file dialog under the Basic style
previously, but we have 4 other styles (Fusion, Imagine, Material,
Universal) that were never tested.

This unfortunately caused recent regressions in both the FileDialog and
FolderDialog.

By running each test once for more styles, we should be better
protected against future regressions in individual styles.

In this patch, we enable all tests for Basic, Fusion, Material and
Universal. The Imagine style is intentionally omitted due to a bug,
which causes the tst_qquickfiledialogimpl::defaults() test to fail.

This will be fixed later.

Change-Id: I9b4ab722c5ad3052122024ad3a7a2f0a99de77e6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-27 12:20:03 +02:00
Mitch Curtis 8d1a8c1833 QQuickPopup: unparent popupItem when window is set to null
Interacting with Popups in async Loaders caused a crash because the
popup's window was null:

1  QScopedPointer<QObjectData, QScopedPointerDeleter<QObje qscopedpointer.h           112  0x7fffe8effafe
2  qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointe qtclasshelpermacros.h      137  0x7fffe8efd9c3
3  QQuickOverlay::d_func                                   qquickoverlay_p.h          76   0x7fffe8f729d4
4  QQuickOverlayPrivate::get                               qquickoverlay_p_p.h        37   0x7fffe8f8c392
5  QQuickPopup::overlayEvent                               qquickpopup.cpp            3214 0x7fffe8f879c2
6  QQuickOverlayPrivate::handleHoverEvent                  qquickoverlay.cpp          192  0x7fffe8f6ee88
7  QQuickOverlay::childMouseEventFilter                    qquickoverlay.cpp          478  0x7fffe8f701e4
8  QQuickDeliveryAgentPrivate::sendFilteredMouseEvent      qquickdeliveryagent.cpp    2897 0x7fffeb1bce04
9  QQuickDeliveryAgentPrivate::sendHoverEvent              qquickdeliveryagent.cpp    1090 0x7fffeb1b25af
10 QQuickDeliveryAgentPrivate::deliverHoverEventToItem     qquickdeliveryagent.cpp    1272 0x7fffeb1b2fd0
[...]

We can avoid this by unparenting the popupItem, which removes it from
stackingOrderPopups and hence excludes it from receiving events.

The fix causes a crash in QQuickDeliveryAgentPrivate::clearFocusInScope
after tst_QQuickPopup::closePolicy() finishes, because it tries to
access the now null window. Add checks for that.

Task-number: QTBUG-139306
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Id507e39497af3cacc832db4b23a2c27a0788dc74
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-27 12:45:40 +08:00
Volker Hilsheimer cf0d7ab281 QRangeModel test: only ignore message in debug builds
In release builds, we don't want to generate code that indicate wrong
usage of the model, so 313e271c730f18e9a1afc05f754b5cba86013783 in
qtbase made the emission of stderr messages conditional.

Pick-to: 6.10
Change-Id: I51f773943387f099b943d7b7980b6b2485e189bd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-27 01:29:24 +02:00
Assam Boudjelthia 683942a216 Android: blacklist failing tst_qquickpopup to pass submodule update
After the fadeDimmer() crash fix in QTBUG-139211, orientation test
case fails, for now just ignore it to pass the submodule update.

Task-number: QTBUG-139211
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I467529d55cd053e4930c4574cea77a36abc3ae81
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2025-08-26 17:34:31 +03:00
Xavier BESSON 26df7b0363 qmlformat: add 'single line empty objects' option
Fixes: QTCREATORBUG-33333
Change-Id: Ia7eca0392418ec9b5cd13de8f6b5e263f4f09e72
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2025-08-26 16:30:12 +02:00
Santhosh Kumar 36216db956 Reset sub-menu and content item during deletion in the quick menu
The sub-menu item within the menu can have invalid reference when
its created and destroyed through loader.

The loader uses the incubator to create the items asynchronously
(when configured asynchronous), when it becomes active and places
them on the object stack. These items are cleared when the loader
becomes inactive. In a case where we have the parent menu at the
root, the loader places the parent menu at the bottom of the stack,
and the sub-menu or any other child item within the menu is placed
on top of it during its creation, and the deletion of these items
happens from the top, which leads to the paren menu being deleted
last. These menu items containing the sub-menu reference have not
been reset when the sub-menus are deleted in this way, thus it can
lead to a crash as the parent menu refers to an invalid item while
resetting its state. The same happens for the contentItem within
the menu.

This patch ensures that the content item and sub-menu within the
menu item are reset during deletion, which avoids the parent menu
referring an invalid item.

Fixes: QTBUG-137160
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia9688db90d6a8c8f4e4fa2aadb7e90cb3d8ea25b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-08-25 17:48:30 +02:00
Matthias Rauter edafe62cb3 Qml[Table|Tree]Model: Move validateRow to QAbstractColumnModel
This is the 10th patch in an attempt to make them more similar and
eventually merge common parts in a common abstract class.

Task-number: QTBUG-138703
Pick-to: 6.10
Change-Id: Ibd7fcfe93deee0283a04efb2f48a3e08c2b26286
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-08-25 14:22:32 +02:00
Fabian Kosmale 8721ff9e83 qmllint: Do not warn about QQmlPropertyMap access
A QQmlPropertyMap can store anything, and we can't know what is
available. Treat it like QVariantMap as far as qmllint is concerned.

Task-number: QTBUG-139240
Pick-to: 6.10
Change-Id: I9ebc0a963159cfc930ff14300df50b6fab5b7035
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-25 09:53:26 +02:00
Ulf Hermann 0d67aad01c QtQml: Return QVariant{Map|Hash} as-is when converting QJSValue
If we know that the object contained in a QJSValue was created from a
QVariantMap or QVariantHash, it makes no sense to hide that by producing
the JavaScript representation of it. The user is calling toVariant() to
obtain a usable QVariant after all.

[ChangeLog][QtQml][Important Behavior Changes] QJSValue::toVariant() now
returns a QVariantMap or QVariantHash for JavaScript objects created
from a QVariantMap or QVariantHash, even if you tell it to
RetainJSObjects via the "behavior" argument. There is no conversion in
this case, after all.

Change-Id: I482cd1d2db310048de066aad33efbbe9c3f9e56a
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-22 16:32:03 +02:00
Sami Shalayel 514337c013 qmllint: disable unqualified warning on user context property call
Amends 6575b0e835 that forgot to disable
unqualified warnings on context property calls `myContext()`. Rename
warnAboutContextPropertyUsage() into
handleUnqualifiedAccessAndContextProperties() and make it handle
unqualified access warnings when needed.

Fixes: QTBUG-138061
Change-Id: I2fe3ab2a9c2ed1329589ce67a03c1f905542793e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-22 14:06:47 +00:00
Sami Shalayel 6e29d65f0b qmlcontextpropertydump: add tool for context property search
Add a tool that runs the heuristic for context properties and dumps the
.ini generated by the heuristic search, for future calls of qmllint.

Add a test.

Task-number: QTBUG-128232
Change-Id: I5d03db45f41ef90c6f5d931837aaa466abc33303
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-22 08:12:40 +02:00
Ulf Hermann 2547e8be4d QtQml: Store detached VariantAssociation objects on the JS heap
While the VariantAssociation is detached it is subject to the GC or
unrelated C++ code deleting objects from its internals. Since it's then
not the owning object's responsibility to track this anymore, we need to
track it ourselves. The way to do it is to use the existing V4 objects.

Pick-to: 6.10 6.9
Task-number: QTBUG-139025
Change-Id: Ic1d5aa85171b5d91c2b9d546963268b6f09c2802
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-08-21 20:33:23 +02:00
Frédéric Lefebvre e0b9c581b8 Remove request for activation tst_focus::policy to fix flakiness
tst_focus::policy is flaky on openSuSE 15.6 due to a redundant call of
requestActivate.

Remove requestActivate as it is already ensure that the window is active
before moving forward.

Unblacklist tst_focus::policy on openSuSE-leap

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-78261
Change-Id: If56d23d8d79aeecd203fe8cf51de031b80d3923a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-21 11:30:58 +00:00
Sami Shalayel 63f43d3190 qmllint: load .contextPropertyDump.ini from build folder
Make QQmlJSLinter read heuristic context properties
(.contextPropertyDump.ini) files from the build
directory, by searching them with QQmlToolingSettings::Searcher.

Add a test that writes a .qrc file such that qmllint can find the
"build" folder that contains the .contextPropertyDump.ini, and make sure
that QQmlJSLinter warns about at least one context property.

Task-number: QTBUG-128232
Change-Id: I52569acc38d2fcda5015fe38ef84967353dbc21d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-21 12:57:17 +02:00
Sami Shalayel acb23d2609 qmlcontextpropertydump: add extra feature flag to disable/enable
Introduce a new feature flag to disable the qmlcontextpropertydump tool
(that will be introduced in a later commit).

Task-number: QTBUG-128232
Change-Id: I68436f1007ec40c6b3c8e1059319156251ecdef4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-21 12:57:10 +02:00
Sami Shalayel de090f60a1 heuristic context properties: write and load to/from disk
Add methods to write and load context properties on disk. Use the .ini
format to provide human readable files and to be able to reuse
QQmlToolingSettings for finding the setting file.

Implement a simple (de)serialization of SourceLocations for the .ini
files, and use QSetting to dump/read the lists of properties.

Add a test to see if the (de)serialization works. Add equality operators
where required for the test's Q_COMPARE().

Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: I23bd2db0aacad3d395c2909efb209277f7f1d4bd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-21 12:57:06 +02:00
Frédéric Lefebvre 6077e7103f Remove request for activation tst_QQuickTextInput::mouseSelectionMode
tst_QQuickTextInput::mouseSelectionMode is flaky on openSuSE 15.6 due
to a redundant call of the requestActivate.

Remove that call as we are already waiting to ensure that it is
active.

Unblacklist tst_QQuickTextInput mouseSelectionMode on openSuSE.

Fixes: QTBUG-78162
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Id3731b3823ef64d7e4cfe4212f17829cc1828a4e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-08-20 18:47:56 +00:00
Eskil Abrahamsen Blomfeldt 14cc78f986 tests: Support looping in vector image manual test
This adds an option to run animations in a loop.

Pick-to: 6.10
Change-Id: Ie6324ddb47c86c66e3089e91e41aead85c00877e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-08-20 08:28:53 +02:00
Sami Shalayel 7ea3235f5c qmlls: find C++ & QML definitions of enum
Implement go to definition for enums (values and keys) defined from C++ or QML.

This allows user to jump to their own C++ files, and does not jump to
headers outside the project folder, like private/qquickitem_p.h for
example, as it might get confusing for the user to open a file in the
editor that they are not supposed to edit.

Task-number: QTBUG-128393
Change-Id: I0410ecf4cf810e6c6072038bffc4564eb787c7fc
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:04:39 +02:00
Sami Shalayel 7e4b5d75e6 qmlls: find C++ definitions of grouped properties
Implement go to definition for grouped properties.
Jump to the C++ file at the correct line when searching for grouped
properties from QML.

This allows user to jump to their own C++ files, and does not jump to
headers outside the project folder, like private/qquickitem_p.h for
example, as it might get confusing for the user to open a file in the
editor that they are not supposed to edit.

Task-number: QTBUG-128393
Change-Id: I190a71b51b618e4050c9542f987d67e9b835a59f
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:04:31 +02:00
Sami Shalayel b317b64f24 qmlls: find C++ definitions of attached types
Implement go to definition for attached types defined in C++.
Jump to the C++ file at the correct line when searching for attached
types or their methods and properties from QML.

Support both cases of attached types:
Attached types in the binding target property or in the binding itself.

This allows user to jump to their own C++ files, and does not jump to
headers outside the project folder, like private/qquickitem_p.h for
example, as it might get confusing for the user to open a file in the
editor that they are not supposed to edit.

Task-number: QTBUG-128393
Change-Id: I4c40d7241227d2e5921c85ab7756782a37e5a0ad
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:04:23 +02:00
Sami Shalayel 937a213ee6 qmlls: find C++ definitions of methods
Implement go to definition for methods (signals, slots, invokables)
defined in C++. Jump to the C++ file at the correct line when
searching for methods from QML.

This allows user to jump to their own C++ files, and does not jump to
headers outside the project folder, like private/qquickitem_p.h for
example, as it might get confusing for the user to open a file in the
editor that they are not supposed to edit.

Task-number: QTBUG-128393
Change-Id: I7dcd347dcc925fd8e85cc2188c63cfdeab318a96
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:04:18 +02:00
Sami Shalayel 0fa91beea7 qmlls: find C++ definitions of properties
Implement go to definition for properties of QML components defined in
C++. Jump to the C++ file at the correct line when searching for
properties ofQML Component types from QML.

This allows user to jump to their own C++ files, and does not jump to
headers outside the project folder, like private/qquickitem_p.h for
example, as it might get confusing for the user to open a file in the
editor that they are not supposed to edit.

Also log a warning when a C++ header was not found.

Task-number: QTBUG-128393
Change-Id: I9da962b671dfe1f9e29fb260655f4f37132c6815
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:04:12 +02:00
Sami Shalayel d6618114d0 qmlls: cleanup go to cpp component
Avoid triggering a warning, and use the same code paths when going
to the definition of singleton and non-singleton types.

Task-number: QTBUG-128393
Change-Id: I1376adf0423d239aab1f7cad01a35f2c5db53874
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:03:58 +02:00
Sami Shalayel 5e698fbf62 tst_qmlls_utils: remove invalid test for attached derived type
We want to warn about using attached derived types in QTBUG-138873, so
remove the test that was testing whether go to definition jumps to the
derived type MyApplicationWindow when querying for the
MyApplicationWindow.footer attached property of the ApplicationWindow
base type.
A later commit will make qmlls jump to the C++ definition of the
attached type, instead of the QML type.

Task-number: QTBUG-128393
Change-Id: Ieb96e94315fe8f053302aee3f44cd2437c81fbe0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-18 20:03:50 +02:00
Sami Shalayel 799926a771 qmllsutils: distinguish attached types in bindings
Attached types on the left hand side of a binding have a different
scopes than attached types on the right hand side of a binding.
Special case them in resolveExpressionType to allow to implement
go-to-definition on attached types correctly for both kind of scopes in
a later commit.

Task-number: QTBUG-128393
Change-Id: Id82f3572014c8c8310cc359c4ed0bbfb6465cf7c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-18 20:03:40 +02:00
Sami Shalayel a20a9e83d4 qmltyperegistrar: add line numbers to methods, properties and signals
Add line numbers to qmltyperegistrar's output now that MOC includes this
information in its output.

Task-number: QTBUG-119143
Task-number: QTBUG-128393
Change-Id: Id77ef37f1503bd17fa42a355770a1ffeb348b46e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-18 20:03:33 +02:00
Sami Shalayel 84026e7aae tst_qmlformat_cli: make sure qmlformat settings stay stable
Add a test to make sure that the keys stay stable, and don't get changed
in the future.

Change-Id: If5a4c06d4f821fd4f6269e61bbb89bd120e79243
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2025-08-18 14:57:03 +02:00
Sami Shalayel e9ab29c677 tst_qmlformat_cli: also test default values for semicolonrule
Add a test for the default value of the semicolon rule.

Change-Id: Id2e52bbc277707ef042675a4f91254a072a98c37
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2025-08-18 14:56:59 +02:00
Dominik Holland df8e4cdbcd Make sure to setup viewport and scissors also for RenderNodes
Pick-to: 6.8 6.9 6.10
Change-Id: Ie3da3ba0aab73ad61fa32593bcdd19ffcc714a02
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2025-08-18 09:47:16 +02:00
Olivier De Cannière 15e90d4638 Compiler: Detect calls on partially deleted objects and throw
Component.onDestruction can be used to execute some code as an object is
being destructed. The code may, however, reference objects that are no
longer in a valid state because they themselves have already been
destructed. We then throw an exeception.

Commit a741271dd5 introduced the init step
for calls in which the types of arguments are resolved. For object
methods, we need to check that the object is still valid or throw an
exception otherwise. This is made more complicated by the fact that, in
some cases, the destruction of the object happens in a somewhat chaotic
manner where, for instance, the object is still alive but its method and
property storage has already been deleted.

This inconsistent state is the cause of QTBUG-138516 and existing checks
for invalid objects were not sufficient and we crashed when trying to
use the function that we were unable to resolve. We can detect this
particular problem by checking whether the ddata of the object still has
its jsWrapper.

Amends a741271dd5

Fixes: QTBUG-138516
Pick-to: 6.10 6.9
Change-Id: Ifdd7708d73ea6012d1e07aebed257b3f538183c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-18 09:06:23 +02:00
Dilek Akcay 4434466383 SearchField: Fix baseline test failures
Fixes: QTBUG-139093
Pick-to: 6.10
Change-Id: I48fb06082ea7bf10795b715e3e42862a83df6c31
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-18 06:57:39 +00:00
Oliver Eftevaag 2f95385b89 FileDialog: Use SplitView to separate the sidebar from the content
Previously a RowLayout was being used. But I would argue that it's
better UI to use a SplitView instead.

Add the necessary overrides in QQuickSideBar, so that the SideBar
actually knows it's correct implicit size. This is needed in order for
the SplitView to work correctly.

We want the implicit width to be large enough to cover the delegate with
the most text, with a maximum width of half the available space in the
dialog.
As for the height, we want it to be tall enough to cover all the
standard paths + add favorite button, so that the feature of adding
directories to the favorite list is less cumbersome. The height of the
sidebar should be part of what determines the implicit height of the
dialog.

Pick-to: 6.10
Change-Id: If267d8197e82f8a91a059e31723c46fe95af3d41
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-16 04:29:03 +08:00
Semih Yavuz 66b7fca246 qmlformat: allow specifying an alternative location for settings
When requested, use the specified .qmlformat.ini file as the setttings
file. When --settings option is given through  commandline, do not
perform per-directory configuration lookup.

Adapt the test to accept the SearchOptions.

Fixes: QTBUG-107212
Change-Id: I6b4f2c4a4321f89ae6dabf89a866c53486c22cce
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-08-14 19:54:41 +02:00
Semih Yavuz e3891d7459 qmltoolings add --dry-run option for qmlformat and qmllint
Add reportConfigForFiles to generic tooling class. It will perform the
search for the given files. Use stdout to report. qmllint had already an
option --dry-run for printing the fixed codes, but we can still allow this to
use that option name.

For qmlls, report the path if verbose option is set.

Fixes: QTBUG-137874
Change-Id: I6bd43866073b3df832b6fd89d477bced869d74c0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-14 19:54:37 +02:00
Morteza Jamshidi 21ff1d42c0 Material Style: fix focusIn and focusOut animation issues
When a property potentially used in focusIn or focusOut animation is
changed, we need to reschedule the animation with the correct parameters.
properties like verticalPadding, leftPadding, controlHasText, ...
To fix the issue I simplified focus animation logic.

Fixes: QTBUG-138028
Change-Id: I115fb6fdd5676ae0282b5b4b5bd460ea3b28392a
Pick-to: 6.10 6.9 6.8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-14 11:06:22 +02:00
Vlad Zahorodnii 3bfc8ef2e9 QSGThreadedRenderLoop: Handle window hiding at polish step
A window can be hidden during the polish step. For example, an app may
hide its window if the geometry is not good enough. This can result in
the following render thread events if the QPA sends sync expose events:

 - WM_Obscure
 - WM_TryRelease
 - WM_RequestSync

The WM_RequestSync event comes from the WMSyncEvent.

With QtWayland, repainting a window after it has gotten unexposed can
lead to the compositor posting a protocol error. There is also matter of
keeping code predictable: if the QPA sends an unexpose event, it'd be
great if the app stops repainting.

Pick-to: 6.10
Change-Id: I1d477436d6f79156aca44960c47a84f2e12ca4d2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2025-08-14 12:06:22 +03:00
Sami Shalayel 2f58813bc4 tst_qmlformat_cli: remove hand-written keys
Remove the hand-written keys from the test and use the static strings
instead. One of the previous hand-written key had a typo. Also make sure
that the settings are really set, as QVariant::toBool() returns false
for a unset settings, for example in the case of the key with the typo.

Change-Id: I15da10409fbf374a475dc3930844fd56120f370a
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2025-08-14 07:40:25 +02:00
Even Oscar Andersen 3dfc57cfed wasm: a11y - Send ObjectDestroyed event from quickitem destructor
Also, turn QQuickAccessible items to invalid() once the
QuickItem destructor starts.

Change-Id: I8b6bc7d69ffaeb01eb453e75de2847efb869cbf2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-08-14 07:05:17 +02:00
Shawn Rutledge 4a88ed0883 DeliveryAgent: stop sending hovering mouse moves to grabber
For applications running under Qt Wayland compositors, touch events may
be accompanied by fake mouse moves coming from the touchscreen device.
That might or might not be useful: but since most of Qt Quick ignores
such stray mouse moves, and PinchHandler was getting deactivated by
them, we now make an effort to avoid delivering them to PinchHandler
after it has become the exclusive grabber of those touchpoints (which
looks the same as being the grabber of "that" mouse).

Added a reminder to the handlePointerEvent() comment that tablet events
are different: hover events are not enough, in fact we need to deliver
TabletMove events to HoverHandler so that it has a chance to change the
cursor (i.e. keep the tst_HoverHandler::deviceCursor test working).

Pick-to: 6.8 6.9 6.10
Fixes: QTBUG-123985
Change-Id: I513caf277e2fb87401b3e0bb5547f9623467b423
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-08-13 19:42:10 +02:00
Santhosh Kumar 0d1730681d Skip reordering content model if items aren't reparented to item view
The container reorders the content model items after component
completion. The content model can be assigned as a model to the item
views to visualise through a container content item. The content item
can have item views anywhere in the object hierarchy. If the item
views are somewhere down in the line and not at the top, there is
a chance during component completion that some of the items are
reparented to the item views, and others are with the container
content item itself. Thus, reordering at this stage (having partial
items) can lead to changing the order of elements within the content
model, which further causes repositioning of items within the item
views.

This patch resolves this issue by skipping reordering the content
model, if any of the items are not reparented to the item views.

Fixes: QTBUG-138490
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I1673e600774e2821653542c003d2d573f62d024d
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-13 07:08:06 +02:00
Tim Blechmann 94f1f5e27e manual tests: compile fix for namespaced qt
QT_USE_NAMESPACE was missing, so they didn't compile with namespaced qt.

Pick-to: 6.10
Change-Id: Ic4b1126cfab7780c714a737e81f0947664bade02
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-13 09:25:59 +08:00
Frédéric Lefebvre 579f8268fa Unblacklist tst_QQuickPopup::closePolicy and cursorShape on openSuSE
tst_QQuickPopup::closePolicy and cursorShape are no longer flaky on
openSuSE 15.6.

Unblacklist both tests.

Fixes: QTBUG-94251
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic27016893b91fb38c8869c4e357be7b1b88dc45a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-08-12 07:58:02 +00:00
Mitch Curtis 3dd92bffe0 qmlscenegrabber: account for errors when loading QML
Both QQmlComponent's constructor (the "compile" phase) and create()
(the "create" phase) can produce errors, according to
https://doc.qt.io/qt-6/qqmlcomponent.html#errors.

This fixes a crash caused by an error in the QML, which the tool would
then silently ignore and try to access nullptr items.

Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I2ba6301f8f1f5cd4d804eba290606cf48b584ddb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-08-12 08:23:50 +08:00
Oliver Eftevaag 74120635f8 FileDialog: Fix binding loops for Fusion, Material and Universal styles
These binding loops were introduced in
0e4d470d3d, since the nested
overwriteConfirmationDialog's width were still determined by the contentItem,
but the contentItem's width depended on the overwriteConfirmationDialog's
width.

This resulted in a binding loop, which could be fixed by giving the
overwriteConfirmationDialog an explicit width.

Pick-to: 6.10
Change-Id: I3bb2957fd31710b093eb7f7e887df8f045809921
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-08-11 20:26:45 +02:00
Olivier De Cannière 1392a245a0 QtQml: Deduplicate enum handling in QtObject and clean up API
QJSValue is slow and can be avoided. Use more specific types.

Also, switch to an exception based error handling instead of
returning undefined.

Amends 5e312953f6, found in API review

Pick-to: 6.10
Change-Id: Ie7c304a0dd76c8096e7c1f9b7cc3cfe7471649da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-11 17:25:40 +02:00
Fabian Kosmale 583d16c107 QQmlJSTypeResolve: Support T -> QmlListProperty<T> conversion
The engine handles this just fine, and we had examples (and probably
documentation) shownig this pattern.
If we want to warn about it, it should have a dedicated warning.

Pick-to: 6.10
Change-Id: I105f4a49ecfc6fbd5f00c683e0dbef7d34a64a1d
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-10 16:32:05 +02:00
Volker Hilsheimer aeaa7ae43e Add QML test for QRangeModel
We want QRangeModel to be the preferred mechanism for exposing C++ data
to QML. Ideally, it will also be a replacement for using QVariantList or
QObjectList, without the "quirks" of exposing a value type holding
references, modelData vs named roles, no write-back etc.

To make sure that the respective usage patterns don't break, add a test
for QVariantList and QObjectList, and corresponding tests that use
QRangeModel with equivalent data structures.

The test shows some unexpected and excessive calls to both data() and
setData() implementations of QRangeModel, which are QEXPECT_FAIL'ed for
now. Unrelated to this test of QRangeModel, so leaving that for a future
commit.

Pick-to: 6.10
Change-Id: I870c78d845de507dafd27f6999154a1a7ea92a1b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-08 20:49:36 +02:00
Masoud Jami 142b267ed1 qmllint: allow mixing ID based with text based translation
Since 6.10 Qt i18n component allows mixing id based with text
based translation and this is reflected in lrelease, lupdate,
and documentation.
This patch is a partial revert of
8b61addfa4 and removes the
qmllint warning in the case of mixing these two.

Pick-to: 6.10
Change-Id: Iae2407da2bc5cc21fc3664051834c99b8c72fe58
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-08-08 15:25:57 +02:00
Alexandru Croitor db1a9e1ac5 CMake: Use qt_internal_add_RunCMake_test
Use qt_internal_add_RunCMake_test instead of add_RunCMake_test to
ensure Qt specific behaviors are applied.

Pick-to: 6.8 6.9 6.10
Change-Id: Ia751f66cd4cd76e76ea0bb5e31f4b8372b2ca22a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2025-08-08 15:25:57 +02:00
Petri Virkkunen 6ea7f00109 QQ4A: Add tests for early signal listeners
This commit adds some tests for QtQuickView and QtQuickViewContent
signal listeners that are registered before the QML is loaded.

Task-number: QTBUG-137057
Change-Id: Id10420186399cb49d63f281ae195eeacf325250d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-08 16:25:56 +03:00
Petri Virkkunen 662869fdfe QQ4A: Add QtSignalQueue class to manage queued signal connections
This class will be used in both QtQuickView and QtQuickViewContent, to
keep track of queued signal connections and eventually process them,
connecting them to the QML view.

This class also introduces an internal class to represent the data
required to make a successful signal connection, to assist with storing
the data.

Task-number: QTBUG-137057
Change-Id: I798dbf0c0b377f2bf07874b17b83d493aa4905d9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-08 16:25:56 +03:00
Sami Shalayel 012f554473 tst_qmlls_utils: fix singleton in test
The singleton is in the wrong folder, and is missing a qmldir entry to
be valid.

Change-Id: I7d9d12681d025f6ca257cc1cfbcfb02fc977721d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-08 15:25:56 +02:00
Tim Blechmann c11d9459d8 Harden namespacing
When using namespaced Qt, we need to prevent symbol clashes with symbols
of the same name.

* namespace some publicly visible classes
* hide classes in implementation in an anonymous namespace
* rename read/write to readValue/writeValue to avoid name clash with c
functions.

Task-number: QTBUG-138543
Pick-to: 6.10
Change-Id: Ica77462c1f81f1e01cc60477e5b56ecfe3c1abb4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-08 21:25:55 +08:00
Mitch Curtis 1e96e77858 tst_qquickanimations: bump defaultTryTimeout to 2 seconds
e7b90cfc31 changed the default to 1
second, which results in confusing failures where 1 second is not
enough... but it also was (QTBUG-139036). Many animations are 1 second
long, so bump the default timeout to 2 seconds.

Task-number: QTBUG-138662
Change-Id: I9b38e6cdbecda17cc2be65e93be4bdc7b8b0a529
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-08 16:46:38 +08:00
Dheerendra Purohit 1224a1c89f Improve error message for invalid import qualifier
Previously, the error message for an invalid import qualifier did not show the qualifier name or explain what was wrong.

This change adds the qualifier name to the message and says it must start with an uppercase letter.

Pick-to: 6.10
Fixes: QTBUG-133313
Change-Id: I0bd4bb143f7b4cdc3b26cae73ab42a4fb05977b1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-08 08:29:09 +00:00
Eirik Aavitsland cc161f0d35 Curve renderer: Fix filling of certain paths with degenerate parts
Determining the fill side of a segment would fail if the path
contained an overlapping segment in the opposite direction. If a
subpath started with such a segment, the resulting fill could be
incorrect. Fix by iterating over the subpath for a segment with a
determinable fill side.

Fixes: QTBUG-133247
Pick-to: 6.10 6.9 6.8
Change-Id: I07c4f884d525b19af93609bcb31b412d340bebd5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2025-08-08 08:56:08 +02:00
Mitch Curtis 4e64a9889a Make qmlscenegrabber manual test directly openable in Creator
This avoids the need to run qt-cmake-standalone-test and then import
the test, as described in QTCREATORBUG-25389.

Task-number: QTBUG-93020
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: Idafddadfa91f5de9503983a22089fa6d8408ca4d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-08-08 14:52:21 +08:00
Mitch Curtis 202fef1694 Fix qt.qpa.menus warning in tst_qquickmenu
The warning was:

QWARN: tst_QQuickMenu::FluentWinUI3::nativeStatic() qt.qpa.menus: QPlatformMenuItem(0x60c0001c5040) does not belong to <QCocoaNSMenu: 0x6070000884a0>
        Title:
        Supermenu: 0x0 (None), autoenable: YES
        Previous menu: 0x0 (None)
        Next menu: 0x0 (None)
        Items:     (
    )

In nativeStatic.qml, we have an item tree that looks like this:

    Menu {
        Action { /* ... */ }

        MenuItem {
            action: Action { /* ... */ }
        }

        Menu {
            Action { /* ... */ }
        }
    }

Removing the first two menu items of the top-level menu works. When we
get to the menu item for subMenu, we see that it has a Menu of its own,
and so we call recursivelyDestroyNativeSubMenus. That removes all of
the menu's native items, and at the end it does this:

    menuPrivate->resetNativeData();

Here, menuPrivate refers to subMenu's private object. This line severs
the connection between subMenu and menu, which leads to the warning. We
then return from recursivelyDestroyNativeSubMenus and end up here in
QQuickMenuPrivate::removeNativeItem:

    if (nativeItem->handle()) {
        handle->removeMenuItem(nativeItem->handle());
        syncWithNativeMenu();
    }

The removeMenuItem call then triggers the warning.

To fix this, we need to have control over when resetNativeData is
called, so that we can do it after the removeMenuItem call. Do so by
rewriting removeNativeItem to be recursive, and using it in favour of
recursivelyDestroyNativeSubMenus, which we then remove.

Improve internal docs while we're at it.

Pick-to: 6.8 6.9 6.10
Change-Id: I4955a5e4d8e5aa5c9d46873b8b3a27f65446ea35
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-08-08 14:33:27 +08:00
Sami Shalayel 12f783da0d Remove unused qualifiedName.qml file
Amends 9bc8445766 that forgot to remove
the .qml file from the test.

Task-number: QTBUG-138896
Change-Id: I85d2d1ce97ef38219e9820aa6308f57bbb40d2c1
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-07 14:47:06 +02:00
Sami Shalayel cdce16efd9 tst_qmlls_qqmlcodemodel: remove unused file
Amends 13761ee3c7 that added FileB.qml but
never used it.

Task-number: QTBUG-138896
Change-Id: Id83634bbea3f5fb1184ffe8e4cef9e08c5d8627a
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-07 14:47:06 +02:00
Sami Shalayel a4039aa206 tst_qmlformat: run on commentInEnum and commentInQmlObject.qml files
Amends ff6d16d58b that added the files but
didn't use them.

Task-number: QTBUG-138896
Pick-to: 6.10 6.9 6.8
Change-Id: I1835e2a8db9e374628da7bb8e16c39d876dc9d91
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-07 14:47:06 +02:00
Frédéric Lefebvre b7ce1e5054 Remove tst_QQuickWindow::openglContextCreatedSignal from blacklist
There is no openglContextCreatedSignal in tst_QQuickWindow. Remove
legacy blacklist entry.

Change-Id: Ida5b5d3689030a19f50d5edd6817820c6a1716d3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-07 12:47:05 +00:00
Frédéric Lefebvre 9574ca27b0 Unblacklist tst_QQuickWidget::tabKey on openSuSE-leap
tst_QQuikWidget::tabKey is no longer flaky on openSuSE-leap. Remove the
blacklisting on openSuSE 42.3 as no longer supported.

Change-Id: I99e8abb043c63524ba7b3359e85ef90e11678e3e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-08-07 14:47:05 +02:00
Mitch Curtis e7b90cfc31 QQmlDataTest: drop default try timeout from 5 seconds to 1
Make debugging of failing tests less painful.

The tests that had to be changed as a result are listed
in the comments of the linked task.

Fixes: QTBUG-138662
Task-number: QTBUG-81979
Change-Id: Iee50f2d4f2160e3e9bc2c7985925583fad810811
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-07 10:45:29 +08:00
Matthias Rauter 6ce91b03de Derive QmlTableModel from QAbstractItemModel
Previously QmlTableModel was derived from QAbstractTableModel. The
upsides of QAbstractTableModel are very limited but disable the
possibility to combine the similar aspects of QmlTableModel and
QmlTreeModel in a common class.

In QQuickHeaderView, QAbstractTableModel is treated in a special way.
In Order to keep all existing code working, we are treating
QmlTableModel the exact same way also after this change.

This is the 6th patch in an attempt to make QQmlTreeModel and
QQmlTableModel more similar and eventually merge common parts
in a common abstract class.

Task-number: QTBUG-138703
Pick-to: 6.10
Change-Id: Ifb1f12d147e659320bddccf6c183ac0308cfb99b
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-08-06 22:17:57 +02:00
Santhosh Kumar 14a79d7af8 Acknowlege touch event state within the popup as similar to mouse
The touch events ignored by the pop-up have not been updated with
the handled status, and this makes the delivery agent consider
the pop-up as the event grabber, which further blocks the touch
event from propagating.

This patch makes the pop-up to update the event with the touch
event handling status. Thus, even the ignored status has been
updated in the event, allowing the delivery agent to propagate
the events to other items.

Fixes: QTBUG-138478
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I2399aea70d58b6d427bf76f871a3fcc04c69a44f
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-08-05 20:53:20 +02:00
Sami Shalayel 7ded306d74 qmllint: make contextproperties a real class and rename
Prepares for QTBUG-138061 where we need a way to load user-defined
context properties into QQmlJS::ContextProperties.

Rename QQmlJS::ContextProperties into HeuristicContextProperties to
avoid confusions with the UserContextProperties.

Make HeuristicContextProperties a real class so that we can add methods
to load and save context properties to and from disk.

Make the heuristics be saved in a list instead of a QHash, as the order
of the property matters as we write them out into a file and testing
becomes complicated when the order changes between different runs. Also
note that it might be confusing for qmlls users if their warnings change
orders during multiple runs.

Rename some methods for clarity.

Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: Ib6302f609e182e622015293366c8b42425566a0e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-08-05 17:06:32 +02:00
Olivier De Cannière 07600c2b48 Compiler: Skip type propagation for functions returning ScriptString
We cannot know in what context the binding will be executed.

Task-number: QTBUG-138188
Pick-to: 6.10 6.9 6.8
Change-Id: I018e931cc43cdaea052cfad41d45018fcd1193fa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2025-08-05 17:06:32 +02:00
Mitch Curtis e7964362a5 Fix unused code in tests/auto/quickcontrols
The following lists detail the unused code and the commits that added them.

Added in d5cb26bc56 and
d923dd467c, but missed by the revert done
in d3545dbdfdb30e310c6c962ba92f4fdf57354666:
- tests/auto/quickcontrols/qquickmenu/delegateFromSeparateComponent.qml
- tests/auto/quickcontrols/qquickmenubar/delegateFromSeparateComponent.qml

450fa684f7 added the same QML file to two
different tests, but only used it in one of them:
- Includes in tst_sanity.cpp.
- tests/auto/quickcontrols/sanity/data/attachedTypeResolution.qml.

6675a612540695db5c321f49e06ebfcba297e144:
- Added root.qml but didn't use it.
- Added svgSourceBindingSourceSize.qml but accidentally used
alignment.qml instead.

Task-number: QTBUG-138896
Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I0f861030bd354220b76b0f024d24ef1e1c8f2567
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-08-05 23:06:31 +08:00
Ulf Hermann 527e108c9f qmltc: Don't crash on missing type information
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136355
Change-Id: I0cf56674b451187a3483f4dfefbf6e1ccb275d04
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-08-05 17:06:31 +02:00
Ulf Hermann d5bab6381e QtQml: Allow eval() in global context
We don't have to crash if we can't determine a function to query for
strictness or if there is no explicit "this" object.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-136688
Change-Id: I541f2d906e10a7512d8364a9286885bd6afa4423
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-08-05 15:06:31 +00:00
Fabian Kosmale 0b9a554ede QQmlJSLogger: Don't trigger assert in QColorOutput
As a comment already points out, having an empty replacement message is
possible. In that case, we shouldn't attempt to print it.

Add a dedicated test-setup for QQmlJSLogger, to make it easier to expand
tests there.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138871
Change-Id: I55c5de140fe8175e9deaca519bb734654dc366f4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-08-05 17:06:31 +02:00
Mitch Curtis 48459e18ab tst_qquickmenu: fix another "cannot show menu: parent is null" warning
The test shows it after the menu gets a window anyway, so we don't need
to try to make it immediately visible.

Same fix as 1025a40812.

Amends d0a83e3330.

Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I7cfd59ae88b3ce4ab9b4ec780838d7cdc476091d
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-08-04 15:34:54 +08:00
Petri Virkkunen 21543ca52d QQ4A: Reduce amount of spam calls in tst_signallistener
To avoid filling the JNI global reference table limit on the CI,
reduce the amount of signals emitted during the tst_signallistener
spam call testcases.

Fixes: QTBUG-138104
Change-Id: Iaeefcbef6447586578f2cf2cc8dbfcb7f4536818
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-08-01 09:02:12 +03:00
Mitch Curtis 1025a40812 tst_qquickmenu: fix "cannot show menu: parent is null" warning
The test shows it after the menu gets a window anyway, so we don't need
to try to make it immediately visible.

Amends 19637c2241.

Pick-to: 6.5 6.8 6.9 6.10
Change-Id: I779287ae499ef26196c26e5d44d277e9a6223610
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2025-08-01 10:50:50 +08:00
Sami Shalayel 6575b0e835 qmllint: Introduce UserContextProperties
Allow the user to specify context property names in .contextProperties.ini
files so that they can disable all warnings or only the unqualified warning
on their defined context properties by name.

I remember some use cases where checking the .qmllint.ini into a users
project repository is unwanted, so use a new setting file for the
context properties that does not mess with global/system-wide
.qmllint.ini files when checked into the repository.

Create a new class called UserContextPropertiesSettings that is in charge of
loading user context properties setting files, and use it inside of
QQmlJSLinter.

Introduce a ContextPropertyInfo class that contains both the heuristic
information and the user-provided information. ContextPropertyInfo is
used to pass the ContextProperty information down the type propagator.

Also add some documentation for the new settings file.

Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: Icd700154dc89219f115fa3187c037d65451d0059
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-31 18:29:53 +02:00
Tian Shilin 57d67a2918 Fix typo: rename occured to occurred
The function name had a spelling error. This change improves code
readability and follows Qt naming conventions.

Change-Id: Ic0646ea679bf3619691b6a581ba5ef589e7827bd
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-07-31 20:43:44 +08:00
Semih Yavuz 527631109d tst_qqmlpreview: remove dead code
This code was meant to add environment variable to a process before
starting it. However, the "executable" argument refers to the path of the qml tool binary itself, not the path to a qml file. Therefore, comparing it against the QML file path is incorrect and redundant. Instead, extend the function signature of the method where process is started.

Amends 64cd070c8c.

Change-Id: I6d5e40750fa9f483a6e21ede27980a0abd872d37
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2025-07-31 09:13:41 +00:00
Fabian Kosmale b114eedf82 qmllint: Do not warn about BINDABLE only properties (just now)
While there is a goal to phase out BINDABLE only properties in QML, and
require NOTIFY (if they participate in a binding), we are not there yet.

Given that this is not documented outside of wiki.qt.io, and we still
had Qt internal properties without NOTIFY (but with BINDABLE), we
shouldn't warn about it right now.

In the future, we should provide a more specific warning; which then can
also add more details about the integration of signals with QProperty.

Pick-to: 6.10
Change-Id: I5070c47124787938ef3ba5143a02574663de1cf6
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-30 18:43:01 +02:00
Fabian Kosmale 754d3c6773 QtObject: Give uiLanguage a signal in addition to BINDABLE
The consensus at contributor summit [1] was that we want to phase out
the BINDABLE integration over time. That means that we shouldn't have
properties which are BINDABLE but non-NOTIFY-able in Qt itself exposed
to QML. Adjust QtObject::uiLanguage accordingly.

No revision marker is needed as the global Qt object only exists as a
singleton (and is ina  private header).

[1] https://wiki.qt.io/QtCS25_-_QProperty_and_QBindable

Fixes: QTBUG-138749
Pick-to: 6.10
Change-Id: Ice54f844c87864a325e667d2536c39af821ce7b9
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-30 18:43:01 +02:00
Ivan Solovev cea8a1f8e1 Deprecate QQmlSslConfiguration::sslOptions property
The property has two major issues:
* it is out of sync with the underlying m_configuration
* it does not allow to disable an SSL option once it was enabled

Fixing the behavior is considered dangerous, because it affects the
default SSL options, and so potentially affects the application
security.

As a result, it was decided to deprecate this property and introduce
a new one instead of it.

Move the QML tests of the deprecated property into a separate TestCase
and enable it conditionally based on the value of
QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11) macro. This requires to use
QUICK_TEST_MAIN_WITH_SETUP() macro and introduce a custom Setup class
to pass the proper value from C++ to QML.

[ChangeLog][QQmlNetwork][Deprecation Notices] Deprecated the sslOptions
property of sslConfiguration/sslDtlsConfiguration. Use the new
sslOptionFlags property instead.

Fixes: QTBUG-137900
Change-Id: I7cd559e32475272fa77ae9dbf735d70371755725
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-30 14:21:56 +02:00
Ivan Solovev 78b23bda68 QQmlSslConfiguration: introduce sslOptionFlags property
It should replace the sslOptions property which is out-of-sync with
the underlying configuration and does not allow to reset an option
once it is set.

[ChangeLog][QQmlNetwork][sslConfiguration/sslDtlsConfiguration] Added
an sslOptionFlags property. Use it instead of the sslOptions property.

Task-number: QTBUG-137900
Change-Id: Ic2ce9059514742b597ea2d9a187fadcef1f4cc36
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-30 14:21:54 +02:00
Santhosh Kumar d542f1a60f Material Toolbar: Reflect background color with set custom primary color
In the quick material style, the primary color or any other colors
within its color system would be considered as custom if the set color
is outside the predefined enum colors or provided in other color
formats. These colors within the material color system can be set by the
user through options such as conf or env.

The material toolbar, by default, initialises the background color with
the primary color. Thus, it's expected implicitly that the background
color should reflect the primary color as set by the user. It's also to
be noted that this does not necessarily mean to consider background
color as custom (as it hasn't been explicitly overridden by the user).
This assumption of custom background color has been corrected as part
of patch 76d7080fbe. The controls (such
as Toolbar), when requesting the background color, validate whether it
has been explicitly set or not. If set, the same shall be provided;
otherwise, it can be colors from the predefined range or the default
color.

In this case, the background color would not be considered as
explicitly set (reflecting the primary color), and thus it falls back
to the default color as it's also not within the predefined range in
the material style. But it's valid to expect the primary color as set
by the user.

This patch resolves this issue by having additional validation with the
primary color properties when providing the background color.

Fixes: QTBUG-138602
Pick-to: 6.10 6.9
Change-Id: I1ef1d1b4cd59ec191d6b3cf2886640c52193248e
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
2025-07-30 14:08:29 +02:00
Alexandru Croitor 487585b12d CMake: Don't publicly propagate private Qt modules for public modules
This causes user projects to automatically find the private Qt module
packages and expose the Private targets and their headers, without the
user project explicitly opting into this, and without showing them a
warning.

Pick-to: 6.10
Task-number: QTBUG-138712
Change-Id: Ia50bb6d128fe018c71d976f91abdab75790b6142
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-07-29 19:23:25 +02:00
Sami Shalayel a42f047a42 qmllint: don't warn about fall-throughs where they don't happen
Iterate through the statements of the case-statements and don't warn
about a fall-through if the code path of the case-statements return or
break or throw before reaching the end of the case-block.

Amends 65804aaa92 that introduced the
warning and only didn't check recursively for break, return or throw
statements inside of case blocks.

Pick-to: 6.10
Fixes: QTBUG-138532
Change-Id: I545898ebd52a4ec8f0ea58ca4ab5519e7137b6b0
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Lars Schmertmann <SmallLars@t-online.de>
2025-07-29 10:21:33 +02:00
Matthias Rauter d91e9f23c9 Backport some changes from QmlTreeModel to QmlTableModel
QmlTreeModel was recently added and in practice it is an extension
to QmlTableModel. Many functions were initially copied from
QmlTableModel and then modified. Some changes are also applicable to the
QmlTableModel, e.g. the usage of auto, Latin1StringView, enums instead
of bools as well as some asserts and white spaces.

Also some names have been made consistent and whitespace was corrected.

This is the 2nd patch in an attempt to make QQmlTreeModel and
QQmlTableModel more similar and eventually merge common parts
in a common abstract class.

Task-number: QTBUG-138703
Pick-to: 6.10
Change-Id: Ic6ce7a5e1c644ab99bb998235fcd8a7087a124e4
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-29 06:51:11 +02:00
Fabian Kosmale 9ae8312c0d qmllint: Do not warn about unknown signal handlers in custom parsers
A custom parser can do arbitrary things with signal handlers inside it,
even if no corresponding signal exists in itself. For instance,
PropertyChanges allows to set signals on its target.

Task-number: QTBUG-138173
Pick-to: 6.10
Change-Id: I8b92cb92dad8d9a53cb57b4a9ad3d2d48b24c08a
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-28 19:35:51 +02:00
Mate Barany 705c71b5f6 Remove support of manipulation of complex rows in QQmlTableModel
TableModel supports complex row structures but only with a limited
functionality. Since the model does not know how a complex row is
structured, it cannot manipulate it. This also means that the copy of
the model data that is stored in rows is not kept in sync with the
source data that was set in QML - the user is supposed to handle
simple data manipulation.

This one functionality was not tested and it seems that the
implementation was changed in the background as setRows is now
called when rows is modified in QML.

A good example is in complex.qml. If we try to extend the
corresponding test case with a setData call it is going to call the
function assigned to setDisplay which calls setRows - something it
was not supposed to do. The checks in setRows do not recognize the
complex row structure and as such the call is not successful.

The checks could be adjusted to work for this specific case, but
the structure could be anything so that solution would not be
generic enough.

Remove the support of manipulation of complex row structures
from QQmlTableModel.

[ChangeLog][Qt labs QML Models] Removed the support of manipulation
of complex row structures from QQmlTableModel.

Task-number: QTBUG-138553
Pick-to: 6.10
Change-Id: I8664ae9ec2e5cd09bc2c88a25f4ac972378e8e94
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-07-28 13:53:24 +00:00