Commit Graph

2904 Commits

Author SHA1 Message Date
Ulf Hermann 9100ed3f88 QQuickItem: Do not synthesize replace() for data/resources/children
Those properties are not actually sequential containers. They have some
internal logic that refuses certain operations and changes the semantics
of others. We should not run things like splice() on them.

We can natively implement removeLast(), though.

Fixes: QTBUG-112949
Change-Id: Ic9fa84f98a68428df9e958ba7fc72b0987e8601f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 7e19885399)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-10 09:10:21 +00:00
Richard Moe Gustavsen 9418f2d1e1 QQuickFlickable: avoid processing the same event twice
If Flickable has an exclusive grab (e.g if it's being dragged), and
at the same time, a child has a passive grab (e.g a TapHandler inside
a child of the content item), Flickable ends up getting the same pointer
events twice.

The reason this happens is because Flickable has a childMouseEventFilter.
So the flickable will first get all the pointer events since it has an
exclusive grab, just to see that the filter will receive the same
events once more, as they next are delivered to the passive grabbers.

The result is that Flickable will handle all pointer events
(move, release etc) twice when it has en exclusive grab, which will
even cause the flickable from stop flicking prematurely if the mouse
release ends up outside the bounds of the flickable (because of a double
call to handleReleaseEvent(), which will set stealMouse to false too
early).

To fix this, this patch will make sure that we don't handle any pointer
events in the childMouseEventFilter if we already have an exclusive grab.
After all, having an exclusive grab means that we're already getting the
events the "normal" way, and shouldn't handle the same events once more.

Fixes: QTBUG-104987
Change-Id: Iaed49cb860cf50ea38a70a6e546d9dcf25cce444
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 1bac9de113)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-02 15:39:59 +00:00
Seokha Ko 25169a444d Flickable: Send movement signal when flick starts
If there are multiple moves between touch down and release,
but they are merged, or if there is only one move,
flick occurs but no movement signal is generated.
So, send movementStarted if the view is moving in
handleReleaseEvent

Fixes: QTBUG-112924
Change-Id: I774799bac2a00296a72005dcfa9ade6683836d08
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e6a363efe8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-29 14:38:59 +00:00
Seokha Ko ead4f545ed Blacklist failing tests in tst_flickableinterop
pinchHandlerOnFlickable fail with QTBUG-112924.
Blacklist it for now.
It will be handled in QTBUG-113226

Fixes: QTBUG-113226
Fixes: QTBUG-112924
Change-Id: I58c646f957fb6f397405dc477d00eee770602e80
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 407675b191)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-28 08:25:46 +00:00
Jan Arve Sæther 466e17a9ae Fix StackLayout to keep the current visible item after insert/removal
If an item is inserted or deleted at an index less than or equal to the
current index, StackLayout.currentIndex will be updated in order to
reflect which is the current visible item. This is consistent with
QStackedLayout, QStackedWidget and TabBar

[ChangeLog][QtQuick][Layouts] StackLayout will now update currentIndex
if an Item is inserted or removed at an index less than or equal to the
current index.

Task-number: QTBUG-112691
Change-Id: Id1d687e309c8f199a4f68698b53ca7c169f17dcd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit adc3d8b2e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-26 13:38:41 +00:00
Jan Arve Sæther 8d08d0d4e9 Fix StackLayout to react to reordering siblings
When siblings in a StackLayout are reordered, we need to react, since
the sibling order corresponds to the "stack order"

Fixes: QTBUG-112691
Change-Id: Ie768af34bf5ee9d15ca67d61a64115f3df31990f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit a0fb254915)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-25 17:39:13 +00:00
David Edmundson 79874d568c qquickwindow: Clear hover when a window is hidden
This fixes a bug in the following sequence:
 - user opens a window
 - the window is hidden whilst under the mouse
 - later the window is reopened without the mouse being under the window
- with the lastMousePosition set an item underneath where the mouse
used to be gets activated.

