Batch view changes instead of applying them immediately
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>