aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview2
Commit message (Collapse)AuthorAgeFilesLines
* Fix index handling on insert in QQmlDelegateModelUlf Hermann2022-05-233-0/+153
| | | | | | | | | | | | | QQmlListCompositor can manipulate the "before" index when inserting. In particular it can extend an existing group. QQmlDelegateModel's cache, however, always wants the original index. Fixes: QTBUG-100161 Fixes: QTBUG-103203 Change-Id: I35c0a14ae45c9f66fdd079894dd0de2f80e2c781 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit e8ba9a3caa362f05657c4cb83893fe429ebaf4ab) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Cleanup CMakeLists.txt filesAndreas Buhr2022-05-071-2/+0
| | | | | | | | | | A lot of CMakeLists.txt files defined QT_QMLTEST_DATADIR twice, leading to a warning. This patch fixes these. Change-Id: I8b835fcddd3334f0ecac45cb72bd5763b3a5704d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 82b76e4eb57b4da46d8e7c24bd0b83310c2164b2) Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QQmlListAccessor: Support registered sequence typesUlf Hermann2022-04-284-0/+106
| | | | | | | | | | | Since we can pass any registered sequence types through QML as-is now, they are not wrapped into JS arrays anymore. We have to accept them as models because we also accept JS arrays. Fixes: QTBUG-102857 Change-Id: Ib294fff3681dce7f754efe877b19d17e698b4911 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 01f6ba9949a2f4ef2ac38d14f9d6f3ccff5852c9)
* QQmlAdaptorModel: Do not use reparenting for lifetime managemmentFabian Kosmale2022-02-032-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QQmlAdaptorModel, we were using QQmlStrongJSQObjectReference to ensure that a passed in model lives long enough. However, QQmlAdaptorModel uses reparenting to keep objects alive. This is not safe, as we can use QML singletons as models. Reparenting singletons messes with the engine's lifetime handling once their new parent gets deleted: The object will be marked as queuedForDeletion by QQmlData::markAsDeleted; consequently wasDeleted returns true for the object, and any ScopedObject or ObjectWrapper will return nullptr when we try to retrieve their underlying QObject. The actual object probaly does not get deleted, as it is not placed in the QML heap. Consequently the gc will ignore it. This leads to a crash when the singleton is accessed in a different place: We see that the object is non-null, create a ScopedObject for it, and then try to later access the ScopedObject's underlying object (assuming that it must be non-null, because we already checked for the actual object being non-null). However, due to the reasons outlined above, we actually receive a null pointer, and thus encounter a crash. To avoid he issue, we change the lifetime management strategy: Instead of using the parent to keep the object alive, we now use a QV4::PersistentValue. Fixes: QTBUG-100260 Change-Id: I266e6ef94c4f079de3da2742d6fb8d61df5a64ce Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 6901eacff40a7d8781e20fb5bcfd28d7526b589b)
* QQuickListView: Stop overlap for section and firstItem delegatesOliver Eftevaag2022-01-202-0/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The first delegate after a section delegate would have the same position as the section delegate, if the section delegate is invisible during initialization. In case the section delegates become visible later on during program execution, the delegates would be re-positioned again in the QQuickListViewPrivate::layoutVisibleItems function. But this would not call setPosition for the first item (delegate). It would only call setPosition for all delegates after the first one. This would mean that the position for the first delegate would never be updated, after the delegate was first created. Solution: Call FxListItemSG::setPosition() for the first item in QQuickListViewPrivate::layoutVisibleItems, just like we're already doing for all the items after the first one in the for-loop. Fixes: QTBUG-94848 Change-Id: I34a5ada336ab507b31e3675a1c11eba066fa139a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 3aad05bc09f40d81df7748cbc246974230a3ca17) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* If ListView visibleItems count is zero update footerTony Leinonen2021-11-192-0/+104
| | | | | | | | | | | After removing the last visible item from ListView the footer jumped back to its original position. Call updateFooter if the are no items in the visibleItems list to set the footer to its correct position. Task-number: QTBUG-86044 Pick-to: 6.2 Change-Id: Id226304030ecc8db26d413670a908f50feef5ba0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* De-flakify tst_QQuickListView2::dragDelegateWithMouseArea()Jan Arve Sæther2021-11-191-0/+1
| | | | | | | | | | | On opensuse 15.3, the window will sometimes move (probably due to window decorations being added by the window manager). Showing the window frameless seems to fix it. Fixes: QTBUG-97914 Pick-to: 6.2 Change-Id: I310c8f514b6ea11934da2de1673ca49463bfa746 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix compiler warning from unused parameterVolker Hilsheimer2021-11-081-1/+1
| | | | | | | | Amends d00c76171de0c76794eb70a7284326332c0b3c66. Pick-to: 6.2 Change-Id: I451397ac44a436281c9f5e35ea8011ed7add7c1a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Reset currentChanges if currentChanges is active when refilling listViewTony Leinonen2021-11-052-0/+145
| | | | | | | | | | | currentIndex was not getting updated because itemViewChangeSet was left active from previous interaction. Clear the changes if they are still active on refill. Task-number: QTBUG-92809 Pick-to: 6.2 5.15 Change-Id: I81558a5e0bfe0f880851fff85370bd5be60a5391 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Let DelegateChoice.roleValue compare enum as string, enum or intShawn Rutledge2021-10-305-0/+206
| | | | | | | | | | | | | | | In Qt 5 this worked. In Qt 6, some QVariant::operator== overloading has been removed; so we need to do explicit conversions for the types that we support comparing. This fixes delegate switching in tests/manual/tableview/storagemodel. Fixes: QTBUG-86202 Fixes: QTBUG-97488 Pick-to: 6.2 Change-Id: I4cb3a9b470a927bfdef55957ef3f0dd2c6dcaa42 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Consolidate test helpers into private librariesMitch Curtis2021-09-132-11/+7
| | | | | | | | | | | | | | | | | | | | Previously each test would include and build sources from the shared folder. Now we make those sources a library, build it once, then have each test link to it instead. We also take the opportunity to move some helpers that qtquickcontrols2 had added into the quicktestutils library where it makes sense, and for the helpers that don't make sense to be there, move them into quickcontrolstestutils. We add the libraries to src/ so that they are internal modules built as part of Qt, rather than tests. That way we can use them in a standalone test outside of qtdeclarative. Task-number: QTBUG-95621 Pick-to: 6.2 Change-Id: I0a2ab3976fdbff2e4414df7bdc0808f16453b80a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix regression in ListView/Flickable event deliveryJan Arve Sæther2021-08-202-0/+212
| | | | | | | | | | | | | | | | | The regression was introduced with 2acb31641fc9c34d24ac29232cdfec The problem was that when we entered QQuickListViewPrivate::wantsPointerEvent(), the event was not localized to the QQuickFlickable when mouse filtering was done. Therefore, since the code assumed that the localPos was local to the Flickable, it always ended up assuming that the point was within the bounds of the header/footer. Fixes: QTBUG-89409 Pick-to: 5.15 6.1 6.2 Change-Id: Ib595e61b7995241b58e3051da09139e1e1f13cba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* ListView: support QList<QUrl> modelsMitch Curtis2021-04-293-0/+182
For now this patch just tacks on another list type, but there may be a better way to account for all types in the future. This change also adds tst_qquicklistview2 to speed up development. tst_QQuickListView is 10000 lines long, and compiling it is slow (36 seconds on a 2016 i7 MacBook Pro). In addition, a similar approach (creating a second test to avoid the slowness of a massive one) already exists for QQuickItem tests. Task-number: QTBUG-72906 Pick-to: 6.1 Change-Id: I05455a2f20978b07eb38591ab63e7d0fb7dac1ab Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>