PDA

View Full Version : qSortFilterProxyModel examples



scott_hollen
12th March 2011, 21:35
Afternoon --

Thanks to some great suggestions I'm converting an app I've written with a standard master-detail architecture over to one that uses QSortProxyModel (mine is based on an record retrieved from the master view and using setfilter() on the detail); while I can add data the way I need to I can't seem to copy data in the details model like I need to...I need to find detail records assigned to one master, create a new master, and point the newly copied detail records to the the new one...This is because of the way setfilter() works

Basically -- unless I switch my DB setup to be denormalized -- I have one Tableview containing my master data and another Tableview containing my detail data (both QSqlTableModels). I've spent a few hours going round and round trying to implement this via a QSortProxyModel, but I've been applying it to my detail model but I think that's wrong, so can anyone point me to an example to follow? I found this link: http://www.qtcentre.org/threads/27815-QSortFilterProxyModel-crash-with-mapToSource()

Should I be following this?

Thanks in advance!


scott

scott_hollen
13th March 2011, 20:07
Nevermind -- got it working...

scott