CardView with model



  • Hi,

    is there a way to display a model (e.g. QStandardItemModel) in some sort of cardview like the task menu of WebOS? It should be a horizontal list and if I swipe to left or right the previous or next item of the model should be shown.

    Any ideas?

    thx



  • One approach would be to make a very simple QML component utilising a ListView element. Then you can embed this in either your QML scene or instantiate it using QDeclarativeView if you are using a widget based UI.



  • Thank you for your reply.
    I am not sure if I understand this correctly but a ListView scrolls vertically as far as I know.

    The image below shows the card views of WebOS. Each card should be based on a simple qml file but with different content (from the model)

    !http://www.nexave.de/nachrichten/wp-content/uploads/2009/02/unbenannt-5.jpg(WebOS)!



  • You can set a ListView to horizontal.

    @
    ListView {
    id: myList
    orientation: Horizontal
    ...
    }
    @

    WIth a suitable delegate that should get the effect you are after.



  • Thank you very much. Sounds good.



  • Another option is a PathView but that is more appropriate when you want something other than linear motion of the items.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.