Commit Graph

34141 Commits

Author SHA1 Message Date
Petri Virkkunen 50aea1f6a3 Android: Add documentation for QtAbstractListModel example
This change includes code snippet markers, some minimal code changes
(moving code around for snippet clarity), a screenshot of the example
and the main documentation page for the example.

Task-number: QTBUG-126841
Pick-to: 6.8
Change-Id: I2a10571f37a70a55b8411f1b7989b47810639386
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-08-13 22:28:03 +03:00
Andreas Eliasson 7afacee589 Doc: Fix qdoc link warnings
Fixes the qdoc link warnings in
qtabstractitemmodel_in_android_studio_projects.qdoc

Pick-to: 6.8
Change-Id: I8466c50124ca7df7b8f2c6116a4444924a8d75b5
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-08-13 17:43:28 +02:00
Sami Shalayel c5da722515 qmltyperegistrar: test for missing Component in qmltypes
qmllint was wrongly complaining about missing types because
qmltyperegistrar was not including all required types in the qmltypes
files.
Add a regression test to make sure that we don't run into the problem
mentioned by Mario Emmenlauer in the linked task at QTBUG-118112.

Task-number: QTBUG-118112
Pick-to: 6.8
Change-Id: Id67e9f9927e94ad5aa900c7bf30e85fc977e3e45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-13 11:03:15 +00:00
Sami Shalayel b0fd8ef05e quicklint: disable controls-attached-property-reuse category by default
It seems that this category is just not ready to be enabled by default,
so disable it.

Tracking the work to re-enable it at QTBUG-127812.

Fix a test to enable the category before testing for the warning.

Pick-to: 6.8 6.7
Fixes: QTBUG-127650
Change-Id: I6144e4b55e3bea803b14d82f6f0d291676d4394e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-13 13:03:15 +02:00
Sami Shalayel 8a8bfb410a qmlls: do not endless loop on _deps build folder
Add a missing NoDotAndDotdot flag to the entryInfoList() call to avoid
infinite looping on _deps folder.

Pick-to: 6.7 6.8 6.5
Task-number: QTBUG-123491
Change-Id: I3920ea67f49f51b612e4937403af2e5bec5eaad0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-08-13 13:03:15 +02:00
Eskil Abrahamsen Blomfeldt d37878dedb VectorImage: Implement support for switch control
There is some support for SVG's switch in Qt Svg, so we support
the same in VectorImage and svgtoqml.

Pick-to: 6.8
Fixes: QTBUG-121645
Change-Id: Ifb90fad3f16337b2a71b48d796dfb0fad82b39b4
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
2024-08-13 13:03:15 +02:00
Liu Zheng f83669821b fix: mips array out of bounds
When the incoming data is 4, the index defined by this macro has a crash

Log: mips array out of bounds

Pick-to: 6.8 6.7 6.5
Change-Id: I5acff5479f17e55d5731443d08b0915c701968f6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-08-13 11:03:15 +00:00
Santhosh Kumar 2046497424 Reset handler state when dragged item dropped outside the drop area
The handler state had been reset only after the release state. This
causes the handler to be inconsistent when the dragged item is dropped
outside the corresponding drop area. It can even lead to a crash (as
mentioned in the bug report) when the next drop happens over the same
location.

This patch resets the state of the handler whenever a drop happens (as
this causes the drag event loop to exit).

Fixes: QTBUG-127865
Pick-to: 6.8
Change-Id: I14cac162df8af8b7b6b9eed99631e29bada410d1
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-08-13 10:09:06 +02:00
Tor Arne Vestbø c821284d97 Dialogs: Fall back to non-native dialog if native dialog can't be shown
A native dialog helper might not be able to show a dialog due to the
dialog options not being possible to represent with the native dialog.

If so the helper returns false from show(). We were not handling this
case, so failing to show a native dialog would result in no dialog
shown.

We now fall back to the non-native dialog by destroying the native
helper and using the non-native dialog helper explicitly.

Fixes: QTBUG-124124
Pick-to: 6.8 6.5
Change-Id: If50c63e419ae7b13e9317cd2cbbcaa02fe13bbd5
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-08-12 19:31:56 +02:00
Laszlo Agocs 1f29bc32df sg: Use the new buffer update shortcut for geometry with d3d11 and gl
If we know the (dynamic) vertex QRhiBuffer is backed by a single native
buffer object, we could use the
begin/EndFullDynamicBufferUpdateForCurrentFrame mechanism to update the
contents since the entire buffer contents is changing, saving a memcpy
in practice (and no need to enqueue a resource update via the standard
QRhi mechanism)

However, with OpenGL glMapBufferRange has "interesting" behavior
patterns on some platforms (like unexpectedly trippling the CPU load for
no apparent reason on some systems), and anyway all we want in the end
with GL is a glBufferSubData. So instead of the mapBuffer-like existing
begin/end functions, use a newly introduced helper function in
QRhiBuffer that, specifically for OpenGL, boils down to doing a
glBufferSubData, whereas it is equivalent to begin+memcpy+end everywhere
else.

Not applicable for backends for modern APIs.

The logic is based on querying resourceLimit(FramesInFlight) == 1. This
is convenient to avoid having to write backend type checks, although it
relies on undocumented internal knowledge (as FramesInFlight==1 may not
strictly imply and give guarantees on how a Dynamic QRhiBuffer is
implemented internally)

Task-number: QTBUG-125087
Pick-to: 6.8
Change-Id: I317f9ff4bc03fadb6808b61cb053461b30ef1db7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-08-12 19:31:56 +02:00
Oliver Eftevaag d02f3adadc PopupWindow: Don't consume keyboard events when focus: false
If the QGuiApplication forwards a key event to an active popup, and the
popup consumes the event, it will not be sent to the active focus window.

The ComboBox relies on the popup not getting focus, when dealing with
key events, and won't work as long as the PopupWindow gets and consumes
the keyboard events.

It makes sense to only have popups consume events when it has explicitly
been given keyboard focus.

In addition, unblacklist popupWindowFocus after some tweaks. It's an
important test which verifies various things related to focus.
Unfortunately, due to unknown reasons, it still doesn't pass on QNX.

Task-number: QTBUG-121363
Pick-to: 6.8
Change-Id: I459c91c5db5c392e997aa996f03ecdda093a544a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-08-12 19:31:55 +02:00
Lucie Gérard 010516d71c Correct license in test directory
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only and all
build system should be BSD-3-Clause.

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.8
Task-number: QTBUG-121787
Change-Id: I9da6b82b6d620e72d5c6700e3d5901f9049f89e9
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2024-08-12 19:31:55 +02:00
Olivier De Cannière cc87c4ade4 Compiler: Don't pass a moved-from type resolver to PassManager
This can lead to crashes in static analysis passes when they try to use
the resolver.

Pick-to: 6.8 6.7 6.5
Change-Id: I2f7951374a3aa6bd38ef93333b97b08d9a46dd13
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-08-12 17:31:55 +00:00
Nicolas Fella f79b8924fc Fix qdoc syntax
Pick-to: 6.8 6.7
Change-Id: Idf149fa3765a16001a1c3d481752b774f56b0e57
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-12 19:31:55 +02:00
Ulf Hermann 9f554ef8cf QmlCompiler: Do not choose unstorable stored types
In order to pass the argument to a value type ctor we need to store it
in something we can rely on.

Amends commmit dd731b880b

Change-Id: I5d1ef6b4611aad9b595235f4f874ef4a063f04c6
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-12 16:19:40 +02:00
Ulf Hermann 7c404391c3 QQmlObjectModel: Do not store attached objects in global static
This is rather dangerous. The global static is not protected in any way
against concurrent access. However, we already have a place to store
attached objects. The base object's QQmlData. Just use that.

Pick-to: 6.8
Task-number: QTBUG-124345
Change-Id: I5f254e640f836016564f297d2f39ea40e037acd8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-08-12 12:34:31 +02:00
Sami Shalayel 04984f49cd doc: add qmllint incompatible-type warnings (for 6.8)
Add description of the warning introduced in 6.8 and an example on
how to fix it.

No need to pick back to 6.7 as this warning was introduced in 6.8 via
9cdd485c2b.