On X11 we get a Leave event for the hidden window, this is not true for
wayland.

Change-Id: Ib14e8dbe29f1ad9a71a488b671d226be1d017b8d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 40889ffe52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-25 17:39:10 +00:00
Sami Shalayel 398926db49 QQuickItem: item stays pressed after DoubleClicks
Amends 72651a50f8.
This commit decided to ignore double clicks in the virtual
QQuickItem::mouseDoubleClickEvent().
If a subclass inheriting from QQuickItem wants to not ignore
a double click, it should override mouseDoubleClickEvent()
and handle the double click event accordingly.

Fix QQuickMouseArea::mouseDoubleClickEvent(QMouseEvent *event) to *not*
call the base implementation in QQuickItem after handling a double
click, because QQuickItem sets that double-click MouseEvent back to
the ignored state.

This was leading to weird behavior on platforms with touch
screens like Android or IOS where buttons "got stuck" after
a double click.

Fixes: QTBUG-112434
Fixes: QTBUG-109393
Change-Id: I774189fbcb356b07336f35f053e05a12c34ce602
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit d7fac6923a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-24 07:11:28 +00:00
Volker Hilsheimer d204cebca4 Accessibility: respect value in attached Accessible in controls
QQuickItemPrivate::accessibleRole is virtual and called by the framework
to determine the role of an item. The default implementation checks and
respects a possible Accessible attached object. However, subclasses that
override the virtual don't, so the attached properties are ignored, and
the class-specific implementation wins. This makes it impossible to
change the role of e.g. a checkable button.

To fix that, move the code respecting the attached object into a non-
virtual function that the framework calls instead, and only call the
virtual member if there is no attached object, or if that object is not
initialized with a role. Replace calls to the virtual from the
framework with calls to the non-virtual wrapper.

Do this for both QQuickItem and for QQuickPopup, and adjust the logic
in QQuickControl types that create an attached object and initialize
it's role when accessibility becomes active. Use the non-overridable
effective role value for that as well.

Add a test case, and to avoid any new framework calls to the virtual,
make it private.

Fixes: QTBUG-110114
Change-Id: Ia709cecbd181b6d8ee3297a4af60c1e7db9a2c51
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 3c08d08ae2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-22 06:44:31 +00:00
Fabian Kosmale 8fae0aa4ae QQuickItemView: Skip instantiating delegates if size is 0
If the area of a (List|Grid)View is 0, then instantiating delegates is
pointless, as they couldn't be shown anyway. However, our current logic
could not handle this case well, and would end up instantiating a
delegate for every delegate entry if their size also ended up being 0 -
you can after all fit infinitely many 0 sized items into a zero sized
container.
Detect this situation in QQuickItemViewPrivate::refill and the
applyInsertionChange implementations. Note that we only exit early if
there are no visible items and the view is zero-sized; if there are
visible items, we still want to ensure that they are removed after all.

We also need to adjust a few tests which had zero sized views to no
longer be zero sized; otherwise they wouldn't have created their
delegates in time.

[ChangeLog][QtQuick][ListView][Important Behavior Change] If a ListView
has size zero, it won't instantiate any delegates until its size becomes
non-zero.

Fixes: QTBUG-110625
Fixes: QTBUG-89568
Fixes: QTBUG-51773
Change-Id: Ibe0e6fa5f01784016882522c120d2fee38df285b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 37c25c6e74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-20 10:17:07 +00:00
Wang Chuan f9efa3469f QQuickListView: relayout when section geometry changes
Section delegate items will now notify the ListView when their geometry
changes. Enabling the ListView to call layoutVisibleItems to rearrange
the delegate items based on the geometric changes made to the section
delegate.

The listener is added when the item is created or fetched from the
cache.

The listener is removed when the item is hidden or removed from the
scene.

