简体   繁体   中英

How can I create a custom list in C++ for Qml?

I want to create a custom list for using in Qml (I want a paginated flow list like MacOS's Launchpad). I want to implement it using C++ because of performance.
Can anyone advise me how to start to implement a custom list in C++ for using in Qml?

Thank you

There is good enough official documentation about using models in QML. First of all you need to know what is Model-View approach -- Models and Views in Qt Quick . Later on you can see exactly what you want here: Using C++ Models with Qt Quick Views . My recommendation for you (as for beginner) is to look more precisely at QObjectList-based model .

Also I prepared little working exaple which can be used as starting point for you -- https://github.com/troyane/StackOverflow-pro/tree/master/custom-list-for-qml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM