I want to write my own proxy model to "flatten" a tree-like model (i.e. some items might have children items) into a list-like model (i.e. no items have children) by mapping the indices. Subclassing QtGui.QIdentityProxyModel
seems to be the best way: http://qt-project.org/doc/qt-4.8/qidentityproxymodel.html but I cannot find it in PySide 1.2.1 which is built with Qt 4.8 (which includes QIdentityProxyModel
): http://seanfisk.github.io/pyside-docs/pyside/PySide/QtGui/index.html.
So this seems to leave me two options:
subclass
QAbstractProxyModel
orQSortFilterProxyModel
find a way to build PySide myself to include
QIdentityProxyModel
Any suggestions will be appreciated.
I would go for 2) because that would be useful for the posterity as well if you have enough time to get it through.
First you need to build and install shiboken as it is a dependency for building pyside. You can accomplish that as follows:
Once that is done, you start working on pyside as follows:
This is my
git diff
output:After this, you will need to configure, build, and install the project as follows:
I am providing these commands for Unix, but it is easy to adapt for other operating systems like Windows, too.
I am not claiming my patch is perfect, but that is where you could start the experiment. It should not be too hard.
Also, do not forget that there is a third option, using PyQt where this class seems to be supported:
QIdentityProxyModel Class Reference