Commit Graph

8816 Commits

Author SHA1 Message Date
Richard Moe Gustavsen 2b6951017e QQuickTreeViewDelegate: remove selection on pointer click
Removing the selection after a pointer click is normally done
by TableView. But since TreeViewDelegate accepts mouse
events, it needs to do this explicitly.

Change-Id: Id0d6879f5b0e014aa05f50487f89dd0a08bb21f5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-04 17:45:09 +02:00
Doris Verria a0cdaa1d78 tst_qquicktreeviewdelegate: Fix click position inside indicator
Take into account the indicator position inside the parent delegate
when attempting to click inside the indicator. This may not be 0
depending on the delegate's margins.

Pick-to: 6.3
Change-Id: I7ddde6734dba3290947e51c787fee0128a90cd9e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-06-03 19:08:48 +00:00
Jan Arve Sæther 4de9df2c9a Fix QQuickStackLayout::rearrange for newly added items
Removes redundant calls to ensureLayoutItemsUpdated()

Add childItemsChanged(), which will keep count and currentIndex
properties updated, and emitting the corresponding signals for those
properties whenever children are added or removed.
Notice that these two properties will be updated immediately (not until
we get a updatePolish() call).
Only size hints and rearranges might be scheduled later until a
updatePolish() call.

This also makes the implementation of updateLayoutItems() empty,
basically because there is no shadow structure for holding the list of
layout items in this layout, so to keep that list of layout items
"updated" is therefore not needed.

Change-Id: Ibf8232ea1ad41a3d96b25bd2ea6aab6b5018e3bb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-03 08:52:33 +02:00
Shawn Rutledge 72651a50f8 QQuickItem: ignore double-clicks by default; remove allowDoubleClick
Because Qt has a pattern that events arrive pre-accepted, most
event-handling functions in QQuickItem call ignore(), and it's up to
subclasses to override those functions to allow the event to remain
accepted, if they choose to handle it. So it was odd that
QQuickItem::mouseDoubleClickEvent() did not call ignore().

Pointer handlers don't handle MouseButtonDblClick events, so
QQuickDeliveryAgent does not send those events to handlers. Since
0e3adb65b0 though, we disallowed delivery
of double-click events to Items after any handler has already accepted
the single point in a mouse event. This caused some inconsistencies; in
fact the allowDoubleClick variable was getting thrashed a lot, making it
hard to reason about the logic. Items that contained handlers behaved
differently than items that did not. One scenario being fixed here was
absurd: a parent Rectangle (which never handles pointer events on its
own) got an implicit grab in deliverMatchingPointsToItem() and thus
stole the grab from a handler (!), during delivery of a
MouseButtonDblClick (!!), just because the event happened to remain
accepted, even though no item or handler reacted to it directly.
The Rectangle needs to ignore() the event to avoid that, just as all
Items now do by default. Then it turns out that we don't need a stateful
allowDoubleClick anymore: the logic is more consistent without it.
Items can handle double-clicks, but they don't by default, as with any
other pointer event. Pointer handlers don't handle MouseButtonDblClick
because they detect double-clicks in their own way, and that's enforced
by simply not sending those events to handlers. Passive grabs should be
retained regardless of the interloper MouseButtonDblClick event: items
that handle it cannot cancel a handler's passive grab. They can steal a
handler's exclusive grab, but that should be prevented in other ways,
such as ignoring the event so that there is no accidental implicit grab.

Reverts 0e3adb65b0. DeliveryAgent no longer
calls clearPassiveGrabbers() directly as QQuickWindow did then; and it
also no longer delivers MouseButtonDblClick the same as a press event.
QSinglePointEvent::isBeginEvent() returns false in that case, so
deliverPressOrReleaseEvent() is not called.

A couple of existing tests now need to avoid generating double-clicks,
but they were not trying to test that anyway. New tests are added (test
coverage of double-clicks has been unfortunately sparse so far).

