Hello, I have implemented a lazily populated treeview by subclassing QAbstractItemModel. The implementation looks something like:
https://gist.github.com/gnufied/db9c4d805e2bb24d8c23 (I am not pasting code inline, so as to mess with messaging) It is basically a tree representation of hierarchical data stored in table. Now, I want users to be able to sort the rows based on columns. Where columns are, "count" or "reference count". These values are basically integers. The implementation on its own works, until I throw in QSortFilterProxyModel and I start to get lots of empty rows in the view. The hard problem is, this tends to happen only when I have lots of rows (like thousands or so). The code for implementing sorting proxy is: rootItem = RBKit::SqlConnectionPool::getInstance()->rootOfSnapshot(snapShotVersion); model = new RBKit::HeapDataModel(rootItem, this); proxyModel = new SortObjectProxyModel(this); proxyModel->setSourceModel(model); ui->treeView->setModel(proxyModel); ui->treeView->setSortingEnabled(true); I have subclassed QSortFilterProxyModel class and subclass implementation is really simple: https://gist.github.com/gnufied/115f1a4fae3538534511 The documentation does say - "This simple proxying mechanism may need to be overridden for source models with more complex behavior; for example, if the source model provides a custom hasChildren <qthelp://org.qt-project.qtcore.531/qtcore/qsortfilterproxymodel.html#hasChildren>() implementation, you should also provide one in the proxy model." But beyond that, I am not sure - what I am missing.
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
