aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsglistview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename Qt Quick-specific classes to QQuick*Kent Hansen2011-10-211-2500/+0
| | | | | | | | | | | | | | | | | | | | | | The QSG (SceneGraph) prefix is too generic for Qt Quick(2)-specific classes. All the classes and files in the declarative/items directory have been renamed. In particular, for classes that are currently public, the renaming is as follows: QSGView --> QQuickView QSGCanvas --> QQuickCanvas QSGItem --> QQuickItem QSGPaintedItem --> QQuickPaintedItem The header files have been renamed accordingly (e.g. qsgview.h --> qquickview.h). Change-Id: Iac937fff81db20bb639486a793c3aeb5230b038c Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Cannot flick to the end of a horizontal ListView with LayoutMirroringMartin Jones2011-10-171-47/+23
| | | | | | | | | | | | | | | Forward port of fix for QTBUG-21756. minXExtent calculated the offset due to highlight range incorrectly (reversed) when mirroring enabled. Also us same algorithm for fixup() in GridView and ListView uses. For QtQuick 2, this change also reverses the beginning and end highlight range, as it should be, i.e. the preferredHighlightBegin is from the right side in RightToLeft mode. Also added snapping tests. Task-number: QTBUG-21756 Change-Id: Ica0ba4ab5db0ce9c77f2da75e9f8293550bd37d1 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix insertions above the visible indexBea Lam2011-10-141-27/+32
| | | | | | | | | | | | | | | | | The first visible item was repositioned incorrectly after an insertion above the visible index since any insertions above the position + cache buffer were ignored and not considered for repositioning the first item. GridView insertion code has changed to be similar to the ListView implementation to fix various issues when inserting above the visible index and to remove code that crossed indexes from visibleItems with model indexes and visible indexes. Also adds extra insertion tests for ListView and GridView. Change-Id: I5e129c605fdad733b61bd29850465b3b752fb63f Reviewed-on: http://codereview.qt-project.org/6485 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Fix ListView components being unable to access context properties.Andrew den Exter2011-10-071-1/+3
| | | | | | | | | | | Where avaialable use the components creation context instead of the views context as the root context for the new item. Task-number: QTBUG-21865 Change-Id: I07e564548de57d58413dc0d7cd151bd8a90886e7 Reviewed-on: http://codereview.qt-project.org/6199 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Don't move content forwards when items are moved downBea Lam2011-10-031-0/+2
| | | | | | | | | | | | | | | | | | | | Previously, if items moved down within a view, the content position would effectively drop down. E.g. for a (0,5,3) move that moved 3 items from 0 to 5, the content y would move to the position of index 3, since it became the new first item. However, this makes it difficult to move transitions for move() operations in these cases since these items do not move (since the content position moves instead). With this fix, the content position does not move, and items will always move if they are moved. Note this behaviour was previously implemented for backwards movements, e.g. a (5,0,3) move but was not enabled for a forwards (0,5,3) move. Change-Id: I1c5a19e3c36347a4aa0cf6e31c975967a7eeada9 Reviewed-on: http://codereview.qt-project.org/5576 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't crash when QSGViewSection has a null parent.Christian Kamm2011-09-291-1/+1
| | | | | | | | This is required to make qmlplugindump work. Change-Id: I041adde3e48759f9c3ae166c887a26ccb8f264f9 Reviewed-on: http://codereview.qt-project.org/5800 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Manually apply SnapOneItem/Row changes from Qt 4.7Martin Jones2011-09-281-60/+84
| | | | | | | | | | | | Apply following changes to Qt 5 for both QtQuick1 and QtQuick2 items: cf23188de237009136fa1480ab8fd9e3ca364769 f85819fe083ae7c6804c884de68e906d153a6d11 09cd2f818208a83489fae034b80e6497b7cc83af Task-number: QTBUG-20683 Change-Id: I974764e57e3004514bb4c9f46c5152ad07c136a7 Reviewed-on: http://codereview.qt-project.org/5484 Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Additional ListView section header placement optionsMartin Jones2011-09-221-148/+364
| | | | | | | | | | | | | | | | | | Add a section.labelPositioning property which can be a combination of: - ViewSection.InlineLabels - section labels are shown inline between the item delegates separating sections (default). - ViewSection.CurrentLabelAtStart - the current section label sticks to the start of the view as it is moved. - ViewSection.NextLabelAtEnd - the next section label (beyond all visible sections) sticks to the end of the view as it is moved. Task-number: QTBUG-12880 Change-Id: I4601828337412bd3a83769c9b8df3f6d4d7474b8 Reviewed-on: http://codereview.qt-project.org/5192 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* View refill operations should take qreal, not intBea Lam2011-09-061-4/+4
| | | | | | | | | | Regression from initial creation of QSGItemView. Task-number: QTBUG-21281 Change-Id: I810a0b56ba4bacda49ac62b6e4c11cf9c1825c10 Reviewed-on: http://codereview.qt.nokia.com/4160 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Don't emit attached add() and remove() for moved itemsBea Lam2011-09-021-2/+4
| | | | | | | | | Regression from 6fbc4b7e7e5aed8739ca1143e0fc1e38b8c8e17a Change-Id: I0bcd55548dca1559deea0d66112e7cdeb3da4ed9 Reviewed-on: http://codereview.qt.nokia.com/4023 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Remove scheduleLayout() and layoutScheduledBea Lam2011-09-011-1/+1
| | | | | | | | | | | No longer necessary since views now call QSGItem::polish() which does its own layout scheduling and only does layouts when necessary Change-Id: I7d265fcf4177344c4ba10600b551a5545284316f Reviewed-on: http://codereview.qt.nokia.com/3843 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Batch view changes instead of applying them immediatelyBea Lam2011-09-011-324/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there are multiple changes to be applied to a view before the next repaint, collate them using QDeclarativeChangeSet and apply the changes as a group on the next layout(). (Note that changes to the current index are applied in sequence as changes are received, since changing it out of order produces different results.) Previously, any itemsInserted(), itemsRemoved() and itemsMoved() changes were immediately applied and items were repositioned immediately. In this situation if the same indexes changed multiple times between repaints, this could lead to redundant changes and bugs arising from multiple changes to the same items. Functions that will execute differently depending on whether pending view changes have been applied (e.g. count(), currentIndex(), highlight()) now call applyPendingChanges() before proceeding to ensure they are executed on a view that is up to date. Also, itemsMoved() operations that moved item/s backwards will now properly move backwards instead of being adjusted to a forward movement (which was implemented recently with e2b5681b1adab83555c7307b05f508d796a1152b) since backwards movements can be implemented more easily with the batched changes which translates moves into insert/remove actions. Change-Id: If9b39755898e8d2ed7e4bc61288206d5f1d653fd Reviewed-on: http://codereview.qt.nokia.com/3697 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add module qualifier to \qmlattachedproperty docsAlan Alpert2011-08-171-6/+6
| | | | | | | | | Was missed by initial script. Change-Id: Ib5e6482f53bda25b516075b52eb71f87b9279655 Reviewed-on: http://codereview.qt.nokia.com/3057 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Add documentationAlan Alpert2011-08-091-0/+547
| | | | | | | | | Copy the documentation back to the scenegraph items, and update it to the new module syntax. Change-Id: I5d030a231f991a209a8593ddb069e1b6cd03580e Reviewed-on: http://codereview.qt.nokia.com/2735 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Show header/footer if current index is set to first/last item or rowBea Lam2011-08-051-0/+12
| | | | | | | | Task-number: QTBUG-17853 Change-Id: I1d679cee31d6ee2a4bb2f2bf90f73eb12898189b Reviewed-on: http://codereview.qt.nokia.com/2664 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* ListView with StrictlyEnforceRange skips over itemsMartin Jones2011-08-051-1/+3
| | | | | | | | | | | | | | When list item size varies smaller items next to larger items may not be able to become the current item. Ensure the snap item is found using the correct range, i.e. half of previous item above snap pos and half of next item below. Change-Id: I52ae235e6b801bda48fcb636bb4150ab643715e8 Fixes: QTBUG-20745 Reviewed-on: http://codereview.qt.nokia.com/2650 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Fix ListView refill() where delegate size == 0Bea Lam2011-08-041-0/+2
| | | | | | | | | | | | | | | When refilling, if a delegate item is positioned at the start of the buffer, it should only be removed if its height is > 0. Otherwise refill() will constantly remove it in removeNonVisibleItems() and add it again in the next frame in addVisibleItems(). Regression from aa99d4f5cb4f1f512d1db90536752b518dbea449 Task-number: QTBUG-20712 Change-Id: I21d25fde21e0b559a378c9e202ace58947417a4d Reviewed-on: http://codereview.qt.nokia.com/2541 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Views with no delegate crash when items are inserted.Martin Jones2011-08-021-3/+3
| | | | | | | | | | | Check that we have a valid VisualModel before reacting to model changes. Change-Id: I6107e8fb8942a3625e501ab549a337f1affd4fbd Fixes: QTBUG-20640 Reviewed-on: http://codereview.qt.nokia.com/2481 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Call base class init() from QSGListViewPrivateBea Lam2011-08-021-0/+7
| | | | | | | | | | | | | | | | Regression from 9b5f9c8056186c9cf3c40dbac66e5f90369339dc when QSGItemView was created. Also fixed other reimplemented methods in QSGListViewPrivate to call their base class functions (which are currently empty) and changed some virtual methods in QSGItemViewPrivate to non-virtual where they didn't need to be virtual. Task-number: QTBUG-20679 Change-Id: I489593b3eab4f5bbb4126906f170342d1e8811cd Reviewed-on: http://codereview.qt.nokia.com/2462 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* View highlight could stop tracking currentItem.Martin Jones2011-08-021-3/+8
| | | | | | | | | | | | | This happens if the currentIndex is changed while the view is moving. The only time the highlight should not move to the currentItem is in StrictlyEnforceRange mode when the user is moving the view. Change-Id: I4d04174c88cde180f9f8a01cbd33af3edbcc3d4d Fixes: QTBUG-16936 Reviewed-on: http://codereview.qt.nokia.com/2416 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* ListView doesn't show new 1st item currentItem is removed.Martin Jones2011-07-281-10/+10
| | | | | | | | | | | | | If the new 1st item becomes the currentItem after removal it was positioned incorrectly because the currentItem is positioned based on visibleIndex, which was updated after the currentItem was updated. Move visibleIndex update before currentItem update. Change-Id: Iaf92a41eefe7bce093e3000d17f5496dba144bcd Fixes: QTBUG-20575 Reviewed-on: http://codereview.qt.nokia.com/2316 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Fix moving of multiple items, and moving items backwardsBea Lam2011-07-281-10/+11
| | | | | | | | | | | | | | To fix backward movements, all backward movements are now flipped into forward movements (as is done in ListModel implemenation). Movement of multiple items wasn't working as views weren't removing the right indexes in these cases. Task-number: QTBUG-19208 Change-Id: I9866ddabc241c066bb77329a6761d500d79aaf61 Reviewed-on: http://codereview.qt.nokia.com/2262 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* The views have many +/- 1 which are causing errors.Martin Jones2011-07-281-20/+19
| | | | | | | | | | | Remove them all. endPosition() etc. now refer to the position() + size() rather than position() + size() - 1. Change-Id: I6ddf98def39971ee2e2c3c2d0a1df97781290782 Fixes: QTBUG-20020 Reviewed-on: http://codereview.qt.nokia.com/2243 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Fix positioning of items after moveBea Lam2011-07-281-3/+10
| | | | | | | | | | | | | | | | | | | | | | If a move happened after a contentY change but before a refill, the position of the first visible item wasn't calculated correctly. If the first item from visibleItems was above the content start position and a move operation caused the items below it to move away, this first item was not being moved to the correct position (i.e. above the next available visible item) causing the following visible items to be positioned incorrectly on the next refill. ListView supported this previously but only adjusted positioning for items before the content position, instead of for all moved items. Fixed for both ListView and GridView and added more move-related tests. Task-number: QTBUG-20528 Change-Id: I2ba1a2f5e49f790e694c6e1486f649f10d09c256 Reviewed-on: http://codereview.qt.nokia.com/2261 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't move view content position item 0 is being replacedBea Lam2011-07-281-0/+14
| | | | | | | | | | | Usually if item 0 moves down, the next item becomes the first visible item and all content moves down. Don't do this if another item is moving up to take its place. Change-Id: If625cfc0eaa70fd1094c7bc0fdd29f5f56766a42 Reviewed-on: http://codereview.qt.nokia.com/2260 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add headerItem and footerItem properties to views.Martin Jones2011-07-261-1/+10
| | | | | | | | | Fixes: QTBUG-19684 Change-Id: Iea7d4a4f902cc45cb0cca8e1221fdb993f0bebd2 Reviewed-on: http://codereview.qt.nokia.com/2151 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Always position headers at a negative positionBea Lam2011-07-211-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | Previously headers were either positioned at 0 if there were no items in the view, or at (0 - headerSize) if items were present. With this fix they are always positioned at (0 - headerSize) to be consistent. Due to the change, setPosition(-headerSize()) is now called from componentCompleted() to ensure the header is visible. This change also fixes GridView's header and footer positioning in TopToBottom + RightToLeft mode. Also added extra tests for header and footer positioning and fixed incorrect test value in tst_QSGGridView::positionViewAtIndex() (was 460 instead of 430 because previously rowPosAt() always added the header size, so if positionViewAtIndex() jumped past all visible items and caused them to be released, the new items started at +headerSize() instead of 0). Change-Id: I1015bed457d4ae964a7fb13702e2dfc470a168a9 Reviewed-on: http://codereview.qt.nokia.com/1618 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Make lastPosition() result consistent among GridView and ListViewBea Lam2011-07-211-14/+3
| | | | | | | | | | | | | | | | | | | lastPosition() returns the end position of the last item so it should always include a -1 calculation for the last item (as FxListItemSG::endPosition() and FxGridItemSG::endPosition() do) to get the last edge pixel of the item. With this fix, both views now calculate startPosition() and endPosition() in the same way. This also fixes positioning of GridView items in TopToBottom+RightToLeft layouts. Incorrect test values in positionViewAtIndex_rightToLeft() test are fixed (the last edge of a 1-pixel border shouldn't be visible, since the bottom edge of a 1-pixel border is actually drawn outside, not inside, the Rectangle). Change-Id: I253c3836f871c61e13c08f67007ebc75e09378d6 Reviewed-on: http://codereview.qt.nokia.com/1547 Reviewed-by: Bea Lam <bea.lam@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Refactor ListView and GridView implementationsBea Lam2011-07-201-1661/+518
| | | | | | | | | Places common code into QSGItemView. Change-Id: Ic310dbe7e16774163ba393860da64a0da7d4ea0a Reviewed-on: http://codereview.qt.nokia.com/1200 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Update licenseheader text in source files for qtdeclarative Qt moduleJyri Tahtela2011-07-081-17/+17
| | | | | | | | Replace old license header with correct one. Change-Id: I492ddaaa0227b2c8faf11bdcd6e12e7231a54a10 Reviewed-on: http://codereview.qt.nokia.com/1312 Reviewed-by: Jyri Tahtela <jyri.tahtela@nokia.com>
* Doc: Cleaned up the scene graph documentation a little.David Boddie2011-06-091-1/+0
|
* Update SG items with recent GV item changes.Martin Jones2011-05-301-6/+13
| | | | Change-Id: Ib9cadea91ab3717bee0caf2071102a100e81969d
* Update SG items with GV item changes.Martin Jones2011-05-041-9/+33
|
* Set ChildenDoNotOverlap flag on grids, lists and positioners.Kim Motoyoshi Kalland2011-05-021-0/+1
| | | | | | QSGGridView, QSGListView, QSGRow, QSGColumn, QSGGrid and QSGFlow now all set the ChildrenDoNotOverlap flag which allows the scene graph to render nodes in a more optimal order.
* Initial import from qtquick2.Qt by Nokia2011-04-271-0/+3032
Branched from the monolithic repo, Qt qtquick2 branch, at commit a4a585d2ee907746682846ae6e8a48e19deef469