Pick-to: 6.3
Fixes: QTBUG-102625
Change-Id: If74baff68ffc46b8b403d37f4e10ddf6b159d40c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-03 08:47:02 +02:00
Andrei Golubev 6ced46e422 Rename tst_qmltc_{no}diskcache data folder to QmltcTests
Follow the policy of "good" QML modules where the module would reside
in a folder named the same way as the module URI

Somehow this is still not enough to remove an explicit
"-i <own qmldir>" workaround in qmltc compilation command

Change-Id: If1725ec03baf3690bb6cb8fc7876b082a155eaa2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-03 08:46:10 +02:00
Richard Moe Gustavsen 7dba66ab70 QQuickTableView: add new property 'selectionBehavior'
This patch will add a 'selectionBehavior' property to
TableView. It will let the developer specify if
the user should be able to select individual cells,
rows, columns, or if selections should be disabled.

This is equal to the selectionBehavior enum in QAbstractItemView.

[ChangeLog][Quick][TableView] A new property 'selectionBehavior'
has been added that specifies if the user should be able to
select rows, columns, or cells.

Change-Id: Ia8855ae032bb02d278b284ed35049d9237523139
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-06-03 08:46:10 +02:00
Ulf Hermann 8ea9646019 QmlCompiler: Don't crash when trying to resolve null list types
If the element type is unknown the list type is also unknown. This will
happen if we cannot resolve the type.

Fixes: QTBUG-103920
Change-Id: If1b05d99a1e64961981b5adb3974a51c11e776d2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-02 10:07:40 +02:00
Andrei Golubev e5251efe97 Set bindings on QQmlJSScope after AST traversal
We can get into situations when binding creation is problematic
due to the relevant scopes being yet unresolved. In particular,
this happens when processing attached/group properties script
bindings

Avoid having this situation by postponing the actual binding
setting until after the relavant scopes are resolved (mainly,
the binding owner). However, do relevant AST order dependent
operations beforehand to avoid accidental errors

This commit amends 25098b7a4f

Fixes: QTBUG-103897
Change-Id: I671955dbe321d03e5f1ab9891cc79dc0a936deda
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:40 +02:00
Andrei Golubev 87053c5422 Inherit base type access semantics in QQmlJSScopes
Group scopes may be value types so they require access semantics
different from a default value

Ordinary scopes and attached scopes seem unaffected, only groups
are thus covered with an extra logic

Change-Id: Ia9012548a602ca7ca07296491d27a295f4455f91
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:40 +02:00
Andrei Golubev 26179e6937 Address extension types in qmltc
Whenever working with properties (reading, writing, aliasing, etc.)
of the type that has extensions, prefer the same-named properties
from extension objects over type-owned properties (this is the internal
QML mechanism)

To achieve that, we need to query the extension object:
* for Q_GADGETs use a dummy model of assuming we can cast the object
  to the extension type and use that
* for Q_OBJECTs use a qmlExtendedObject() with additional logic of
  figuring out which extension should be picked in each specific case

Create QQmlProxyMetaObject via a custom dynamic meta object API for
qmltc-compiled objects that are derived from base types with
extensions

Task-number: QTBUG-91956
Change-Id: I5e783768ae2abdb9dddf894de7e79960244352bd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:39 +02:00
Andrei Golubev b85ac05e4a Document that QML_EXTENDED properties are practically FINAL
This is de-facto how it always was before
ff0b9ec6bf. As we plan to revert back to
the "original" behavior, document the FINALity of the properties so that
users know how it behaves (and we could not be held responsible for this
mess)

Change-Id: I4afed215fd66875821b7ce8d824b81782388324b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:39 +02:00
Andrei Golubev e353639d63 tst_qqmllanguage: Test extended group property case
Task-number: QTBUG-103881
Change-Id: Id5e0925f479ee638cc4db7fad18cc6d951b07f98
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:39 +02:00
Mitch Curtis 8353f84141 FileDialog: make selectedFile writable
This allows setting an initially selected file.