Fixes: QTBUG-101985
Fixes: QTBUG-100002
Change-Id: Ia7617424a8447ba82f62629d93b6a000a72bfc02
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b994c7ffaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-19 14:49:42 +00:00
Richard Moe Gustavsen 29d57f2774 TableInstanceModel: handle roleName invalidation
roleNames are generally guaranteed to be stable (given that QAIM has no
change signal for them), except that resetting the model is allowed to
invalidate them. TableInstanceModel did so far not take this into account.

Handle this case correctly by snapshotting the current roleNames before
the model is reset. Afterwards, if we detect that roleNames has changed,
we throw the current model set up away and rebuild everything from
scratch – it is unlikely that a more efficient implementation would be
worth it.

Fixes: QTBUG-111987
Change-Id: Id1e3b8e4f983c0f00fc7b30bd4897f1f7fcc3792
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit fd489252a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-18 19:48:38 +00:00
Volker Hilsheimer bc96ae68ec QQuickTreeView test: Fix valid compiler warning
QQuickTreeView::depth returns an int, not a bool, and rowToExpandDepth
is used in arithmetics and to compare to an int, so declaring it as a
bool is definitely wrong.

Change-Id: Iea127e6cc61e5a8195dc537ad4e62dc88570f874
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit c23afb3247)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-18 14:00:32 +00:00
Volker Hilsheimer 5f8780142b Quick item view tests: fix compile warning
Don't use QCOMPARE for a true/false test, use QVERIFY. This conveniently
fixes the (bogus, perhaps) compiler warning with MSVC about comparing
a quint32 (the underlying type of the polishScheduled bitfield) with a
bool.

Change-Id: Ib273ee30906e09955e849e65af2b7ff8ce3e2512
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 77886b496d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-18 14:00:24 +00:00
Volker Hilsheimer ae05e89189 MultiTouchArea: only subscribe to hover events when enabled
On macOS we always subscribe to hover events in the constructor so
that we can enable touch event handling when the mouse enters the
area. However, a disabled item should not accept hover events, so
we also need to override itemChange so that hover-acceptance is
flipped based on the enabled state.

Items should also never accept hover events, they should always
propagate. As the events are accepted by default and ignored in the
default event handler implementation in QQuickItem, we need to
ignore explicitly when we override. Do that by calling the parent
class implementation explicitly.

A disabled MultiPointTouchArea should also not subscribe to touch
events, even when the mouse enters.

Fixes: QTBUG-107037
Change-Id: Ifa57cb2af4fbf11a0c8eacde87d80e60afa3f895
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 3991a2e8ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-15 07:56:07 +00:00
Santhosh Kumar 8b6a4a9235 Fix stack layout index when loaded asynchronously
Lazy loading of stack layout causes incorrect index value in the
attached property for the child items. This is because,
attachedProperties are created and updated for the child object, after
being added to the stack layout.

This patchset triggers childItemsChanged() to reset child objects of
stack layout with right index value.

Fixes: QTBUG-111902
Change-Id: Iad06d028d0f977189b5da1122904dc754060a609
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit e397e5b43c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-14 13:44:30 +00:00
Jan Arve Sæther 8ff4f09b02 Do not crash if resizing a layout that got its child destroyed
Normally updatePolish() would call ensureLayoutItemsUpdated(), but in
some cases the layout might be resized before the updatePolish() is
processed.
We therefore have to also call ensureLayoutItemsUpdated() from rearrange()

Fixes: QTBUG-111792
Change-Id: Iab24dafc26dfa86975348c92244034f7ff825e5f
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 24f5695d35)
2023-04-13 09:41:09 +02:00
Axel Spoerl 9ed18f8c61 tst_QQuickTextInput: Stabilize clipboard related functions on XCB
Even if compiled with QT_CONFIG(clipboard), a functional clipboard
might not be available on XCB (e.g. due to restrictions on CI VMs).

This patch adds an explicit test for XCB to platformquirks_p.h.
It skips the test functions canPaste() and canPasteEmpty().
As a drive-by it constifies local variables in canPaste() and
middleClickPaste() and unifies the skip message.

