[PyQt] Multi-sectioned QTableWidget capability...

David Boddie dboddie at trolltech.com
Wed Jan 23 16:08:32 GMT 2008

On Wed Jan 23 15:01:20 GMT 2008, Aaron Digulla wrote:

> Vince Fulco schrieb:
> > Dear PyQt experts-
> > 
> > Can someone point me to a good working example of a QTableWidget with
> > multiple sections built into one table.  I.E. I would like to display
> > raw observations, a set of summary data underneath it and a second set
> > of different summary data underneath that.
> How about putting three different tables in a large scrollable canvas
> and disable the scrollbars for each table?
> Or use an MDI-like approach where you put each table into it's own
> window and add a button to arrange them below each other. That would
> allow to scroll through the raw data, while comparing it to the summary
> (which would be visible at the same time).

Or an "advanced" approach might be to put the data in a model as children
of top-level items, then use a QTreeView to display it. The top-level items
could be styled differently to resemble headers. That might be a bit tricky
to implement if you're familiar with QTableWidget, though.

It depends on whether you want to keep support for editing and table-like
functionality, or whether the table is just there for display purposes.

David Boddie
Lead Technical Writer, Trolltech ASA

More information about the PyQt mailing list