[ChangeLog][QtQuickDialogs] FileDialog's selectedFile property
can now be set to an initially selected file.

Fixes: QTBUG-101975
Pick-to: 6.3
Change-Id: I399f9379e1ac54917edbc31f9029d5522a914340
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-06-02 12:46:11 +08:00
Mitch Curtis 73e173d73c DialogButtonBox: test item deletion order
Ensure that items declared before and after the control itself do not
cause heap-use-after-frees due to deletion order.

Task-number: QTBUG-100396
Pick-to: 6.2 6.3
Change-Id: I3989bf1b9fc64b4ec86f241de2cb8bcd05c2f89d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 12:46:11 +08:00
Mitch Curtis ce1ec037d1 tst_container.qml: fix "Unsuitable arguments" warning
The full warning was:

QML Component: Unsuitable arguments passed to createObject(). The first
argument should be a QObject* or null, and the second argument should
be a JavaScript object or a QVariantMap

Pick-to: 6.2 6.3
Change-Id: Iaf81a6fc622d11cd6d6de22e931c2fb922ea9ec0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 12:46:11 +08:00
Mitch Curtis 40260e6703 Container: test item deletion order
Ensure that items declared before and after the control itself do not
cause heap-use-after-frees due to deletion order.

Task-number: QTBUG-100396
Pick-to: 6.2 6.3
Change-Id: I0735f57f9bed26bd9e506a02543de35646c0391f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 12:46:11 +08:00
Mitch Curtis c15c709c3a Control: test item deletion order
Ensure that items declared before and after the control itself do not
cause heap-use-after-frees due to deletion order.

Task-number: QTBUG-100396
Pick-to: 6.2 6.3
Change-Id: I8c080f7c3d4f2a58085dc5387677783d45fc093d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 12:46:11 +08:00
Mitch Curtis 36c6c1ea57 QtQuickTest: add API for checking for polish at window level
This adds a qIsPolishScheduled(QQuickWindow *) overload of
qIsPolishScheduled(QQuickItem *) (added in
40d6072bc8) and deprecates
qWaitForItemPolished() (added in
7a3cad0619) in favor of qWaitForPolish(),
which has QQuickItem* and QQuickWindow* overloads.

The existing functions that take QQuickItem are useful, but testing
Qt Quick applications can be made even easier by allowing users to
check if a window has any items that need to be polished. This
information is already present (in QQuickWindowPrivate::itemsToPolish),
so it's very efficient to check for.

This is especially useful now that Qt Quick Layouts using polishing for
their layouting, for example, as it's no longer necessary to find
individual polishable items in complex hierarchies before proceeding
to interact with child items.

[ChangeLog][QtQuickTest][QQuickTest] Added
QQuickTest::qIsPolishScheduled(QQuickWindow *) and
QQuickTest::qWaitForPolish(QQuickWindow *) functions for verifying that
updatePolish() was called on one or more items managed by a window.

[ChangeLog][QtQuickTest][QQuickTest] Deprecated
QQuickTest::qWaitForItemPolished(QQuickItem *). Use the new
QQuickTest::qWaitForPolish(QQuickItem *) function instead.

Fixes: QTBUG-93757
Change-Id: I95b6e051b3c9fd2fa93604f4d9ccda486bb29f9d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-02 12:46:11 +08:00
Ulf Hermann e3e8008ec3 Allow retrieval of sequences from QJSValue
As we can store sequence types in QJSValue, we should be able to
retrieve them, too.

Move the declaration of the QV4::Sequence struct into a header to make
it less of a hassle to identify sequences.

Change-Id: I3e45bfe193c669107f90cd6c502765c0c9f60fb0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 02:42:51 +02:00
Andreas Buhr 9264899b72 Cleanup tst_qquickanimators CMakeLists.txt file
QT_QMLTEST_DATADIR was defined twice, leading to a warning.

