Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Item order in QAbstractItemModel and QTreeView
rherzog last edited by
how can I change the order my items the QTreeView that is backed by a custom Implementation of the QAbstractItemModel?
Do I have to override the two methodes
@bool QAbstractItemModel::removeRows ( int row, int count, const QModelIndex & parent = QModelIndex() ) [virtual]@
@bool QAbstractItemModel::insertRows ( int row, int count, const QModelIndex & parent = QModelIndex() ) [virtual]@
so that I can call "removeRow" and "insertRow" on the model?
As far as I know I just have to alter the model apropriately and the view gets updated by the model automatically.
kind regards for your help, reinhart
andreyc last edited by
Take a look on "QAbstractProxyModel":http://qt-project.org/doc/qt-5/qabstractproxymodel.html and "QSortFilterProxyModel":http://qt-project.org/doc/qt-5/qsortfilterproxymodel.html
I have not used them but from the doc it sounds like QSortFilterProxyModel is what may help you.