aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitemview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QQuickItemView: fix releaseItem() loopsJ-P Nurmi2017-06-121-6/+2
| | | | | | | | | | | | | | 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>
* QQuickItemView: use some more C++11 range for loopsJ-P Nurmi2017-01-181-35/+34
| | | | | Change-Id: Ief706dfce0c81351ac06b8791267107ad8165974 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* Port existing qmlInfo callers to qmlWarningRobin Burchell2017-01-111-2/+2
| | | | | | | | | | | | | Now that qmlInfo actually reports info messages, we want to change existing callers to use warning-level messages to preserve the original message level. This was done through: perl -p -i -e "s/qmlInfo\(/qmlWarning\(/" **/*.{cpp,h,qdoc} .. with a little care taken to only add the hunks that should be changed. Change-Id: I511cee11ce0a26ec1048cd2b84c7536b812a0d89 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-2/+2
|\ | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| * Quick: Do not calculate the difference in a geometryChangeErik Verbruggen2016-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | This difference is only used by the ListView, so calculating it and storing it (on the stack) introduces a penalty for all items. As the new geometry is already applied, the old geometry is passed along. This has the added advantage that the ListView does not have to re-calculate that either. This fixes a performance regression. Change-Id: Id5e67bb663a5b11a55ec15ff24ca5b213d1fcef5 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Quick: mark some methods as constAnton Kudryavtsev2016-10-121-3/+3
| | | | | | | | | | | | | | These methods do not modify objects. Change-Id: Ibb2622cad6fbcec31c785f5d032304c648372350 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QQuickItemView: Extract Method fxViewItemAtPosition()Anton Kudryavtsev2016-10-041-13/+12
| | | | | | | | | | | | | | | | ... and reuse it in itemAt() and indexAt() Change-Id: I3e4682685227aa7c60d004152dffbc0ccaab6195 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QQuickItemView: de-duplicate calls and cache resultsAnton Kudryavtsev2016-08-221-11/+14
|/ | | | | Change-Id: If4b95446fcd0d84a6bb5e285e770450b966d5bc0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickItemView: use reverse iterators moreAnton Kudryavtsev2016-08-191-9/+8
| | | | | | | Since qt5.6 we can use reverse iterators. Change-Id: Ibf78b937e793c868ecc40710ef74c25308cc39bf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Quick: replace 'foreach' with 'range for'Anton Kudryavtsev2016-08-181-2/+2
| | | | | Change-Id: I3493b16a184fc811289db9e98eff37bb987113a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Quick: use const (and const APIs) moreAnton Kudryavtsev2016-08-121-16/+17
| | | | | | | | 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>
* QML: Pass the kind of geometry change aroundErik Verbruggen2016-07-111-2/+3
| | | | | | | | | | | | | This prevents re-calculation of what actually changed, and removes the now unused parameter newGeometry. Other than this change calculation, the only place where oldGeometry was used is QQuickListViewPrivate::itemGeometryChanged. To get rid of oldGeometry too, QQuickListViewPrivate now stores the current (i.e. last known) geometry, and updates it in itemGeometryChanged. Change-Id: I8a5286d08a04132c9a4c81de7ce221f5676946e6 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* QQuickItemView::forceLayout: Also call layout when d->forceLayoutAlbert Astals Cid2016-03-111-1/+2
| | | | | | | | | | | | | This way callers of forceLayout get a relayout if the dimension of a delegate that affects the itemview content size has just changed but the itemview content size has not been updated yet. This is useful because sometimes in the QML side you want to do things when the item view delegate size has changed but need the item view content size to be already updated. Change-Id: I846984a841e8e14c84d7a700a7ff736196b60afb Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-121-2/+4
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I356ec83cf687bd2833f9a7c5e820d56b1efa8979
| * Fix QQuickItemViewPrivate::updateUnrequestedPositions()J-P Nurmi2016-02-021-2/+4
| | | | | | | | | | | | | | | | | | | | | | Don't attempt to reposition unrequested items at negative indexes, meaning that they are not in the model. The chances are that they have been already deleted. Change-Id: Iadd08518b11e0ea5d7965215a517aafaf35c95ba Task-number: QTBUG-48277 Reviewed-by: Nikita Krupenko <krnekit@gmail.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-221-2/+2
|\| | | | | | | Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
| * QQuickItemView: Take sticky header/footer into account for ↵Robin Burchell2016-01-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | positionViewAtIndex(). When using an overlaid header or footer, we must adjust the position we come up with by the appropriate size in order to end up at the correct place. Change-Id: I218b9aef7fdf37f56ffb63dc395f97045b55a186 Task-number: QTBUG-50097 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | ListView: add keyNavigationEnabled propertyMitch Curtis2015-12-081-0/+26
|/ | | | | | | | | | | | | It is useful for applications that need to selectively enable or disable mouse and keyboard interaction. [ChangeLog][QtQuick][ListView] added keyNavigationEnabled property to allow mouse and keyboard interaction to be selectively enabled/disabled. Change-Id: I1cdb73e7be105bcc5c131e3cf2ae242dc66e8a65 Task-number: QTBUG-17051 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Item views: Don't emit 'currentItemChanged' if the current item didn't ↵Gabriel de Dietrich2015-09-051-1/+2
| | | | | | | really change Change-Id: I8892bb9b6ab6737d4a6f6f8aab836f863668682e Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Fix potential use of incorrect bounds in delegate tracking.Michael Brasser2015-07-121-14/+31
| | | | | | | | | | Using GridView.SnapToRow and GridView.ApplyRange with a top margin could lead to the view jumping (rather than smoothly transitioning) when changing the currentIndex. Change-Id: I6936b378220f59e8d416f7531cf8b6906c723cb2 Task-number: QTBUG-45640 Reviewed-by: Martin Jones <martin.jones@qinetic.com.au>
* Fixed a QQuickListView crashLiang Qi2015-06-291-18/+26
| | | | | | | | | When an ObjectModel item is removed and destroyed. Task-number: QTBUG-46798 Change-Id: Ia41dd359d9f3ec5b7af85498dc798f7ab55dca3c Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* ListView/GridView contentHeight should include delayRemove-d itemsMatt Vogt2015-06-231-2/+3
| | | | | | | | | | When one or more items are in delayRemove state, the ListView's contentHeight property should include their height. This previously failed if the delayRemove items were at the end of the visibleItems list. Also applies to GridView. Change-Id: Id839e850367a3503123e8ac81dac6ebdccef1a1f Reviewed-by: Martin Jones <martin.jones@qinetic.com.au>
* Item views: don't assume that attached objects existJ-P Nurmi2015-06-091-10/+14
| | | | | | | | | | Attached properties are only on objects created by QML. In case a QQmlInstanceModel contains items that were created in C++, the attached properties object doesn't exist. Adding the missing null checks avoids a crash in such scenario. Change-Id: I93148ac6cefa4cb83a8a7eb24a84b125aaa443d2 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-1/+1
| | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QtQuick: Micro-optimize iterator loops.Friedemann Kleint2015-02-261-3/+5
| | | | | | | Avoid repeated instantiation of end() in loops, use variable instead. Change-Id: I6ab1fe2b82406d5ee91710a0333587ffb82c04d4 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Repeater & itemviews: fix setModel() JS array handlingJ-P Nurmi2014-10-291-1/+5
| | | | | | | | | | | | QVariant comparison in setModel() started failing because JS arrays are now passed as a QJSValue. Re-assigning the same array content should not trigger a model change. This change restores the old behavior it had before, when JS arrays were passed as QVariantLists. Change-Id: I1882b3531f2893b116dbd817edeecab1ae812ce8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* ItemView: use categorized logging for delegate lifecycleShawn Rutledge2014-08-131-0/+2
| | | | | | | | | It becomes configurable at runtime instead of having to uncomment and recompile. Change-Id: I2c6f24c89f7e6fe1a9a77b948cdac6f2994680bf Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Merge remote-tracking branch 'origin/5.3' into devSimon Hausmann2014-07-261-6/+8
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4engine.cpp Change-Id: Ie3ef6202b6a3a8521971e1be10c40c6a2db6989c
| * Don't recreate header and footer unnecessarilyMartin Jones2014-07-251-6/+8
| | | | | | | | | | | | | | | | | | | | The only time that they need to be recreated is if the orientation changes (even then, a good implementation could handle it, but no point requiring that now). Task-number: QTBUG-40375 Change-Id: Id0215fb812724827bb139cda8f8dc6208c703852 Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
* | Fix QQmlDelegateModelChangeArrayLars Knoll2014-07-221-8/+8
|/ | | | | | | | | | | | The class had a vtable, clashing with assumptions about Managed objects. The derived classes where actually only cosmetic sugar on top of the basic change class. Clean this up and unify the functionality in the base class. In addition adjust the class to the new data layout. Change-Id: I8677f6c71465381f7ebdf82eb6025fda6d137ec3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make ItemViews displayMargin work correctly when set to negative valuesAlbert Astals Cid2014-06-041-2/+2
| | | | | | | | | We need to call forceLayoutPolish instead of refillOrLayout so that the visibility is correctly updated. Also update one line that sets visibility in GridView Change-Id: I29fa67cdd5196a744fab9507b4104cb83ad4bf5e Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
* Item views: prevent negative cache bufferJ-P Nurmi2014-05-071-0/+5
| | | | | | | | | | A negative cache buffer does not make much sense, and the item views would go crazy and start creating/destructing delegates endlessly. Task-number: QTBUG-38725 Change-Id: I1fbba1f3130a99af67fbc4c2aba4d3199d0554a9 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* QQuickItemView/QQuickPathView: Fix creation of delegatesAlbert Astals Cid2014-04-181-0/+2
| | | | | | | | | | When the delegate is set before the model and after the ItemView/PathView has been created Task-number: QTBUG-38368 Change-Id: I6963abe28087699cf4e8921153dc7641bae3b220 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* ListView: fix rounding errorsJ-P Nurmi2014-04-091-2/+2
| | | | | | | Task-number: QTBUG-37339 Change-Id: I223e4d6bcabb1daa705c0ed2212e7e2b2fc3f37c Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Item views: improve initial Z-value handlingJ-P Nurmi2014-03-181-2/+4
| | | | | | | | | | Respect the initial Z-values of item, highlight, header, footer and section delegate instances. Mention also the default values in docs. Change-Id: I2ce4bb537898a0f5fdfa776b79d5747b1c080a7b Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
* Item views: avoid fixing up the position while moving/flickingJ-P Nurmi2014-03-131-4/+8
| | | | | | Task-number: QTBUG-35920 Change-Id: Id6a68400eed69d880dd1c218ec4a1beda8a8fbb9 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Make GridView/ListView attached "view" property available to all delegate typesNils Jeisecke2014-02-261-2/+4
| | | | | | | | | | | | | | | This is useful for accessing the view (e.g. "width", "cellWidth", ... properties) from within section (ListView only), header, footer and highlight delegate components. A typical usecase are components that are used in multiple views and therefore cannot use the views's id for access. The only attached property valid for those non-item delegates is "view". This has been added to the documentation. Change-Id: I33d976da778be23ed531a3b193ceee95ed9800d2 Task-number: QTBUG-32836 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-181-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4functionobject.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h Change-Id: Id164f6c3b45501aa466908659ec4e3b957323753
| * Fix wrong calculation of viewPort for transitionsFlorian Hänel2014-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | Viewport is calculated wrong for horizontal layout in a second instance Task-number: QTBUG-29944 Task-Number: QTBUG-31546 Change-Id: I136ae4484278d14f796613505e3f38c65ec51ebe Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Florian Hänel <florian.haenel@basyskom.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-111-2/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
| * Fix origin for short reversed item viewsJohn Brooks2014-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reversed (BottomToTop and RightToLeft) item views would report an impossible positive value for origin when contentHeight < height. The correct value will be effectively equivalent to the position of the footer, and always negative. Match other logic using lastPosition() by negating its value for reversed views. This fixes a bug with content disappearing in a Controls ScrollView on a BottomToTop view. Change-Id: Ieedbb64ce8fc7c0fb36e5256e437ddeb3e757761 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
| * Fix crash in header when regenerating view.Michael Brasser2014-01-301-0/+1
| | | | | | | | | | | | | | | | | | Unregister for geometry changes before reparenting, as reparenting may trigger those changes. Task-number: QTBUG-36481 Change-Id: Ia94f1f88880b232dd583b7e63e5da73fb338f7c6 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-241-1/+6
|\| | | | | | | | | | | | | Conflicts: src/quick/items/qquickrectangle.cpp Change-Id: Ia40bc0f2f08b5be68e32eb1e1f118445d20e44fc
| * Fix positioning of item when first cacheBuffer item is removed.Andrew den Exter2013-12-191-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | When items prior to the first visible item are removed from the instantiated items list the first item is moved forward by the size of the item removed so it position remains correct relative to the visible items. But if the removed item is the first instanitated item then it's size shouldn't contribute to the offset as the next instatiated item is already offset by its size. Task-number: QTBUG-33619 Change-Id: I05c33f505e2856afa08cd9cd89d8eae97c20679d Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* | Add displayMarginBeginning/End to ListView and GridView.Martin Jones2013-12-111-2/+38
|/ | | | | | | | | | | This allows displaying content outside the visible area of the view. [ChangeLog][QtQuick] Add displayMarginBeginning/End to ListView and GridView. Change-Id: Idf9b5a0cd34a781c9603a9ad98ea189754972ba1 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Also update viewport size when header/footer size changesRobin Burchell2013-11-261-0/+2
| | | | | | | Task-number: QTBUG-24292 Change-Id: I8e7f5abe077b6e8d2ce6625dcf43a34a7260934e Done-with: Martin Jones <martin.jones@jollamobile.com> Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>