aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickgridview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix documentation of List/GridView countAlbert Astals Cid2024-04-221-1/+1
| | | | | | | | | It doesn't return the number of items in the view, it returns the number of elements in the model Pick-to: 6.7 6.5 6.2 5.15 Change-Id: Iea479ef0fef1823718d7681ae30bb49f60025237 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* GridView: add missing properties and signals to the documentationHatem ElKharashy2024-04-131-0/+44
| | | | | | | | | | | reuseItems, pooled(), and reused() can be used in GridView as well, since QQuickGridView and QQuickListView both inherits from QQuickItemView. Fixes: QTBUG-122250 Pick-to: 6.7 6.5 6.2 5.15 Change-Id: Ie9875f5b3abd98f9b14134d06fbfce0286d56444 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Move GridView.isCurrentItem exampleSafiyyah Moosa2023-08-081-2/+2
| | | | | | | | | | | Currently, GridView.isCurrentItem example is located under the GridView.view : GridView header. Moved this example to the GridView.view : GridView header. Task-number: QTBUG-61646 Pick-to: 6.5 6.6 Change-Id: I45c95e13afac6c95d621cee9643868f7da38cb8a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Flickable: Proportional wheel scrolling if deceleration is largeShawn Rutledge2023-06-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many users have complained about scrolling via mouse wheel being more or less uncontrollable: it's very hard to scroll shorter distances, and multiple "clicks" of the wheel usually overshoot far beyond what was intended. It was possible to mitigate that by setting flickDeceleration, but then touch-flicking also became much more "sticky". So now we have the flickDeceleration property dedicated to touchscreen flicks only, with the default coming from QPlatformIntegration::FlickDeceleration. There's no QPlatformIntegration::StyleHint for mouse-wheel deceleration. We disable the old wheel-acceleration feature by default, because many users nowadays have fancier mice or touchpads that achieve the acceleration in their own way. That's achieved by having the wheel deceleration value set to 15000 by default, which would be quite "stiff" if it was applied to the timeline, but in fact is defined to mean that there will be no acceleration. If the default is changed to 14999 or less, we continue reusing the same animation timeline for both flicking and wheeling, and applying the same acceleration/deceleration as before. There's some risk that some users will miss the old behavior; so we add a new QT_QUICK_FLICKABLE_WHEEL_DECELERATION environment variable to allow the user to override the default (to something less than 15000). When acceleration is disabled (which it is by default), QQuickFlickable::wheelEvent() no longer calls flick(), but instead uses the timeline to move the contentItem directly. Includes a drive-by fix, that enables scrolling to continue, even after the contentItem has moved into an edge. This behavioral change makes sense now that the scroll movement is more predictable. fixup() will still be called, to trigger the rebound animation. This patch reduces the strength of wheelEvent scrolling, so it made small tweeks to tst_QQuickListView2::wheelSnap necessary. [ChangeLog][QtQuick][Flickable] When using a plain "clicky" mouse wheel, Flickable has historically applied acceleration: the faster you rotate the wheel, the faster it flicked. The default value of flickDeceleration was 5000, which felt hard to control, but changing it in QML affected touch-flicking and wheel behavior simultaneously. So now we decouple those: flickDeceleration only affects touchscreen flicking, and Flickable rather uses a new default value of 15000, which is defined to mean that scroll distance becomes directly proportional to QWheelEvent::angleDelta() * QStyleHints::wheelScrollLines() (where a "line" is 24 logical pixels, because Flickable does not have direct understanding of its contents). You can set the new environment var QT_QUICK_FLICKABLE_WHEEL_DECELERATION to a value from 1 to 14999 to restore wheel acceleration behavior from older versions; 5000 was the old value. Done-with: Oliver Eftevaag <oliver.eftevaag@qt.io> Done-with: Paul Olav Tvete <paul.tvete@qt.io> Task-number: QTBUG-35609 Task-number: QTBUG-80720 Task-number: QTBUG-82565 Fixes: QTBUG-97055 Fixes: QTBUG-106338 Pick-to: 6.6 Change-Id: I0645c08c9681f57bc749b4cc7f4d26507f5cb211 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Doc: Mask some QML attached properties as read-onlyIvan Tkachenko2023-06-061-0/+5
| | | | | | | This affects ListView, GridView, PathView and StackLayout. Change-Id: Iacff4cf9118323916ca66bd755736a397c26fc43 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickItemView: Skip instantiating delegates if size is 0Fabian Kosmale2023-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Pick-to: 6.5 Fixes: QTBUG-110625 Fixes: QTBUG-89568 Fixes: QTBUG-51773 Change-Id: Ibe0e6fa5f01784016882522c120d2fee38df285b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* doc: Use \value rather than \li for enumeration values and constantsShawn Rutledge2023-03-281-46/+32
| | | | | | Pick-to: 6.2 6.5 Change-Id: Ica8354a53d0a5fb5dd1d8cd5f774dcdc56b6f99a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix build with -no-feature-quick-viewtransitionsTasuku Suzuki2023-03-071-3/+28
| | | | | | Pick-to: 6.5 Change-Id: I609a843bddbd0776452d289b144dab803503a483 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-21/+21
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Item views: fix error when accessing attached view from non-delegatesMitch Curtis2022-06-101-0/+10
| | | | | | | | | | | | Ensure that the view is set on the relevant attached objects before QQmlComponent::completeCreate() is called, which would otherwise result in a TypeError because the view would be set too late. Fixes: QTBUG-104026 Task-number: QTBUG-98718 Pick-to: 6.2 6.3 6.4 Change-Id: Ic65370bd4534e7452f2377ab4d60a74badf02079 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickGridView: return accurate row position when no rows are availableRichard Moe Gustavsen2022-05-101-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickGridViewPrivate::rowPosAt() returns the position of a row for a given index. At start-up, when no rows are yet loaded, a plain "(modelIndex / columns) * rowSize()" fallback calculation is sufficient. But as the user flicks around, and new rows are moving into the viewport, the current logic shifts to rely on the position of an already visible row to calculate the position of a new one. This is because the fallback calculation above will assume that row 0 always starts at contentY == 0, which is not always true for GridView - sometimes it will place rows outside the content item to make room for rows that were added after start-up. Likewise, if the cellWidth/Height changes, it might force existing rows to be placed outside the content item. So using an already loaded row as a reference becomes more accurate, especially when flicking slowly. The problem is that the fallback calculation is not only used at start-up. It's also used when e.g moving the content item a long distance in one go by e.g setting contentY directly, call positionViewAtBeginning(), or scroll using a ScrollBar. In that case, there will be no existing rows to rely on, since they have all been moved out of the viewport. Instead the error prone fallback calculation will be used. This patch will therefore adjust the fallback calculation to take all the necessary information into account, so that rowAtPos() returns the right position of a row, even when no rows are available as a reference. This will fix at least two bugs that happen because row 0 actually starts at a negative contentY, rather than at contentY == 0. Fixes: QTBUG-91461 Fixes: QTBUG-92868 Pick-to: 6.3 6.2 Change-Id: I21be6846809ddedf3dba0c3212693e8063411166 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickGridView: improve documentation for indexAtRichard Moe Gustavsen2022-05-101-6/+29
| | | | | | | | | Be more clear about the coordinate systems in use, and show an example. Fixes: QTBUG-30036 Change-Id: I0874362a7ffdadb1995572da9a7050144f2eedae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* GridView: Set content position when changing cell sizeTony Leinonen2021-12-041-0/+2
| | | | | | | | | | | | Content size was calculated before the new data was applied. This caused problems when calculating the column count while resizing the window. Pick-to: 5.15 Pick-to: 6.2 Fixes: QTBUG-92998 Change-Id: Ia4401c0e34cd11dc9e6c24a0320dbf0ca2f59ab9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickItemView: avoid leaking of highlights and animatorsUlf Hermann2021-10-291-9/+13
| | | | | | | | | It's unclear where exactly they leak, but the tst_snippets test in quickcontrols exposes it. Turning them into unique_ptrs is the clean solution anyway. They are clearly owned. Change-Id: I076ea86639b1e0ab3f688eb982b4cee6cb908f6b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix life cycle methods for some QML-exposed typesUlf Hermann2021-07-141-4/+0
| | | | | | | | | Follow the rule of 5: Drop empty dtors, and add Q_DISABLE_COPY_MOVE where we do need an explicit dtor. Change-Id: Icbb9d87e1087c69b1cf1f18062a496c148935783 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-051-3/+4
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-231-2/+2
| | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove hard-coded notes for 'Corresponding handler' for QML signalsTopi Reinio2020-03-101-4/+0
| | | | | | | | QDoc will generate these notes automatically. Task-number: QTBUG-37355 Change-Id: I8ed058ecbbcc630ad0351f6ce167c3fa61936f6f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QQuickListView: implement support for reusing itemsRichard Moe Gustavsen2019-12-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch will implement delegate item recycling in ListView. The API will be the same as used in TableView, except that it will be off by default since the behavior of a delegate that is reused is not compatible with legacy applications which were not written with this in mind. Most importantly: - Component.onCompleted will only be called on a delegate the first time it's created, and never when it's reused. - Any user-declared properties in the delegate (that is, not model roles, index, etc) will not be cleared or updated when an item is reused. The application must do this manually upon receiving the pooled or reused signal in the item. [ChangeLog][ListView] ListView now has support for reusing delegate items. This can be switched on by setting the reuseItems property of ListView to true. Task-number: QTBUG-80507 Change-Id: I68cc8300b050e4a1f89feebb1d31a2fd9189c793 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-281-1/+23
|\ | | | | | | Change-Id: I0ae0a162e133cffd8fb1a2c6b70826e50f06facd
| * doc: Clarify that the delegate populate transition doesn't always runShawn Rutledge2019-08-121-1/+23
| | | | | | | | | | | | Fixes: QTBUG-42798 Change-Id: If10f06450f1e50893e5ba103e7c8c2d83667a651 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Fix heap-use-after-free with QQuickListViewAllan Sandfeld Jensen2019-06-041-3/+6
| | | | | | | | | | | | | | | | | | Ensure we stop FXViewItems from tracking so we don't have pointers to dead QQuickListViewPrivate object on QQuickItem destruction. Fixes: QTBUG-71581 Change-Id: I80291086697b1455d9319969fe5cba0ea4d04a73 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Add itemAtIndex to quick viewsPaolo Angelelli2019-01-171-0/+13
|/ | | | | | | | | | | | This patch adds itemAtIndex method to ItemView-derived views and to PathView. [ChangeLog][QtQuick][QQuickItemView] Added itemAtIndex() to GridView, ListView and PathView to fetch a visible delegate by index. Change-Id: Id8475d06c1481036984fe5109bb52cf2729b1c21 Fixes: QTBUG-72961 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickGridView: Respect marginsUlf Hermann2018-10-041-6/+8
| | | | | | | | | | The margin has to be taken into account when calculating the positions for the dimension we are not scrolling and when calculating the number of columns available. Fixes: QTBUG-69863 Change-Id: Id2a53ced263c8926a8bfaf658376be293af3e8c9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Remove documentation for deprecated QML typesVenugopal Shivashankar2018-09-251-5/+6
| | | | | | | | | | | | | VisualDataModel, VisualDataGroup, and VisualItemModel are replaced with DelegateModel, DelegateModelGroup, and ObjectModel respectively (since 7cad0e52c5a020bd29635e9912fd8946a6b48124). Also renamed/deleted a few snippet files and an image. Task-number: QTBUG-37725 Change-Id: I5fa93993a31d8f9b08e7a282d5550ddd9bfb813f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* StrictlyEnforceRange should not override valid SnapOne decisionsMichael Brasser2018-06-291-2/+2
| | | | | | | | | | The changes made in 134d980a7fcf61c5440019bcfb3fdfc39c3f5f3c and 2b779fbd25aaf09897ee2cdc4edffd12a980420b were still a bit too broad. Tighten the condition further so original behavior is restored for smaller to medium drags. Change-Id: I9006e9cea80c1ef79e0b8d6a47b2a497532bef57 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix SnapOneItem/Row behavior for mid-range flicksMichael Brasser2018-06-291-3/+3
| | | | | | | | | | Previously small and large flicks would go to the next item, but there was a small range just under halfway where it would snap to the previous position (most easily hit with smaller delegates). Get rid of this blindspot. Change-Id: Ib8d026cad9427b2d209a9646b3ea515f578457ae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Add missing dots (qtdeclarative)Paul Wicking2018-06-191-1/+1
| | | | | | Task-number: QTBUG-68933 Change-Id: Ibb5aa227e82825085e7214e17dcffcb17fd44157 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-10/+10
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-02-021-8/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp src/qml/compiler/qqmlirbuilder.cpp src/qml/compiler/qqmlirbuilder_p.h src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4compilercontext_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4jsir.cpp src/qml/compiler/qv4jsir_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtimecodegen.cpp src/qml/jsruntime/qv4script.cpp src/qml/jsruntime/qv4script_p.h src/qml/qml/qqmltypeloader.cpp src/quick/items/qquickanimatedimage.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp tests/auto/qml/qmlplugindump/qmlplugindump.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp tools/qmljs/qmljs.cpp Done-with: Shawn Rutledge <shawn.rutledge@qt.io> Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I010e6525440a85f3b9a10bb9083f8e4352751b1d
| * GridView: Fix an off-by-one offset of positioning of itemsJan Arve Sæther2018-01-101-7/+6
| | | | | | | | | | | | | | | | | | | | The block for finding the position for the item *before* needs to be applied for the case where visibleItems is empty too, so we separate it out. Change-Id: I60a7e3a44d01a0087970e37bf4e73b94da5ebd48 Task-number: QTBUG-49218 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * QQuickList/GridViewPrivate::fixupPosition: don't set moveReasonShawn Rutledge2017-12-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QQuickItemViewPrivate::applyModelChanges(), if moveReason = QQuickItemViewPrivate::Other, then QQuickItemView::trackedPositionChanged() will fail to call d->setPosition(pos), which is normally what keeps the Flickable moving for a while. Leave the reason as-is (it will be SetIndex in this case), so as not to forget that we were actually trying to move down when the sequence window->polishItems() -> QQIV::updatePolish() -> layout() -> fixupPosition() did its part of the work of moving down. Task-number: QTBUG-62864 Change-Id: I1021e2ea39265de9e1285e2ee17c5733189ab939 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-091-4/+6
|\| | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/memory/qv4mm.cpp src/qml/qml/qqmlbinding.cpp Change-Id: I98e51ef5af12691196da5772a07d3d53d213efcc
| * QQuickListView/GridView: load items that results from model changes ↵Richard Moe Gustavsen2017-11-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | synchronously The current implementation created new items with default incubation mode, which is AsynchronousIfNested. But from reading the code, it seems like changes to the model were really expected to be handled synchronously, since there aren't any sections in the code that will recover from situations were requested items ends up incubating async. This is also backed by the fact that the second argument used to be a bool set to 'synchronous'. The fact that this was translated to AsynchronousIfNested later down the chain didn't seems to be taken into account. A bug with this is found in ListView when it's embedded inside an async Loader. In that case, all list items will be incubating async at startup, which is normally expected and fine. But if the model assigned to the ListView is modified before the loader has finished, async loading will also happen to the items created because of the change. And then the situation described above will occur. This patch will force any items loaded because of a model change to be synchronous. This seems to be in line with the synchronous logic that already exists. And its also quite acceptable, since changing the model before everything is completed is a corner case, and can naturally lead to some stuttering in the list view anyway. A potential for improvement on this logic is to try to recover whenever creating an item fails. But this takes a lot of work because of the way model changes are structured and stored, and can easily cause regressions. Since this is a corner case, it is probably not worth it. [ChangeLog][QtQml][ListView] Fixed a bug in ListView that sometimes make items end up with wrong geometry when changes to its model happens while the ListView is being loaded async (e.g if wrapped inside an async Loader). Task-number: QTBUG-61537 Change-Id: I8d6857beaf8ef98b02bb46282a1312749b0fb801 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * QQmlIntanceModel: use QQmlIncubator::IncubationMode instead of bool to ↵Richard Moe Gustavsen2017-11-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specify incubation mode The current implementation would pass a boolean to signal if asynchronous or synchronous incubation should be used to create an item. The problem with this approach is that passing 'synchronous" would translate to QQmlIncubation::AsynchronousIfNested later down the chain. This meant that even if the caller requested synchronous incubation, it could end up with asynchronous incubation anyway, e.g if an async parent incubator was active at the time of the call. And this can easily come as an unhandled supprise for the caller, and as such, cause unforseen bugs. This patch is a first of a set of patches that is done to fix the bug reported in the task below. It will not change any behavior, it is written to preserve the logic exactly as it were, just as a preparation for subsequent patches. It makes it explicit at the call location what incubation mode will be used, and especially make it clear whenever the AsynchronousIfNested flag is in play. Task-number: QTBUG-61537 Change-Id: I8b3ba5438ebb2cd59983a098bd8ceeeb844da87b Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | qquickgridview: Use setSize instead of setWidth + setHeightKai Uwe Broulik2017-11-301-2/+1
|/ | | | | | | Saves an intermediate signal emission. Change-Id: I1d9b9004b583108976ce12e6329095cdd54e2ee9 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickItemView: fix releaseItem() loopsJ-P Nurmi2017-06-121-3/+1
| | | | | | | | | | | | | | Calling releaseItem() destroys the item, which emits childrenChanged for the contentItem, and if at that point anything calls setFooMargin(), setContentHeight(), returnToBounds(), or many other methods that indirectly access the visibleItems list, it leads to a crash due to read after free. Add a releaseVisibleItems() helper method that makes a copy, clears the original list first, and then releases the items. Task-number: QTBUG-48394 Task-number: QTBUG-61294 Change-Id: I29e4d3870d33549e8bf789de84c67ab1826fca7d Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* Run includemocs in qtdeclarativeThiago Macieira2017-04-261-0/+2
| | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Item views: Q_DECL_OVERRIDE -> overrideJ-P Nurmi2017-01-181-44/+44
| | | | | | Change-Id: I7dfbd5f47893a3244c96989ad7eea7e93ea28603 Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickGridView: use C++11 range for loops for visible itemsJ-P Nurmi2017-01-171-16/+13
| | | | | Change-Id: If168e24e3e240182707602071125ac3538703fe7 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* Item views: eliminate some repeated QList::at() accessJ-P Nurmi2017-01-161-1/+3
| | | | | Change-Id: Iccc1ec0cf4408e25c04ca0be2562175e76d2d198 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-191-2/+2
|\ | | | | | | Change-Id: I326616356ee26d4532c6d57558c43c919f0a900d
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-191-2/+2
| |\ | | | | | | | | | Change-Id: I7bd70996e3372d154c6b0e47336baa22146667b0
| | * QQuickGridView: fix doc for itemAt() and indexAt()Anton Kudryavtsev2016-08-181-2/+2
| | | | | | | | | | | | | | | | | | | | | These methods have real arguments. Change-Id: I5362a407b8417b62bb27bb313dccce8611b5e316 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Quick: use const (and const APIs) moreAnton Kudryavtsev2016-08-121-9/+9
|/ / | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I270cdc6eb8c5946f5c20b379bbb7c60f0ba518eb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-201-4/+6
|\| | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4targetplatform_p.h src/quick/accessible/qaccessiblequickitem_p.h Change-Id: Ic95075a5fad81ec997a61561bd65979dfa3b9d4d
| * ItemViews: Make the wording of the warning on cache properties slightly sterner.Robin Burchell2016-06-161-4/+6
| | | | | | | | | | | | | | | | | | I have seen far too many cases of someone simply setting cacheBuffer to a massive number in an attempt to workaround a slow delegate. It should be explicit that cacheBuffer is not a solution for these problems. Change-Id: I09416d06ff7faf51a104e09ca5f6b3593ddc53c7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-191-27/+53
|\| | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickitem.cpp tests/auto/quick/qquickgridview/tst_qquickgridview.cpp tests/auto/quick/qquicklistview/tst_qquicklistview.cpp Change-Id: I3cf47faa2fe567d62fffd985aeecbefe5811cc42