Change-Id: I084d8350182513c03d062df49294eae4a872512b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-06-02 02:42:51 +02:00
Janne Juntunen e3eb55c08b tst_snippets: different snippets location for webOS
The stock test tried to access snippets from a path relative to the
source directory, which didn't work for webOS emulator. The
correction is to copy the snippets under ./data so that they get
included in yocto-generated emulator image.

Fixes: QTBUG-103915
Pick-to: 6.3
Change-Id: I85b735eb3f6dadea0f9691dbb553e6008d000045
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-01 11:17:03 +03:00
Andrei Golubev 86fae5664c Remove qmltc compilation command in favor of qt_add_qml_module()
[ChangeLog][CMake] The qmltc compilation functionality provided by
qt6_target_compile_qml_to_cpp() is merged into qt6_add_qml_module()
command and is available through ENABLE_TYPE_COMPILER argument. The
qt6_target_compile_qml_to_cpp() function does nothing and is left
only to highlight that users must migrate away from it.

Fixes: QTBUG-100215
Change-Id: Ie7d6b82564dff86176194fce35039ba0d93c0977
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-31 17:23:09 +02:00
Oliver Eftevaag 1234a59a4d Add ColorDialog to QtQuick.Dialogs
[ChangeLog][QtQuickDialogs] Added ColorDialog.
This is a native dialog on platforms that support it,
and a non-native Qt Quick ColorDialog on platforms that don't.

The supported styles are Basic, Fusion, Imagine, Material
and Universal.

Fixes: QTBUG-87796
Change-Id: I7146ca0571c84c9878a4010798e083ee249f273c
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-05-31 17:23:08 +02:00
Jani Heikkinen 6f9fbc8fef Revert "Revise QQmlProxyMetaObject and extension chain creation"
This reverts commit ff0b9ec6bf.

Reason for revert: QTBUG-103881

Change-Id: I7e333ec854e81fb06f1f84b77125edc78bb181e6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-31 11:09:22 +00:00
Richard Moe Gustavsen a1297194ca QQuickTableView: ensure we use the correct margins during key navigation
Ensure we use the correct margins when navigating with the arrow
keys at the beginning and end of the table. When e.g navigating
to the first column in the model, we want to flick the view all
the way to the start, margins included.

It should already have worked like this, but must have
broke after earlier copy/pase operations.

Change-Id: I438b20518602e4cc5b49e137f633a7f550a9dec8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-31 13:05:08 +02:00
Richard Moe Gustavsen 065fb60786 QQuickTableView: add a 'subRect' argument to the positionViewAtCell() functions
By providing a sub rectangle, TableView will position the view
on the rectangle instead of the bounding rectangle of the
whole cell. This is useful for large cells, where you either
want to make sure that a specific part of the cell is
visible, or you want to avoid any unnecessary scrolling if
that is already the case.

[ChangeLog][Quick][TableView] A new argument 'subRect' has been
added to positionViewAtCell().

Change-Id: I03dce1cae050700c6c6d2165c6e975e35cbc9927
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-31 13:04:11 +02:00
Andreas Buhr ed65e55c7b Correctly include test data in tst_qquicktext
Pick-to: 6.2 6.3
Task-number: QTBUG-101865
Change-Id: I6aefdb489bedb9836e4d7725c88fbeec36d9cb70
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-05-31 12:55:57 +02:00
Ulf Hermann 29e2c7b414 QQmlDebugProcess: Crash if we cannot kill the debuggee
If the debuggee somehow manages to ignore our kill signal, the QProcess
dtor will hang. Let's rather crash in this case, so that we see when it
happens.