It also removes the BLACKLIST entries for clipboard-related tests on
opensuse.

Fixes: QTBUG-95940
Change-Id: If6da9b589e98c1f63435f3d444567ce310ddee8a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c6fdaa5ab0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-12 14:03:19 +00:00
Volker Hilsheimer a867c9e522 Enable tst_QQuickCanvasItem on Android
The test mostly passes in the emulator and has generally no reason to
fail in CI. Test functions that should be blacklisted can be added to
BLACKLIST file, or QSKIP'ed if they crash, which none of them do.

Blacklist the test_save function, which fails on Android as we don't
have permission to write to the file system.

Fixes: QTBUG-103257
Task-number: QTBUG-41043
Change-Id: I5ef99a01dc26d9290be91675a5ff15e4de59e812
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 0230ceaec8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-12 01:36:29 +00:00
Shawn Rutledge 79b83a188b Fix PinchHandler.persistentTranslation; test cumulative native gestures
Since we do not want persistentTranslation to be always the same as
target.position, clearly we cannot use xAxis/yAxis to store the initial
target position: thus the startPos() function was wrong, and is now
removed. We need to store it in a separate m_startTargetPos variable
like DragHandler does, and as PinchHandler did before
7867a683fc.

Add an internal doc comment to clarify the arguments to
QQuickItemPrivate::adjustedPosForTransform().

tst_QQuickPinchHandler::cumulativeNativeGestures() now checks the result
of adjustedPosForTransform(): how far the target item moved.

Fixes: QTBUG-111220
Change-Id: I04237cb82a1abaaeab873a0d887acaf322f262ce
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 07aaa7c1b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-12 01:09:42 +00:00
Shawn Rutledge ddab508952 Fix TapHandler signals in combination with exclusiveSignals
TapHandler does not emit any singleTapped or doubleTapped signals after
emitting it once, if exclusiveSignals is set to `SingleTap | DoubleTap`.

This change corrects the behavior by resetting m_tapCount properly.

Fixes: QTBUG-111800
Change-Id: Ice7af2f41c2f30448004033d8330e733abe44110
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 951ab9f3c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-12 01:09:42 +00:00
Santhosh Kumar d61f8a30af Ignore tap events for table view when interactive is disabled
TableView uses QQuickTapHandler internally to handle tap events. This
handler accepts tap events considering pointerNavigationEnabled property
of table view. TableView accepts mouse events if either 'interactive'
or 'pointerNavigationEnabled' property is set as true, otherwise, it
has to pass mouse or touch events to the below item.

This patch introduces QQuickTableViewTapHandler inherited from
QQuickTapHandler that can explicitly check pointerNavigationEnabled
property of QQuickTableView during wantsEventPoint to either accept
or ignore tap events.

Fixes: QTBUG-108596
Change-Id: I330ae319706b6dbadc3a7319f62d636708aab995
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 79d61b3ab7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-12 01:09:42 +00:00
Volker Hilsheimer 981c6262d8 tst_qquickimage: modernize
Replace foreach with ranged-for and brace-initialize lists.

Change-Id: Ieccebcf953d36ffa1dcaf0a1eebef21f2e9074a4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e62f489209)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-11 16:42:15 +00:00
Volker Hilsheimer bb61f110fe Unblacklist tst_qquickimage:mirror test
The test has no business failing on macos-12 when it passes on macos-11
and macos-13. The test does depend on screen grabbing, which might
have been temporarily resulted in flakiness due to a system dialog or
similar disturbance.

Fixes: QTBUG-98402
Change-Id: I5fe548ec63e3ad6639a290cd83a96cfabdf4fb4b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c42b41cfe8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-11 16:42:15 +00:00
Amir Masoud Abdol 12c01eeab8 Replace AUTO_RESOURCE_PREFIX with QTP0001 policy
AUTO_RESOURCE_PREFIX is deprecated, and we should start using our CMake
policies instead.