Pick-to: 6.8
Task-number: QTBUG-118112
Change-Id: Ice2a161cb195bc47dff2aa98bfee882d2ee6d417
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-12 09:12:49 +02:00
Sami Shalayel dcc8ec3f2c doc: add qmllint incompatible-type warnings (part 1 for 6.7)
Add description of the warnings and examples on how to fix it.

Pick-to: 6.8 6.7
Task-number: QTBUG-118112
Change-Id: I9d2c98ce15e558da81f9a204b8edff08e12ad5be
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2024-08-12 09:12:45 +02:00
Mitch Curtis 4b996eda57 Fix warnings in ListView delegate width bindings in manual tests
Bind width to the ListView's width, not the parent, which may be null.

Pick-to: 6.5 6.7 6.8
Change-Id: I020d23bb0c98b3da00db9ffd3400a89cfdeb1810
Reviewed-by: Doris Verria <doris.verria@qt.io>
2024-08-12 10:25:25 +08:00
Mitch Curtis 199185ff53 Fix assertion failure in screenshots manual test
SNIPPETS_DIR needs to be updated after the merge of qtquickcontrols2
into qtdeclarative.

Pick-to: 6.5 6.7 6.8
Change-Id: Ic2ceabd34b35a64868e6b7e261dca19b46c7f195
Reviewed-by: Doris Verria <doris.verria@qt.io>
2024-08-12 10:25:21 +08:00
Daniel Smith 48aedc5c9e Blacklist flaky tests for Bugfix week 2024/H2
Task-number: QTQAINFRA-6482
Change-Id: I642c9fe04b90bb6ecd3ac2f64136d9a299ed0a65
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-08-09 18:22:32 +00:00
Santhosh Kumar 6c36d341e0 Fix crash when dragging an invalid item in the header view
Dragging an invalid item in the header view leads to a crash. It's
better to safeguard before operating anything w.r.t. to the dragged
item.

This patch fixes that issue by validating the invalid item before
performing drag operation. Also added an test case to verify the same.

Fixes: QTBUG-127782
Pick-to: 6.8
Change-Id: I95398c7410d6fb6427ec06ff4b7da42472bc6d18
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
2024-08-09 20:22:32 +02:00
Venugopal Shivashankar 5ca8a2477a Doc: Add more info about translation strings with disambiguation
Documentation for qsTr does not include sufficient info. about disambiguation, which is well described in another topic. Added a
link to that topic to fix the gap.

Change-Id: I700e53207d997e7c8cd97413e6ff31111a21799c
Fixes: QTBUG-124847
Pick-to: 6.8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-08-09 15:33:20 +00:00
Santhosh Kumar 20260da535 Avoid memory corruption when accessing private instance of header view
The private instance of the header view has not been properly
initialized and this may lead to accessing invalid memory. Thanks to CI,
which caught this issue (while running in release with debug info).

This patch properly initializes the header view with their
corresponding private instance.

Pick-to: 6.8
Change-Id: Iaf42c5e70c404786d8c2dfe03d9265551956d6fa
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-08-09 14:39:13 +02:00
Doris Verria d41361c323 FluentWinUI3 Style: Add Check/Radio/SwitchDelegate
Use existing assets for ItemDelegate and CheckBox, RadioButton, and
Switch respectively.
Factor out SwitchIndicator into separate component so that it
can be shared by Switch/SwitchDelegate and use QML instead of
images for switch indicator in order to support custom accent
color

Task-number: QTBUG-125279
Pick-to: 6.8
Change-Id: I738a655439ca07745968f4775d4e8c123329fa25
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-08-09 14:39:13 +02:00
Qt Submodule Update Bot e960729363 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I01109e5ddbe0663adb81bda475822dc35a2c1f08
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-08-09 08:27:06 +00:00
Ulf Hermann b77d2f7f09 QML: Allow type annotations for all functions in QML mode
Fixes: QTBUG-112638
Change-Id: Ib41c372aca3f9bb124ca92eeaa41f8e770f2a800
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-08-09 10:27:05 +02:00
Ulf Hermann 3dc0ae032d Doc: Clarify life time of ListModel's elements
You really should not store them across modifications of the ListModel.