Task-number: QTBUG-101678
Change-Id: Idc72412925244acfdb1dfdeec07369d5fb271080
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-31 12:55:00 +02:00
Ulf Hermann f5514e682b QtQml: Fix and test edge cases of QQmlFile's local file detection
URLs with two slashes after the colon are generally _not_ local as they
contain an authority. However, file URLs with two slashes are
interpreted as "special" paths by QUrl::toLocalFile(). Therefore, we
accept them.

URLs without slashes after the colon can be local files. They denote
relative paths or special android resources then.

Pick-to: 6.2 6.3
Fixes: QTBUG-102944
Change-Id: Iaab3d7501b631e88ee8c1d93f1de8149ba60a5c4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-31 12:54:49 +02:00
Volker Hilsheimer 375e400390 Implement support for passive grabbers with mouse/touch events
Send mouse and touch events through passive grabbers.

With support for passive grabbers, the drawer can now make itself a
passive grabber for the mouse when it is pressed inside the margin
area. It will then see the update events that are delivered to the
exclusive grabber, and can try to grab the mouse when the e.g. move
has progressed enough. Then the earlier grabber gets an ungrab event
that allows it to cancel the action.

Done-with: Doris Verria <doris.verria@qt.io>
Fixes: QTBUG-59141
Change-Id: Ie8e79c2ec2aa1f5a00056f23856bd0bed19af2d6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-28 15:37:12 +02:00
Richard Moe Gustavsen 6d2d4914f8 QQuickSelectionRectangle: ensure we start the selection where the drag started
We should start the selection in TableView at the position where the
user started the drag, and not where the centroid at the time when the
dragging gets active (which is an offset equal to the
mousePressAndHoldInterval property in QStyleHints).

Pick-to: 6.3 6.2
Change-Id: Ibe330d31c1e2c8022006a56b7119b1dcb3e0e5b9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-27 21:55:36 +02:00
Richard Moe Gustavsen 8ef0407ddd QQuickTableView: add a new 'alternatingRows' property
Add a new property 'alternatingRows' that informs the
delegate that it should alternate between rows.
This is merely a hint, the delegate is free
to ignore it. But our own internal delegates, like
TreeViewDelegate, should not.

[ChangeLog][Quick][TableView] Added a new property
'alternatingRows', which is a hint to the delegate
to alternate between rows.

Change-Id: I3f10e7280332b652d393348ff0d71cd73ce6fa4d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-27 15:43:50 +02:00
Moody Liu f65fac1514 qmlls: use CompletionItemKind::Class for QML types
Change-Id: Ia121463cf4352bedc03475268f38ce32c0073d50
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-26 11:57:35 +01:00
Marc Mutz 83f18c3191 tst_qquickflickable: fix UB (more % in format string than arguments)
Provide the third argument.

Amends 8068bde891.

Pick-to: 6.3 6.2
Change-Id: I7f4b0043a64aae5e998309b9ea2332b6e86e2d74
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-26 12:57:35 +02:00
Shawn Rutledge 5680f42a97 Add MouseArea autotest with second touchpoint while first is held
- Touch first finger
- Touch and release second finger
- Release first finger

QQuickMouseArea::pressed() must be emitted only once;
QQuickMouseArea::released() must be emitted at the end.

Pick-to: 6.3 6.2
Task-number: QTBUG-103766
Change-Id: I849bbbad67c4739bea0a241b396bf4cbbebdd2e0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-25 20:46:34 +02:00
Kaj Grönholm bcec02f869 Implement FrameAnimation Quick element
FrameAnimation is a helper synchronized to animation frame updates
which can be used for custom animations and similar needs.
Compared to QML Timer element, it doesn't allow setting the interval
or repeat properties. Instead, it is triggered on animation updates
and provides useful properties like frame number and frameTime &
smoothFrameTime for fps-independent animation steps. Also it is
directly synchronized with QAbstractAnimationJob instead of going
though an extra Qt event loop like the QML Timer.

Contains autotest and manual test.

