Commit Graph

36 Commits

Author SHA1 Message Date
Andrew den Exter 4089c2bbc5 Position section headers correctly when section property changes.
Schedule a new layout after the section property is changed to correct
item positions if section headers are added or removed.

Task-number: QTBUG-24900

Change-Id: I7e46ec6dc00e5a810029396a4c5ca4e87ee1d94d
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-26 08:08:32 +02:00
Bea Lam 058a9ca9a2 Isolate unstable test
Change-Id: Id534dc7ff7146799bdb989d8bcf56ca4c0fbeffa
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-06-26 06:14:53 +02:00
Andrew den Exter a8a44e0381 Fix crash in tst_qquicklistview.
Destroy the shared canvas before QGuiApplication is destroyed.

Task-number: QTBUG-26244
Change-Id: I9aa59bae5314f51c84a61821af2fb3c7a1c77941
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-06-26 06:14:53 +02:00
Bea Lam d8dcb8ea98 Revert "Remove properties related to highlight speed"
This reverts commit 18fb5506d5.

Without these properties there's no way to set a constant
movement speed.

Change-Id: I49cd648846f801eb479ecce8cde09ff49ea11736
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-25 08:57:36 +02:00
Bea Lam 40bb33103b Delete canvas created in test
This was causing a crash on exit.

Task-number: QTBUG-23605

Change-Id: I96a38f383a180f8aaf5177ad6d7183f9b0b5e85a
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
2012-06-25 08:57:36 +02:00
Andrew den Exter 530b773dfc Fix crash when dragging items outside visible area.
If asynchronous item creation finishes while the content area of a
ListView has been dragged full outside the visible area a full refill
is triggered which can overwrite the requested index and potentially
result in a single delegate item being assigned to multiple view items
and later being doubly released.  Only create the view item object in
the createItem function to prevent this from happening.

Secondly only reset the visible items if jumping outside the buffer
range rather than just the fill range to prevent churn when the list
only contains buffered items.

Task-number: QTBUG-26232

Change-Id: I5bce845898ef5f699f34afc268594ef38e01d6a3
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-22 12:47:31 +02:00
Bea Lam db3aa0d40b Rename Flickable x/yOrigin to originX/Y
This is consistent with the naming of other x/y properties, e.g.
contentX/Y, relativeX/Y etc.

Change-Id: I5159f8e54a6fda6a1f83a563ea9db47c3b8af238
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-22 08:18:15 +02:00
Bea Lam 18fb5506d5 Remove properties related to highlight speed
ListView should only have duration-type properties (i.e.
highlightMoveDuration and highlightResizeDuration) as it's unnecessary
to have both duration and speed properties for the highlight animation.
(PathView and GridView only have the duration-related properties.)

Change-Id: I1b94599e3e89afe6488ce2a882c2802354a859fe
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-22 08:18:15 +02:00
Friedemann Kleint 58f3f50c43 Fix warnings in declarative tests.
- Unused variables and test data.
- () around operator &&.
- Conversion of false to 0-pointer where QVariant was intended.
- Missing enumeration value.
- Remove duplicated  qqmlecmascript entry from qml.pro
  (has an internal check for no-widgets).

Change-Id: Ie030167e22bce26e3988a4406c630fb460f61a3c
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-06-20 17:22:31 +02:00
Martin Jones 14e15458a5 Fix view delegate parent binding regression.
762b4d9011 introduced a regression by
setting the item parent after completion.  This was to avoid rendering
an incubated object before completion.  However this breaks bindings.

Restore setting the item parent before completion, and ensure items are
not rendered until completed.

Change-Id: Ifc9d0c34ee62e687889c32ffab7c091b4c8cc470
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-06-12 15:40:13 +02:00
Martin Jones 762b4d9011 Performance should always be better with cacheBuffer
Setting a cacheBuffer introduced more work for the scenegraph due to
cached delegates' visibility being toggled.  Changing visibility is
expensive as it is proagated to all children.  Introduce a cheap
method of hiding a branch instead.

Also avoid initiating incubation in the same frame as a completed
creation.

Change-Id: I573bcf37f441f96a7502d445be50ef4301f217d5
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-06-08 06:17:54 +02:00
Martin Jones 47204d2cc9 Clearing a view didn't reset content size.
Ensure that a valid contentHeight/contentWidth is set regardless
of whether there is a valid model.

