I made some complex list models in the past using QAbstractListModel, and they worked great in QML. However I watched a talk with Adenilson Calvacanti on Qt Dev days 2012 where he had made a generic model in C++.
http://www.youtube.com/watch?v=m_-8B4acawE&list=PLizsthdRd0YzYe5T3Txgg7TUGVi-ijq4d&index=14
The source can be found here:
https://code.google.com/p/cellardoor/source/browse/?r=cd45960b47d3e9ae74132b56a54c727dd8c8c307#git/src
Take a look at genericmodel.cpp and controller.cpp especially. The basic idea is that you just use the genericmodel class in your code and forget about how to implement QAbstractListModel yourself. I have not tried this, but will eventually when I find the need.
I hope this might help you.
↧