Pick-to: 6.8
Fixes: QTBUG-118024
Change-Id: Ib83aa31e47d9c4cfab612e678068679300b2d9d8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-09 10:27:05 +02:00
Ulf Hermann 90c55e859e QQmlListModel: Invalidate ModelObject when necessary
Both the object and the listmodel may be deleted during the life time of
ModelObject. Don't crash when that happens.

Also, fix QV4QPointer to actually name the type of the pointer it
stores. Apparently this is the first time we add a QV4QPointer of
something that's not a plain QObject.

Pick-to: 6.8 6.7 6.5 6.2 5.15
Task-number: QTBUG-118024
Change-Id: I208d8749bcd67970f7bfbe569eed7a472f909508
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-09 10:27:05 +02:00
Doris Verria 84a0da1bd4 FluentWinUI3 Style: Add documentation
Task-number: QTBUG-125748
Pick-to: 6.8
Change-Id: Iaeedd4044c686d1dce4ef611a4cf9a7ea8060f83
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-08-09 10:27:05 +02:00
Doris Verria fc82257218 FluentWinUI3 Style: Fix HighlightedText palette role color
Highlighted text represents the color of selected text and should be
white on both light and dark mode. We were incorrectly using this role
for the button text color for checked and highlighted buttons, which
does not correspond to always light text. Fix this for Button and
ToolButton as well as set this palette role to white color.

Pick-to: 6.8
Change-Id: Ia79d3e86cc038525e4c566d368f418ee5c56f89f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-08-09 10:27:05 +02:00
Vladimir Belyavsky 7ac8ac24b8 tst_qquickmaterialstyle: fix build with no material style
Fix tst_qquickmaterialstyle which fails to configure when Qt is
built with -DFEATURE_quickcontrols2_material=OFF. So we just add
an appropriate check to handle this.

Pick-to: 6.8 6.7 6.5
Change-Id: Ifdf3f22e515d1439364f12ec4a3bdad5c85acd85
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2024-08-09 05:35:58 +00:00
Mitch Curtis 426555aa58 QQuickVisualTestUtils::compareImages: save images on failure
Add a qt.quicktestutils.compareimages logging category which saves
compared images to the test executable's directory on failure when its
debug category is enabled.

Change-Id: Ifb5e85d00768fd11336d986a20080e1c16ca78a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-09 07:11:40 +08:00
Mitch Curtis 74c019e799 QQuickVisualTestUtils::compareImages: actually check all colors
The function was added in 906d5c5c40. The
tests there don't only use red, so it looks like this bug has existed
since 2013.

Pick-to: 6.5 6.7 6.8
Change-Id: I4bdf87fe6be0224016baf9a2a80faee6fe61514e
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-09 07:11:39 +08:00
Mitch Curtis a0ccf90d7e Introduce QQmlPropertyState enum
A flag that can be used by setters for properties with
implicit/explicit state to avoid bool traps.

Use it in a few places in Qt Quick Templates.

Change-Id: I5455a33c34ed978161d9d7e20e1d40267cc077b2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-09 07:11:38 +08:00
Eirik Aavitsland d6b31a84c5 Curve renderer: fix crash in wireframe debug visualization
Earlier, the uniform updating in updateNode() would access the fill
nodes only as QSGCurveAbstractNode, since it only called
setColor(). Recent changes have added muany more uniform settings
(texture fill, gradients etc), and hence the nodes are now being
accessed as QSGCurveFillNode. That will crash for the wireframe debug
nodes. Add a flag to filter out those nodes.

Pick-to: 6.8
Change-Id: Id167d0d85d8800110a44cc5eac9eb0dbec8bf03b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-08-08 21:22:39 +02:00
Eirik Aavitsland 8553f3b846 Avoid leaking nodes in when curve renderer is destroyed
For each visual change, the curve renderer generates new scene graph
nodes in runner objects. If the renderer was destroyed before the item
was updated, the runners and their nodes would be leaked (always in
sync mode, and sometimes in async mode).

Fix by making the renderer clean up the runners on exit, and the
runners clean up any nodes that have not been inserted into the scene
graph.

