Further investigation into the bug...

In QAbstractProxyModel::headerData, it creates a proxyIndex to map the 
requested section into the source section.

Unfortunateluy, the call proxyIndex = index( 0, section ) assumes there is a 
row 0, ie, a non-empty model.

The proxyIndex is set to an invalid index (-1, -1), hence the sourceSection is 
determined to be -1...

Thus the call to the sourceModels headerData on the section returns 0

The workaround, for my custom filter model is to simply skip the proxy model 
for the header data and just call the sourcemodel since I know I don't filter 
based on columns.

Based on my analysis, I do not think its limited to QSqlTableModel as much as 
it will occur when ever the source model has NO rows.

Scott
From: [email protected] 
[mailto:[email protected]] On Behalf Of Scott 
Aron Bloom
Sent: Tuesday, February 12, 2013 8:09 PM
To: qt-interest ([email protected])
Subject: [Interest] Further 4.X releases?

So here is my problem, I have found a bug when QSortFilterProxyModel with a 
QSqlTableModel as the source model.
The problem, I currently at a 4.8 based system, and the plan for 5.0 migration 
isnt soon...

Will there be another 4.8 or in order to get a fix, I have to submit it against 
5.X and Ill never see a fix I can use till I move to 5.X?

The bug, btw, if the orignal SQL model has zero results, the horizontal header 
goes to all "0" because the filter proxy model doesn't do the proper mapping 
for headers from the record.

Scott
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to