Task-number: QTBUG-102641
Change-Id: I5c72992462aba651b6fe8f2846baac3346799c56
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-05-25 14:51:20 +03:00
Richard Moe Gustavsen 9918909ab8 QQuickTableView: make top-left cell current on first key press
If TableView has focus, but currentIndex is not yet set, the
first press on an arrow key should make the top left cell
current. This will also make sure that if you e.g collapse
a tree node that contains the current index, you can still
continue to navigate using the arrow keys. This is
equal to how it works with widgets.

Change-Id: I1cd6266cd1a8269f7a4f2b1af989fddfc8ccd3c0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-05-25 13:51:20 +02:00
Mitch Curtis 1c680287ff Use regular key events for cancelling popups
We should avoid creating shortcuts for special keys like
Cancel (Back/Escape), as it can interfere with the user's own shortcuts
by e.g. requiring use of Keys.shortcutOverride, which itself can only
be sent to items with active focus, preventing users from overriding
Qt's global shortcuts in some cases.

[ChangeLog][Controls][Important Behavior Changes] Popups no longer
handle the Escape and Back keys by grabbing them as shortcuts, instead
they are treated as regular events. This also means that popups
that should be closable with the Escape or Back keys must have focus.

Task-number: QTBUG-79280
Change-Id: Iaf7249226d5766b2ab101630de5590b9524c56dd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-05-25 19:51:20 +08:00
Mitch Curtis 7b535d22d6 Give Dialogs and Menus focus by default
Dialogs and Menus should always have focus when they're opened,
especially now that the cancel key handling in
QQuickPopup/QQuickPopupItem is done via regular key events and not
shortcuts, as popups will now require focus in order to be cancelled
via keyboard.

[ChangeLog][Controls][Important Behavior Changes] Dialogs and Menus now
have their focus property set to true by default. Popups are unchanged,
meaning that popups that should be interacted with via keyboard
(including cancelling) should have focus set to true or
forceActiveFocus() called on them after opening.

Task-number: QTBUG-79280
Change-Id: Idd070f2b1e8180a34a0dadb6e11dc56e531df211
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-25 19:51:20 +08:00
Moody Liu 615e9b3348 qmlls: use proper completion item kind for properties
also add some tests to verify CompletionItemKind based
on current completion output.

Task-number: QTBUG-103765
Change-Id: I1ddf6cf5764f18fef28fe21d1a95d2f5c935ba9a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-25 08:21:07 +00:00
Fawzi Mohamed 3ec1403c11 qmlls: correctly call didCloseTextDocument in test
Change-Id: Iec938a07ced221246ddd6b453f0c778b1ca0691e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-24 15:44:16 +02:00
Ulf Hermann 6ff6c088c2 QmlCompiler: Add support for LoadElement on strings
In JavaScript the [] operator on strings returns a string. QString's
operator[] returns a QChar, but we can easily create a string from that.

Fixes: QTBUG-103371
Change-Id: Id5c960f00ecc7a5dfe30ccbcaac3ffb2a30308b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-24 15:44:16 +02:00
Ulf Hermann a75ddda71b QmlCompiler: Implement LoadElement for value type lists
Instead of the storedType hack in the type resolver, properly declare
the type LoadElement can return: A merge of undefined and the actual
type. This way we can choose the best concrete type to use for this
independently (and optimize it later).

Task-number: QTBUG-103529
Change-Id: I17b1f835f6a893ec843a90491e92f72ecb2e87fe
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-24 15:44:16 +02:00
Maximilian Goldstein 3d8702378b tst_qmllint: Write clearer descriptions when unexpected output is found
Previously we just crammed it all into one line.
This made debugging really painful. You either had to properly cut out
the source code, remove all the additional quoting and reformat it or
run qmllint manually to get proper formatted output.

This way you can actually debug these issues without resorting to any
external tools.