Change-Id: Ic0b317929a2d9b9297d113f4382e895d63673e1d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4bfb341e36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-04-04 14:09:34 +00:00
Henning Gruendl 849a8829d4 Allow disabling internal deferred properties
Add environment variable to allow disabling internal deferred
properties. We should not make generalized group properties that point
to different objects immediate. However, for the intended use case it's
enough to disable internal deferred properties.

Task-number: QDS-8545
Change-Id: I22d31587290020ec03274a3373a30be196185b84
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 7ad7eb606a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-29 19:29:14 +00:00
Fabian Kosmale ec06850e58 AnchorChanges: Fix restore logic
The logic to decide whether a state change triggered a size change.
When AnchorChanges did not remove all old anchors, we might end up with
an anchor configuration that changes the size of an item (e.g.,
anchors.left and right being set), even if the new state only adds a
single anchor, e.g. anchors.left.

Moreover, we need to pass the correct dirty flags to setDirty, otherwise
the UI will not actually reflect the state of the Item.
As a driveby, fix an accidental double negation of qt_is_nan for
height.

Fixes: QTBUG-112354
Fixes: QTBUG-106677
Change-Id: I6c456fbdc314672f4fcbe740d941b44183fd5500
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit f2c108518c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-29 11:51:17 +00:00
Mitch Curtis b14ffff8b9 Add how-to for active focus debugging
This is a popular question online:

https://stackoverflow.com/q/47960622

Task-number: QTBUG-109634
Change-Id: I640654a96f0cdd5d7571562b9140dc20f86e73b5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit afa15792eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-27 01:32:50 +00:00
Mitch Curtis 0d8cdb7d2d Add a how-to page for Qt Quick topics
The goal for this page is to have an easily discoverable, useful
reference that shows the simplest and best way of performing specific
tasks using Qt Quick. Each task will have its own section title (so
they can be linked to) in the form of a question. For example:

    How do I make a QML Button call C++ code when clicked?

Each section will provide QML and/or C++ code snippets, or link to
other parts of Qt's documentation where those snippets already exist.
The QML-only snippets will be tested by
tests/auto/quick/doc/how-tos/qml, and the mixed QML and C++ snippets
will be tested by individual auto tests under
tests/auto/quick/doc/how-tos.

Fixes: QTBUG-109634
Change-Id: I512e016db2c914fd9e0241d5e0738af82a98d08b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit ac9830268a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-27 01:32:29 +00:00
Richard Moe Gustavsen bf7881dddf QQuickTableView: only clear selections when selections are enabled
TableView should only modify a selection (which includes clearing
it) when selections are enabled. Otherwise it should leave it to
the application to modify the selection model explicitly.

This can be used to set a selection that "sticks", regardless of
what the user does.

Change-Id: I264946d1b3513846794e1fe12b7d94cfaef050ed
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 9b804c58fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-22 12:57:29 +00:00
Richard Moe Gustavsen 8df4d22fe5 QQuickTableView: implement SelectedTapped correctly
The current implementation of SelectedTapped allowed
the user to start editing when tapping on the _current_ cell.
This is not correct, SelectedTapped is supposed to (like
the name suggests) let the user start editing when tapping
on a _selected_ cell.

This patch will change the implementation so that
the user can tap on a selected cell to edit it.

Change-Id: Ice5de9250c23f5f57e71077d4f46d1a3f31e9b80
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit bf12f5efa4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-17 19:57:23 +00:00
Shawn Rutledge ef0807f8ec tst_qquickcanvasitem: wait for canvas before creating a context
Hopefully this reduces flakiness in CI, following the suggestion from
the error message:

Unable to use getContext() at this time, please wait for available: true

