[Interest] how to use the QAbstractProxyModel for different parts of the data of the source model?

ZHONG Zhu Zhu.Zhong at alcatel-sbell.com.cn
Fri Sep 13 10:32:45 CEST 2013


I have below response and would like to display all these <book> elements in a QTableView, and the <summary> in a QTreeView.
So the summary tree view will be like:
+--Type
       +---fiction (2)
       +---comics (3)

That way when user click fiction or comics I can filter that QTableView to display filtered items accordingly. I've already create a tablemodel to show <book> items in QTableView. Guess I'll need another model for the QTreeView, but can I use a QAbstractProxyModel to wrap my tablemodel so that I don't have 2 copies of the same source data?
-------------
<books>
    <summary>
        <type>
            <fiction>2</fiction>
            <comics>3</comics>
            ...
        </type>
    </summary>
    <book>
        <type>fiction</type>
        <title>haha</title>
        <author>xxx</author>
        ....
    </book>
    ...
    <book>
        <type>comics</type>
        <title>hihi</title>
        <author>xxx</author>
        ....
    </book>
</books>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130913/4782714a/attachment.html>


More information about the Interest mailing list