Fixes: QTBUG-127519
Pick-to: 6.8
Change-Id: I9fcfe9d0b67cfa5b4c6fcef59cc5f78c579ec7ea
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-08-08 21:22:39 +02:00
Vladimir Belyavsky 8c7f91ed65 tst_qqmlecmascript: fix build with no widgets
Fix tst_qqmlecmascript which fails to build when Qt is built
with -DFEATURE_widgets=OFF. Simply use QCoreApplication instead
of QAplication where appropriate.

Pick-to: 6.8
Change-Id: I8b1a5c162e7fef02c876e8981d9810035770f2b4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-08-08 22:22:39 +03:00
Alexei Cazacov 50d37c32f3 Docs: Organize topics in the qtdeclarative/Qt Quick Controls project
This commit organizes the articles, so they:
- have a reasonable tree structure
- can be navigated through the topic tree in the Qt Creator help viewer

Task-number: QTBUG-126648
Change-Id: I7851664d28fc487c8801cc9caa55deb2c0f249ec
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2024-08-08 19:39:51 +03:00
Alexei Cazacov 6dc3878e0b Docs: Organize topics in the qtdeclarative/Qt Quick project
This commit organizes the articles, so they:
- have a reasonable tree structure
- can be navigated through the topic tree in the Qt Creator help viewer

Task-number: QTBUG-126648
Change-Id: Iaf9fe0f42c31999879ae904294b747135ac49eac
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2024-08-08 19:39:51 +03:00
Sami Shalayel 66025b65b2 qmlls: fix qualified module completion
Fix the use of module qualifiers when generating snippets for all
three completion cases.
Let `import QtQuick as QQ` be an example, where the user wants to
complete a State snippet:
1. `QQ` -> insert `QQ.State { ... QQ.PropertyChanges { ... } ... }`
2. `QQ.` -> insert `State { ... QQ.PropertyChanges { ... } ... }`

The third case arises when there QtQuick is imported without qualifier:
3. `Sta` -> insert `State { ... PropertyChanges { ... } ... }`

Add tests for all three cases, and a method that creates the snippets
with the correct qualifiers. This avoids:
* getting `QQ.QQ.State ...` completions with duplicate qualifier
* getting `QQ.State ... PropertyChanges ...` completions with
  unqualified PropertyChanges

Also fix the snippet completion to avoid suggesting the wrong snippets
inside of bindings, like
`someProperty: stat` -> `someProperty: states: [...]`
for example.

Also fix the indexes in the tests to reflect the new policy for
completion on `.`.

Pick-to: 6.8 6.7
Fixes: QTBUG-127609
Change-Id: I1c70c661a15961b99157d9dc9e8de5e3320433c3
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2024-08-08 18:39:51 +02:00
Sami Shalayel 8f26cd2842 qmlls: fix completion on field member expressions
Do not confuse completion requests on dots with completion requests on
identifiers.

Fix itemsFromTextLocation to return the binary expression instead of
the right hand side of the fieldmemberexpression for the location of
the dot: for example, if you try to get the DomItem for the `.` in
`object.member`, then you would previously get the DomItem for the
ScriptIdentifierExpression `object`. With this patch, it will return
the BinaryExpression `object.member`.

We usually assume that sourcelocations have inclusive ends, for example
we assume that auto-completion on `\n` in `someName\n` wants suggestions
for `someName`, even if its technically one position "outside" the
sourcelocation of `someName`. This is not true for
ScriptBinaryExpressions, where auto-completion on `.` in `someName.` should
not return suggestions for `someName`.
The same also applies to probably all binary expressions `+`, `-`, and
so on. Therefore exclude the position behind the sourcelocations when searching
for items inside ScriptBinaryExpressions in itemsFromTextLocation.

This requires adapting qmllsutils to the "new fieldmemberexpressions" as:
* ScriptIdentifierExpressions for completion inside of them, for example
  `member` in `someObject.member`. isFieldMemberAccess() returns true on
  those.
* ScriptBinaryExpressions for completion on `.`.
  isFieldMemberExpression() returns true on those.

Adapt the offsets of the tests on completion on `.`.

This breaks some tests on qualified module identifiers, so QEXPECT_FAIL
them and track their resolution via QTBUG-127609.