Task-number: QTBUG-41043
Change-Id: I3710163cb197170e590f8fd7d188fa62f32ea649
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 223f1d45cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-11 06:53:39 +00:00
Santhosh Kumar 6ab4f45370 Fix multiple object creation in Loader
QML Loader creates multiple object of same component during initial
loading, if sourceComponent is assigned within state configuration
and it evaluates to be true. This happens due to the effect of
evaluating stage change (here in this case, setting loader source
component) during component completion which internally creates
component object and makes loader status be ready, even before
Loader instantiates object.

This patch adds a guard to check loader status and avoids object
creation if status is already ready.

Fixes: QTBUG-111559
Change-Id: I6c3456cd3bc35a717c139fbd3670c305304f480a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 492dc98a28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 15:27:37 +00:00
Shawn Rutledge f5b6ff356e Canvas test_url: wait until image is loaded
The loadImages() function has been waiting already since
6318560eca); but test_url() was not
waiting, which could result in CI flakiness. Anyway tryVerify is better
than waiting 200ms every time it's slow, and will give us a failure
message about isImageLoaded() if it fails.

Task-number: QTBUG-41043
Change-Id: I0bb552d3452d85342d2ffa3b6becded5b01177a8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit e37d2dac8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 23:04:06 +00:00
Matthias Rauter 1c73244363 Don't emit doubleTapped when the buttons are different
A left-click followed by right-click was interpreted as a double-click.
This is different from what I am used to and different
from what I expect. This patch changes the behavior such that only
clicks of the same button are interpreted as double click.

Fixes: QTBUG-111557
Change-Id: Id0d83ca66944497710d8f659ed5a6d1e4260a2d9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d3c1813563)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 20:36:36 +00:00
Shawn Rutledge b0541aa825 TapHandler: ignore untracked moving points; treat touchpad as mouse
TapHandler must decide on press whether it's interested in tracking a
particular point further, to see if a qualifying tap occurs, and should
only care about those points it decided to track. But if it did not
decide to track it, wantsEventPoint() should never care about the point
movement after press; nor about hovering points either.

The line in QQuickPointerDeviceHandler::wantsPointerEvent() checking
pointingDevice()->pointerType() != Finger was also making touchpad
behavior inconsistent with mouse behavior, which is why this bug
appeared on macOS but not on Linux: QQuickPointerDeviceHandler needs
to care about the incoming event's buttons on all devices except
touchscreens. It's probably been causing other symptoms on touchpads
since a97760a336c597327cb82eebc9f45c793aec32c9.

For the test, a05cbaaae5 restored the
cumulative native gesture scaling as it should be: so if we try to
scale by 1.1 twice in a row, the result is it's scaled by 1.21.

Fixes: QTBUG-108896
Change-Id: I3da8878648b89cce5d1a48fa02dffaefead2ac90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 7ef3bee4f2)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-03-02 16:54:01 +01:00
Shawn Rutledge 198295bc5b tst_FlickableInterop: use QScopedPointer for touchscreen device
Avoid leaking.

Change-Id: I791dc01b9be28464f55911a0e74cb7096fa4f316
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 0879758f8e)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-03-02 16:54:01 +01:00
Fabian Kosmale cef48c0d72 ListView: Do not create context for section if component is bound
ListView's section needs to inject a "section" property for
compatibility, unless a required property is used for this case.
So far, this made it impossible to use ComponentBehavior: Bound
with sections.
Remedy this by not creating a separate context if we detect that
required properties are used.
Adjust the check in QQuickListViewPrivate::setSectionHelper: If
we don't create a custom context, it might pick up the context
property from somewhere else; but we can then detect that the
used context is internal, and use that check to decide whether
we should call setContextProperyt or setProperty.

Fixes: QTBUG-111433
Change-Id: Icd3c138d48f790db92d02c53613539f8f17f5c77
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 471c909a68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-01 19:56:54 +00:00
Santhosh Kumar c4358550bc Fix mouse inside MouseArea (containsMouse) for press event
In MouseArea, containsMouse (mouse inside MouseArea) flag is enabled for
press event irrespective of whether its accepted or not. This creates
containsMouse to be enabled always for this corresponding item leaving
no option to reset.

