[PyQt] overriding QSqlRelationalTableModel's data method
frankel at circlesfx.com
Sun Apr 4 01:16:25 BST 2010
On Apr 2, 2010, at 5:05 PM, Scott Frankel wrote:
> I'm hoping to be able to adapt a QSqlRelationalTableModel object to
> display only specified item rows directly. Using the view's
> setRowHidden() method is proving clunky.
Apologies in advance for taking up more bandwidth with this data model
I'm having a chicken-egg problem with retrieving data from my
subclassed QSqlRelationalTableModel object.
If I try to retrieve a record using the model's record() method with a
row argument, I get recursion errors: RuntimeError: maximum recursion
item = self.record(index.row()) # causes recursion errors
Following example code for custom models [Summerfield chapt 14] and
reviewing the select function in qsqlrelationaltablemodel.cpp, I've
tried overriding the model's select() method and populating a list
with item objects:
item = self.items[index.row()] # overriding select() masks
For some reason, overriding select in my QSqlRelationalTableModel
subclass prevents the data() method from being called.
Is there another way to both retrieve SQL data and manipulate which of
it gets displayed in a view?
More information about the PyQt