Details
-
Task
-
Resolution: Done
-
P2: Important
-
None
-
None
Description
The ListView content is sometimes laid out from bottom to top order, for example in Conversational messaging. Just reversing the items is not enough, as the initial position of the view, and the addition and the removal of items from the list view will still be behave in top-to-bottom directed way.
So instead of having to write
import QtQuick 1.0 ListView { id: conversationList model: reversedModel // make sure view is positioned at the bottom of the view on startup Component.onCompleted: conversationList.positionViewAtIndex(model.count-1, ListView.Beginning); } Button { onClicked: { // add new message to conversation, last item is the latest conversationList.model.append( { "message": inputField.text, "contact": "Jake" } ); // make sure the new conversation is visible conversationList.positionViewAtIndex(model.count-1, ListView.Beginning); } }
it would nice to be able to write
import QtQuick 1.0 ListView { id: conversationList flow: ListView.BottomToTop model: myModel // no need to reverse order of data in the models for the presentation } Button { onClicked: { // add new message to conversation, first item is the latest myModel.insert(0, { "message": inputField.text, "contact": "Jake" } ); } }