To fix this issue, containsMouse flag is enabled only if the press
event is accepted for mouse handler.

Fixes: QTBUG-110594
Change-Id: Ibb0e89529ccebc3063330c22b8b3501b2917d78f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 2af8743aab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-23 22:07:54 +00:00
Amir Masoud Abdol db81d9f549 Replace AUTO_RESOURCE_PREFIX with Qt CMake Policy in examples, tests
Every instance of AUTO_RESOURCE_PREFIX has been replaced by either
qt_standard_project_setup(REQUIRES 6.5) or with
qt_policy(SET QTP0001 NEW), mainly in tests.

In addition, I added a warning message for the case where
AUTO_RESOURCE_PREFIX is used.

Task-number: QTBUG-96233
Change-Id: I323a15e9d0bb5fe6ba649365314af9fc2ad67bda
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 8f7080fd09)
2023-02-22 10:04:10 +01:00
Shawn Rutledge 512904abb5 Fix and test PinchHandler native-gesture scaling
We didn't have test coverage for several gesture events in a row (the
usual case in reality), nor for RotateNativeGesture at all. Amends
a432970b25 which incorrectly treated
QNativeGestureEvent::value() as an absolute zoom rather than a delta.

Fixes: QTBUG-111204
Change-Id: Ib95cab5cd3f97229abac1668e59d20ce50d24975
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit a05cbaaae5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 23:14:41 +00:00
Shawn Rutledge 0b5214e2c6 tst_QQuickPinchHandler: use QScopedPointer for input devices
Avoid leaking. Same solution as 0879758f8e

Change-Id: I7e182730757f01c6f93292b594a10681c8fa2cf2
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 206855055e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-17 14:49:57 +00:00
Richard Moe Gustavsen 0decb824c0 TableView: deprecate positionViewAtCell(column, row) in favor of positionViewAtIndex(modelIndex)
After deprecating modelIndex(column, row) in favor
of index(row, column), we should now do the same to
positionViewAtCell(column, row), to be consistent.

This function will therefore deprecate
positionViewAtCell(column, row) and instead offer
a new function positionViewAtIndex(modelIndex).

[ChangeLog][Quick][TableView] positionViewAtCell(column, row)
has been deprecated in favor of positionViewAtIndex(modelIndex).

Task-number: QTBUG-109542
Change-Id: Id47f990a6148acdb7c1185c7f654d6f2b261b2ad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3773ad8534)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 19:51:34 +00:00
Richard Moe Gustavsen 0e7f305667 TableView: deprecate itemAtCell(column, row) in favor of itemAtIndex(modelIndex)
After deprecating modelIndex(column, row) in favor
of index(row, column), we should now do the same to
itemAtCell(column, row), to be consistent.

This function will therefore deprecate
itemAtCell(column, row) and instead offer
a new function itemAtIndex(modelIndex).

[ChangeLog][Quick][TableView] itemAtCell(column, row)
has been deprecated in favor of itemAtIndex(modelIndex).

Task-number: QTBUG-109542
Change-Id: Ibd009cb3b9d6ce7ba19da5e20df9e307a31f5090
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3343c57b02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 19:51:28 +00:00
Richard Moe Gustavsen a8caf1f771 TableView: deprecate modelIndex(row, column) in favor of index(row, column)
Deprecate modelIndex(row, column) in favor of a new
function index(row, column), starting from Qt 6.4.3.

This has the advantage that we can print out a deprecation
warning when modelIndex() is is used at run-time from QML.
This will inform the developer early on that he should
avoid using modelIndex(row, column), since the argument
order differs between different versions of Qt.

Relying on compile time deprecation macros alone will not
work, since the API break is in a private class and only
used publicly from QML (except for our own internal auto
tests).

