| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 7 | |
Greetings, I have an SQL query that returns several fields, the first of which identifies a group to which a given record belongs. I want to display that in a control similar to QTableView, which would have buttons to expand/collapse groups. Like this: 1 hello 1 world 2 test should look like [-] 1 ...... hello ...... world [+] 2 Is it possible with QTableView or QTreeView and with SQL models? -- [ signature omitted ]
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
Roman Odaisky wrote: > Greetings, > > I have an SQL query that returns several fields, the first of which identifies > a group to which a given record belongs. I want to display that in a control > similar to QTableView, which would have buttons to expand/collapse groups. > > Like this: > > 1 hello > 1 world > 2 test > > should look like > > [-] 1 > ...... hello > ...... world > [+] 2 > > Is it possible with QTableView or QTreeView and with SQL models? > > You basically want a Pivot Table. This is possible by writing your own proxy model that will group the table rows and provide the appropriate parents. This model will stand between your QSqlModel and the QTableView. It's not trivial, but it's doable with some effort. Start with a subclass of QAbstractProxyModel --Justin
begin:vcard
begin:vcard fn:Justin Noel n:Noel;Justin org:ICS;Engineering adr:;;54B Middlesex Trpk.;Bedford;MA;01730;USA email;internet:justin@xxxxxxx title:Sr. Consulting Engineer / Certified Qt Instructor tel;work:617-621-0060 x-mozilla-html:FALSE url:www.ics.com version:2.1 end:vcard