Pick-to: 6.8 6.7
Fixes: QTBUG-127586
Change-Id: I82726205c7401e43174cc7749372e0776063bcbb
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2024-08-08 18:39:51 +02:00
Sami Shalayel 468fe40071 qmlls: resolve types of signal handler parameters + suggest them
Extend qqmllsutils's resolveExpressionType to resolve signal handler
parameters: they have the specificity that their type has to be searched
from the signal's definition, and can't be added via type annotations.

Implement the special signal handler parameter type resolution in
separate static resolveSignalHandlerParameterType() method.

Add tests for signal handler parameters in
tst_qmlls_utils::resolveExpressionType and tst_qmlls_utils::completions.

Note that implementing the signal handler parameter type resolution is
enough for the completions to work on those types.

Also fix resolveSignalOrPropertyExpressionType() to properly recognize
autogenerated property changed signals (to avoid mismatches with
QQuickWindow's colorChanged signal, for example).

Pick-to: 6.8 6.7
Fixes: QTBUG-127458
Change-Id: I7fc9d198564320485bb8e3527943c4994c02d90f
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2024-08-08 18:39:50 +02:00
Ulf Hermann b15103da7f Tie the libraries for QtQuick, QtQml, Models, and WorkerScript together
When QtQuick is loaded, we know that we also need QtQml, models and
workerscript. Therefore, hold on to some symbols in those so as to
prevent the linker from optimizing the depedencies out and forcing the
engine to use plugins.

This doesn't work on QNX, for unknown reasons. Therefore, on QNX we keep
loading the plugin for WorkerScript.

Pick-to: 6.8
Change-Id: I3653aac46028521160e4f96274c90c586bde1512
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-08-08 18:39:50 +02:00
Ulf Hermann c9d7620bc2 QQmlProperty: Reset the binding bit when removing a null binding
If we remove a binding we don't want any later code to restore it. This
works quite well if the binding we remove already exists.
removeFromObject() resets the binding bit and that settles it. However,
if the binding doesn't exist yet, we so far didn't reset the bit and
when the binding appeared we would still add it to the object. That was
quite wrong.

Pick-to: 6.8 6.7 6.5 6.2
Fixes: QTBUG-124553
Change-Id: I58c115d78b3701ad4e8837772261a9154b971dbb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-08-08 18:39:50 +02:00
Semih Yavuz 7a064486ff qmlls: fix enumeration name highlighiting
Fix the highlighting of the enumvalues in the form of
ComponentName.EnumName.EnumValue. To access the external qmlfiles in the
same directory, change the dependency option to default in the
highlighting test.

Pick-to: 6.8
Change-Id: I5dbd94aa6bbb80af9edc50f54fe95ed8cdd6c3cd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-08-08 18:39:50 +02:00
Semih Yavuz 8d945db7df qqmljsimportvisitor: fix module qualifiers
Append to m_seenModuleQualifiers right after the prefix check.
Otherwise, the method can early return before having chance to
insert prefix to m_seenModuleQualifiers.

Amends c126ac9a08

Pick-to: 6.8
Change-Id: I11de1dadfae55dd5a2f826c6b3ee8bcbaf58df7d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2024-08-08 18:39:50 +02:00
Ulf Hermann 7b9dd9514c qmlls: Avoid needlessly copying clientInitOptions
Coverity-Id: 467045
Change-Id: I15e4e4bfd010943f23fd50f3846f5fe1705b36b1
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-08-08 18:39:50 +02:00
Ulf Hermann 136021faaf qmlls: Avoid potential nullptr derefence
Coverity-Id: 466264
Change-Id: Ic8c933a69cddda81519d674d254999dcfe834574
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
2024-08-08 18:39:50 +02:00
Oliver Eftevaag 92eff047d6 Slider: use axis with the largest delta, when sliding via wheelEvent
The slider naively assumed that all wheelEvents would have either
angleDelta().x(), or angleDelta().y() set to 0, when in reality those
numbers can be any floating point value.

Choosing the largest of the two deltas, is a more robust solution.

Pick-to: 6.8
Change-Id: I1fb75eb5121c99c9b354e53732ec6981f477e283
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2024-08-08 18:39:50 +02:00