Since the equivalent function in QAIM is also called
index(row, column), this will additionally make the
naming more consistent with the model classes.

[ChangeLog][Quick][TableView] modelIndex(row, column)
has been deprecated in favor of index(row, column).

Task-number: QTBUG-109542
Change-Id: Iec8f5f8fa2a0ca714153128717b546bbd62c7e2c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aea8c9e093)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-13 19:51:22 +00:00
Shawn Rutledge f00edf7566 Flickable: don't initiate grab if there are multiple touchpoints
Flickable is meant to be flicked with one finger, not two or more.
If the UI depends on using the pinch gesture on some child of the
contentItem, Flickable shouldn't interfere with that.

The user might accidentally touch the screen with extra fingers while
trying to flick; Flickable should not care, as long as it has grabbed
the one touchpoint that it's tracking before the second point appears.

Removes QEXPECT_FAILs added in d7623d79ef

handleMoveEvent() can be called from filterPointerEvent(), or from
mouseMoveEvent() in case of direct delivery; and filterPointerEvent()
will now avoid stealing the grab during multi-touch press or release as
well. The "ignoring multi-touch" categorized log message is emitted
twice while filtering a move event, but only once in the other cases.

Fixes: QTBUG-77629
Task-number: QTBUG-85278
Task-number: QTBUG-106223
Fixes: QTBUG-109655
Change-Id: I7a19deaed3b2255de2b686f0d96bd08fe5ab1636
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 5171bcd9ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 17:18:29 +00:00
Shawn Rutledge b47e0f1c5f tst_QQuickMultiPointTouchArea::inFlickable: make synth-mouse realistic
Since 1d445eb5b1 this test has been
sending mouse events interleaved with touch events, and I believe the
intention was to simulate systems or touch drivers that send synth-mouse
events whether the application wants them or not. Let's at least make
them look synthetic to Qt Quick. It's getting harder to think of
workarounds for Flickable not to react to real-looking mouse events as
if they were actually real.

Change-Id: I7bbb6ef2d8e93cd9a6a4875a60b4ea02e254de9c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 2d1de5a5df)
2023-02-10 17:18:29 +00:00
Amir Masoud Abdol 5c23e54a0a Retire the qt_parse_all_arguments
Task-number: QTBUG-99238
Change-Id: Ia11c9cbd7c06347319ab3674ec0cd8da0214747e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c2d37f9646)
2023-02-10 11:22:15 +00:00
Santhosh Kumar 90aa5790a6 Fix qml warnings for qquickmousearea test cases
Triggering quickmousearea test suite generates qml warnings and its due
to change in qt6 qml compiler. These warnings has been fixed in this
patchset.

Change-Id: I38ba666c4ae77f1e82292ab748ca3f4bb6f34d63
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit f1fa9e5da2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 19:02:25 +00:00
JiDe Zhang f726bac943 Flipable: switch sides at 90 degrees regardless of camera distance
QQuickRotation::applyTo(QMatrix4x4 *matrix) uses
QMatrix4x4::projectedRotate() to apply rotation in pseudo-3D.
QQuickFlipablePrivate::updateSide() was previously applying
QQuickRotation to QTransform to decide which side should be showing;
but when using QTransform::map(QPointF) to get the position of the
transformed point, it is affected by the distance-to-plane value.
QMatrix4x4::projectedRotate() uses 1024 as distance from "camera" to
plane; so if the items on the plane are too large, some coordinates on
the plane may be behind the camera during rotation, which could cause
QQuickFlipable to mistakenly think that the current side has become
QQuickFlipable::Back.

Now we directly calculate the side of QQuickFlipable in 3D space rather
than performing projection, to avoid being affected by the camera
distance value. We use QMatrix4x4 instead of QTransform.

Fixes: QTBUG-75954
Change-Id: Ibb08f6f6de690f5b56c3130a1f7b09beb250c807
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 036b6159ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 02:58:38 +00:00