Change-Id: Iafdaaaa0ef7b96e70057b9b637b7c8f051d9e43a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-24 15:44:16 +02:00
Ulf Hermann 4d71091a19 qmlcompiler: Evaluate pragma ComponentBehavior
If components are bound we can assume the IDs of outer components are
reachable.

Fixes: QTBUG-102806
Fixes: QTBUG-101012
Change-Id: Ia26d3963d6c2fb9698debb12f9c655c5522f81ea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-24 15:44:16 +02:00
Andrei Golubev ff0b9ec6bf Revise QQmlProxyMetaObject and extension chain creation
Clone the full-ish meta object hierarchy when dealing with extensions:
that way we guarantee that shadowing works correctly both ways -
extension properties can shadow type properties AND type properties
can shadow extension properties (the latter happens when extension
belongs to a base type). This was impossible before since we would
always put extension proxies on top of the meta object chain,
regardless of where in the chain extensions are located. Consider:
"C -> B + ExtensionB -> A + ExtensionA" is interpreted as
(old) ExtensionB -> ExtensionA -> C -> B -> A
      ^^^^^^^^^^^^^^^^^^^^^^^^    ^^^^^^^^^^^
        cloned meta objects     static meta objects

(new) C -> ExtensionB -> B -> ExtensionA -> A -> C -> B -> A
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    ^^^^^^^^^^^
               cloned meta objects             static meta objects

One can notice that we now clone _more_ meta objects: this is to
be able to to create a chain with correctly ordered properties

Unify the proxy data creation under QQmlMetaType::proxyData()

Update QQmlProxyMetaObject which now has to deal with different types
of proxies: not only extensions but also "cloned" self. CustomCall
metaCall() of QQmlProxyMetaObject is also adjusted to ignore
non-extensions

Change-Id: I40e1547a9c05a8504ab98bc06a6bc412a2460783
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-24 10:30:48 +02:00
Andrei Golubev c02dd17a4f Support extension property revisions
Previously the extension's property revision would make
the property unusable since extensions would've been skipped
from property cache construction w.r.t. revisions

This is due to the meta object cloning that we do for
extension types (since we put the cloned meta object on top
of the meta object hierarchy for the QQmlProxyMetaObject).
Once cloned, the meta object has no associated QQmlType
anymore and we need one to deal with revisions. Overcome this
by registering the cloned meta object in the QQmlMetaTypeData

From now on, the cloned extension meta object has an
associated QQmlType, which is the *extended* type, NOT the
*extension* type

Change-Id: I4a6a4380278b80e49e1b9874dd458183667e5cb5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-24 10:30:44 +02:00
Soheil Armin ce441f8193 Fix visualSize calculation when width is changing
Position of the ScrollBar handle is fixed when it's being resized except
when it's on the extreme side (position + size = 1). In this case, when
the width is growing, the handle size should grow and the position
should decrease as a result.

Fixes: QTBUG-98387
Change-Id: Ibb18c03a741bb4e5a19425a57f14a68d27d68d12
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-05-24 00:50:09 +00:00
Janne Juntunen 37270a44a2 tst_qquickmenubar: skip some tests on webOS
It appears that webOS emulator environment or platform itself has some
custom behavior which prevents using standard tests.

Fixes: QTBUG-102120
Pick-to: 6.3
Change-Id: Ifbbb35e1fa6ef897527c3f9b91c6b9edd131f14c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-05-23 13:50:02 +03:00
Ulf Hermann 7fa03450cf QML: Add an option to bind components to files
If a component is bound to a file context, we can be sure that the IDs
present in the same file will be accessible to bindings and functions
inside the component. We will need this to allow such bindings to be
compiled to C++.

[ChangeLog][QtQml] You can now bind components to a file scope. This way
you can make sure IDs in the file are accessible to the components.

Task-number: QTBUG-101012
Task-number: QTBUG-102806
Change-Id: I290a61752b4b02e13f0bb0213ba3f871bdb95260
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-23 12:50:02 +02:00