[PyQt] Master-detail relationship with plain QTableView tables (no SQL database)

Mark Summerfield list at qtrac.plus.com
Thu Jun 17 18:00:25 BST 2010

On 2010-06-14, Vadym Honcharuk wrote:
> thank you, Mark!
> one more question about applying filter in the context of
> QSortFilterProxyModel:
> Question what method is analog of SQL setFilter() in context of
> QSortFilterProxyModel?

There are two approaches you can take with QSortFilterProxyModel. The
easiest is to just create an instance and then use the setFilter*()
methods. Alternatively, create a QSortFilterProxyModel subclass and
reimplement filterAcceptsRow() returning True for rows that should be
accepted and False for those that should be dropped.


BTW I devote four chapters of my forthcoming book, "Advanced Qt
Programming", to Qt's model/view classes---the book is C++-based but
many of the concepts and idioms can easily be translated into PyQt.

Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Advanced Qt Programming" - ISBN 0321635906

More information about the PyQt mailing list