Commit Graph

64 Commits

Author SHA1 Message Date
Nils Jeisecke 290dc6caf6 Fix currentIndex in Qml itemView when assigning an empty model
When assigning an empty model to e.g. a ListView after component
initialization has been completed, currentIndex is now correctly
set to -1.

Change-Id: I540c034944009ccb8894bf84f400658ef9f0371f
Task-number: QTBUG-32838
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-08-16 18:11:23 +02:00
Albert Astals Cid 3f01f6ff03 Resizing items out of the list viewport should not change the viewport
Consider the old geometry, not the new one to check if an item
was outside the viewport or not

Change-Id: I108412d560faf86130044f3d091254c07af0c004
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-07-24 11:30:40 +02:00
Alan Alpert 53e3174686 No longer apply pending changes when accessing ItemView properties
Applying changes in the getters can lead to binding loops, and is
currently inconsistently applied. Removing the applyPendingChanges calls
from remaining getters, and adding a forceLayout() function for cases
where the immediate-apply behavior is needed.

Task-number:  QTBUG-30555
Parts-of-patch-by: Albert Astals Cid
Change-Id: I64632601e02f2a53060296ab7739577a749d916f
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
2013-04-26 21:17:42 +02:00
Sergio Ahumada d815621963 Merge branch 'dev' into stable
This starts Qt 5.1 release cycle

Change-Id: I6178a580b4c99aded1a69032a02169cff502b71d
2013-03-20 09:14:33 +01:00
Caroline Chao 9b25a6f39e QQuickItemView: Add guard before returning currentItem item
And don't check if the currentItem is empty before calling
applyPendingChanges().

And an autotest. (Patch from Steffen Imhof)

Task-number: QTBUG-30227

Change-Id: Ia16362a6d0dce771f20772929c32e9306ed0e0f9
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-03-19 19:44:10 +01:00
Frederik Gladhorn 15dc45ce10 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ia02971527a2d1a80c5624d69330428818aab3a41
2013-02-25 11:57:50 +01:00
Michael Brasser 523bf6c3d0 ListView's highlightMoveDuration should default to -1.
Change-Id: Ibb53cc21b4f1f301569cd7724c60cb8df978921a
Reviewed-by: Bea Lam <bea.lam@jollamobile.com>
2013-02-22 14:35:10 +01:00
Alan Alpert 7cad0e52c5 Move the model classes from QtQuick to QtQml
This is needed for proper support of non-GUI instantiators in QtQml.
Only private C++ classes are affected. Aside from name changes, model
classes now operate on QObjects instead of QQuickItems, leading to minor
changes in the implementation of QtQuick classes using them.

The old QML type names will still be registered in the QtQuick import
for the forseeable future, but pointing to the new classes. The new QML
types will be added in a second commit.

Classes Affected:
QQuickVisualDataGroup -> QQmlDataGroup
QQuickVisualDataModel -> QQmlDelegateModel
QQuickVisualItemModel -> QQmlObjectModel
QQuickVisualModel -> QQmlInstanceModel
QQuickChangeSet -> QQmlChangeSet
QQuickListAccessor -> QQmlListAccessor
QQuickListCompositor -> QQmlListCompositor
QQuickPackage -> QQuickPackage (just moved for now)

Change-Id: Ia19e630e53bfa9e5d459e289596cd11df1ea3930
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
2013-01-24 17:14:23 +01:00
Alan Alpert bbb3d5b403 Move ListModel and ListElement to the QtQml import
They're already in the QtQml module, but were left in the QtQuick import
because they were considered to be of minimal use without QtQuick types.

QtQml types are being developed would could make ListModel useful
without QtQuick, indicating that they should no longer be considered
QtQuick depedent.

Change-Id: I31499f2cc23baf4bc70fb451ba164408bed89ff6
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
2013-01-24 17:14:12 +01:00
Sergio Ahumada 83deab8d1b Update copyright year in Digia's license headers
Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76
Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-01-10 19:52:37 +01:00
Friedemann Kleint 5fd1c5fbaf Quick tests: Introduce QQmlMessageHandler.
Add QQmlMessageHandler class that can be used to record messages
into a QStringList. It also makes sure that the old message
handler is reinstalled if the test fails.

Task-number: QTBUG-28611
Change-Id: I0fff7bc11e188cf47178d9573e5f2eead693bc10
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2012-12-20 21:38:38 +01:00
Shawn Rutledge 55f6a109e9 Renamed QQuickItem::pos property to position
Abbreviated property names are less descriptive so we don't have
many of them.  Might as well be consistent.  QWindow::pos was already
renamed.

Change-Id: Ib52673e68e7dc902b2f8942dba6b899074b2538b
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-11-29 16:07:44 +01:00
Shawn Rutledge eba5128f66 All QWindow properties that have "window" in them have been renamed.
Depends on patch Ie4424ec15fbdef6b29b137f90a2ae33f173edd21 in qtbase.

Change-Id: I9614cc2c7ed119c663b3f6f99267483e291e529c
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-11-08 19:04:56 +01:00
Samuel Rødal cca0a173bc Fixed instances of "to to" in qtdeclarative.
Really it should just be "to".

