简体   繁体   English

如何在C ++中为Qml创建自定义列表?

[英]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). 我想创建一个在Qml中使用的自定义列表(我想要一个分页的流列表,如MacOS的Launchpad)。 I want to implement it using C++ because of performance. 由于性能,我想使用C ++来实现它。
Can anyone advise me how to start to implement a custom list in C++ for using in Qml? 谁能建议我如何开始在C ++中实现在Qml中使用的自定义列表?

Thank you 谢谢

There is good enough official documentation about using models in QML. 有关在QML中使用模型的足够好的官方文档。 First of all you need to know what is Model-View approach -- Models and Views in Qt Quick . 首先,您需要了解什么是模型视图方法-Qt Quick中的模型和视图 Later on you can see exactly what you want here: Using C++ Models with Qt Quick Views . 稍后,您可以在此处确切地看到所需内容: 将C ++模型与Qt快速视图结合使用 My recommendation for you (as for beginner) is to look more precisely at QObjectList-based model . 我对您(对于初学者)的建议是更精确地研究基于QObjectList的模型

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 我也准备了一些工作实例,可以用作您的起点-https: //github.com/troyane/StackOverflow-pro/tree/master/custom-list-for-qml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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