Change-Id: I546683c7571a1379e3ca2ef285435ad48319e8e4
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-05-31 02:23:04 +02:00
Andrew den Exter 81726bcb8d Fix flicker when changing ListView currentIndex with VisualItemModel.
Return the Referenced flag when the view has outstanding references
otherwise it will attempt to hide an item if believes shouldn't be
visible.

Task-number: QTBUG-25849
Change-Id: I7387ab8322a1cd7f3386685086b2b8ad10c8b4f0
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-05-28 07:17:09 +02:00
Andrew den Exter 2533a40cf2 Fix PathView not updating after all items are removed from the model.
Always clear the layoutScheduled flag on a refill even if there are no
items to create, otherwise future layouts won't be scheduled because
it appears one is already pending.

Fixes an issue in the dragselection example where items that should
have moved to the PathView instead disappeared.

Change-Id: I4302b5b43184c697a78f5c09dc3811326e2271ca
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-05-28 05:30:34 +02:00
Andrew den Exter d4dad3a0b8 Don't parent (QObject) delegate items to views.
This keeps object ownership within the context the items were created
in and simplifies lifetime management as the VisualDataModel has sole
license to delete objects and doesn't have to keep guards against a
view and all it's children being deleted.

Delegates are still reparented in the item heirarchy.

Change-Id: Ife5afdfe294a5a8ca1ca3638a086f72452e4915c
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-05-28 05:30:34 +02:00
Bea Lam 1deba22774 Don't override "z" bindings for header and footer
Headers and footers are given a default z value. This value
should be set between Component beginCreate() and completeCreate()
to avoid overwriting any binding in the header or footer item
that has already set the 'z' value.

Change-Id: I8e3ee97232d99500a32f2d77d2b663016eb404f7
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-05-28 02:39:10 +02:00
Bea Lam 73a5e30f44 Fix xOrigin and yOrigin to always be top-left pos
Currently xOrigin is reversed for right-to-left and yOrigin is reversed
for bottom-to-top. This is wrong since xOrigin and yOrigin come from
Flickable so they should keep that meaning, i.e. the top left corner of
where the content begins, in ListView and GridView.

Change-Id: I88c77fadd1cf784f4b4d62677168b84675e921b0
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-05-14 03:03:36 +02:00
Bea Lam 9a107f47ea Fix content pos adjustment when resizing first item
If visibleItems.first() changes size in a ListView, the size change
should be made in the direction of the content flow. This was not
working correctly for layouts other than the default vertical+LTR
layout. This patch fixes the issue for other layouts and also fixes
resizing of implicitly sized delegates (e.g. positioners) within the
default layout.

Change-Id: Ib1d84ce000a3a341fe617cf644420dc5d589d577
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-05-01 07:34:12 +02:00
Bea Lam a0adcc6480 Only run populate for items in model at creation
Don't run for items added in Component.onCompleted.

Change-Id: I58745ab989efae168d036875cb2fb88e3e2db0c3
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-04-23 08:31:47 +02:00
Bea Lam 0d52c081a1 Vertical layout direction for ListView and GridView
Provide verticalLayoutDirection property with TopToBottom
and BottomToTop values.

Change-Id: If6f0da5dd4735036162868d391852a661854de5b
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-04-17 06:09:56 +02:00
Andrew den Exter 96c0e7e576 Don't ignore model changes when the ListView scroll position changes.
If there are pending changes when the ListView viewport changes then
do a full layout instead of a refill.  Likewise for GridView and when
animations finish or the cacheBuffer size changes.

Change-Id: I57a2b01fee5729381558af366dad24ba26c223ef
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-04-13 08:07:16 +02:00
Martin Jones 4f08f48017 Section comparison should be case insensitive.
Allows use of mixed case model data without having to add a
special role just for sectioning.

Change-Id: I0a747e51542b5bf0f9db8fc2732882928a6cc676
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-28 03:10:14 +02:00
Bea Lam 19977e9686 Buffer changes received during layout()
Otherwise, changes received by a view during layout() may
override the changes that are currently being processed.

Change-Id: Iabc4db682f85ceb7d04c3f7442fb6c98ebdb94f1
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-03-27 09:46:00 +02:00
Bea Lam 80b5612708 Fix margins for right-to-left mode
The behaviour for considering left and right margins was inconsistent
in views with a right to left layout; these values were reversed for
extent calculations but not for general positioning. With this change
the left and right margins are never reversed in a right-to-left layout,
so minXExtent and maxXExtent calculations always use startMargin
and endMargin respectively, regardless of layout direction.

Also fixes calculation of endOffset in trackedPositionChanged() when
in horizontal orientation.

Change-Id: Ie00e3d4c2bd38d8fe6ac0213702206b88bfa895e
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-03-21 08:04:33 +01:00
Martin Jones 6deb3ceffa Resetting a model can cause a crash in views with header/footer.
Geometry listeners were called for deleted header/footer.

Change-Id: I47854178232f8a4ab5e19a931901b49741fec388
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-19 10:49:21 +01:00
Martin Jones f079f789c5 Ensure section header/footer are cleaned up.
If the model is cleared or replaced with an empty one,
the section headers should be released.

Change-Id: Ia2f070c312593743b2c5332a6c69facaf222ee6d
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-19 10:49:05 +01:00
Martin Jones 70ac6b1705 Reuse QQuickView in ListView table driven tests
Makes the tests run faster since we're not waiting for a
window to appear all the time.

Change-Id: Ibff3706873dbad2f92d2135eae260368f4f4bb10
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-13 09:47:23 +01:00
Martin Jones 648c80c4c0 Speed up view flick tests.
Change-Id: I98b0a45b5afd0150bfacef2c1c1e814f70ae042f
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-13 03:24:54 +01:00
Martin Jones a4d22cbb38 ListView.contentHeight does not include header and footer item heights
Task-number: QTBUG-24664

Change-Id: I2a2fe144835e61665b8693d58ca4fb9ba506e8a8
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-13 02:02:49 +01:00
Bea Lam 52d3d361a0 Displaced items were moving unnecessarily
They should only move if they actually change from the last set
position, and not if they are simply changing from their current item
position, as that is wrong during an animation.

This also cleans up some code for resetting the transition data.

Task-number: QTBUG-24586
Change-Id: I0a6635903975ebc40d5cf8398b943a9de92d4493
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-03-13 02:02:49 +01:00
Bea Lam ed74ec4c40 refilled items should be moved immediately
refill() functionality should reposition items immediately, else
removeNonVisibleItems() sees different positions from those added in
addVisibleItems() if an item is animating.

Change-Id: Ib9904e08bf92b18fd4b712270c0ab69e9a113e04
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-03-10 05:47:00 +01:00
Martin Jones b1a301884b ListView can freeze if flicked beyond its bounds.
If the delegate's size changes in componentComplete and all
items are flicked out of view, an incorrect jump calculation
in addVisibleItems() resulted in a new delegate being created
in the wrong position, and retriggering the jump calculation,
which resulted in a new delegate being created in the wrong
position, and retriggering the jump...

Also fixed currentItem visibility.

Change-Id: Iad5f211c4fc5eed9c009d51a0ce3b58181a7b36e
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-03-07 08:42:21 +01:00
Bea Lam 22a53bcd69 Fix setting of target lists when target Transition is not set
Target items are now set from QQuickViewItem::prepareTransition()
instead of QQuickItemView and QQuickPositioner to ensure they are
for a displaced transition even if there is no matching target
transition.

Task-number: QTBUG-24535
Change-Id: I0a6c7e3c6198786527014d421b96fc562c6186dc
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-03-07 06:31:56 +01:00
Bea Lam 14e00670b7 prepareTransition() must cancel current transition
If it does not, itemX() or itemY() will still return the current
transition's 'to' position instead of the nextTransitionTo pos that was
scheduled for the next transition (which the item now has moved to
using the direct setPos() method).

Also refactor prepareTransition() to always move the item directly to
the nextTransitionTo if transition is not going ahead.

Also fix some broken test code.

Task-number: QTBUG-24523
Change-Id: I2e536fbc0da2acbf96fdf2d177190a8968f7fdb1
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-03-07 02:45:21 +01:00
Matthew Vogt 0284817d6c Merge master <-> api_changes
Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
2012-03-05 11:39:54 +10:00
Matthew Vogt b855240b78 Rename QDeclarative symbols to QQuick and QQml
Symbols beginning with QDeclarative are already exported
by the quick1 module.

Users can apply the bin/rename-qtdeclarative-symbols.sh
script to modify client code using the previous names of the
renamed symbols.

Task-number: QTBUG-23737
Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-02-24 04:51:31 +01:00