Change-Id: I3263c8d6ce2f0ad33ab12d7ddb9202beac578f91
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-09-24 16:31:03 +02:00
J-P Nurmi 69bd6b5820 tst_QQuickListView::sectionsDelegate_headerVisibility(): restore QSKIP
Task-number: QTBUG-24395
Change-Id: Idd403aa5e81965f4ebf14378b28b47c099a2c487
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
2012-09-24 07:53:00 +02:00
Iikka Eklund 46010aa7a2 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-09-23 08:22:24 +02:00
Kai Koehne 08444bab1b Autotests: Use qInstallMessageHandler
qInstallMsgHandler got deprecated in Qt 5.

Change-Id: Icb6423c7d9f7e507ba36376b0af5ad183379c494
Reviewed-by: Martin Jones <martin.r.jones@gmail.com>
2012-09-14 14:51:47 +02:00
J-P Nurmi 464ff85764 Attempt to fix tst_QQuickListView::sectionsDelegate_headerVisibility()
Task-number: QTBUG-24395
Change-Id: I07b0fc17566e86dcebf913721f293378cf15466b
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Caroline Chao <caroline.chao@nokia.com>
2012-09-06 18:21:32 +02:00
Martin Jones 3a045419ba Add SnapPosition mode to positionViewAtIndex() in List/GridView.
This allows the view to be positioned on a snap boundary, which is
generally what is wanted when strict highlight mode s set or snapping
is enabled.

Task-number: QTBUG-26605
Change-Id: I6288dc8be4ff16c412b56ab449b6a9fb7b7ea889
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-07-27 03:08:24 +02:00
Bea Lam 6de20bbeb3 Remove QSKIP from snapOneItem() test
Past test failures are likely to have been caused by mouse events
passing over from previous tests and causing a double click rather
than a press for a flick. This should pass now as
QQuickViewTestUtil::flick() now calls QTest::mouseMove() instead of
sending MouseMove events to the window.

Task-number: QTBUG-24338
Change-Id: I68f7f3f91d189ed3ead01c8646570c39ba86f1d4
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-07-26 08:57:44 +02:00
Andrew den Exter 7daab8039a Remove QListModelInterface.
Implement ListModel and XmlListModel using QAbstractListModel
instead.

Task-number: QTBUG-15728

Change-Id: I14e03d90883d341f4b1d89c1e9fc9dc1534fde78
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
2012-07-25 02:15:15 +02:00
Martin Jones 22c68738bf Changing model after componentComplete should reset currentIndex
When the model is changed reset currentIndex back to 0.

Task-number: QTBUG-26604
Change-Id: I1934e083819537d416acd85c75362daff382aa04
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-07-23 06:38:28 +02:00
Friedemann Kleint bd618f62d8 QtDeclarative: Remove usage of deprecated qWaitForWindowShown().
- Replace by qWaitForWindowExposed() or
  qWaitForWindowActive() where applicable.
- Use QVERIFY to verify success.
- Stabilize some tests by checking for 'active',
  add missing call to show().

Change-Id: I6cae063e44a3839760ed9f61dacb26cd1717118d
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-07-19 14:37:49 +02:00
Alan Alpert feb996e3ab QQuickCanvas renames
QQuickCanvas is now called QQuickWindow
QQuickCanvas::rootItem is now QQuickWindow::contentItem
QQuickItem::canvas is now QQuickItem::window
QQuickItem::ItemChangeData::canvas is also renamed window
QQuickCanvas::grabFrameBuffer is now QQuickWindow::grabWindow
The functions related to the color property have dropped the clear from
their names.

The first three changes have interim compatibility measures in place to
ease the transition.

Change-Id: Id34e29546a22a74a7ae2ad90ee3a8def6fc541d2
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-07-17 07:26:15 +02:00
Friedemann Kleint 02675dc020 Use qWaitForWindowActive() where it is required.
Prepare a change in qtbase in which the implementation
of qWaitForWindowShown() will be changed to
qWaitForWindowExposed() instead of qWaitForWindowActive().
Try to stabilize further tests by introduing
wait functions instead of calls to qApp->processEvents().

Change-Id: I9825885430d78be1610a3fe20023fad24aaacba9
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2012-07-09 17:36:35 +02:00
Martin Jones baee77ef47 Section headers ignore list delegate size changes when "colliding"
Make section header updates part of the layout process.

Task-number: QTBUG-23298
Change-Id: I4586bc58bc195fcc47f6db79346727eb6e3d3845
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-07-04 03:02:49 +02:00
Bea Lam a5186a2333 Rename ListView *speed properties to *velocity
Change-Id: I63c02d186b1832e7bf890a00caad150d5bf136cb
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-26 08:08:37 +02:00
Andrew den Exter 3bb4880d63 Fix section delegates not updating when changed.
Delete all allocated section items before doing an update when the
section delegate is changed.

Task-number: QTBUG-24899
Change-Id: I09dc7a1c602a49ad7bb37512a7e5116392259457
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-26 08:08:33 +02:00
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