Newbie: QTable Questions - Part II

Boudewijn Rempt boud at valdyas.org
Tue Apr 30 03:05:16 EDT 2002


Jeff Layton wrote:

> Hello,
> 
>    I'm in the midst of learning PyQT (and python more in-depth).
> I haven't found much if any documentation about QTable for
> PyQT. Andrew Dalke helped me get started (and pointing out
> that in my panic I forgot to sit down and think :). Now I want to
> modify the appearance of my table created with QTable. In
> particular, I want to change the :
> 
> (1) column headers (via QHeader I think)

QHeader.addLabel.

> (2) change the column width and row height

I think that you need QHeader.resizeSection or 

QTable.setColumnWidth, QTable.setRowHeight

> (3) Make the cells read-only

QTableItem.EditType or QTableItem.setEnabled

> (4) Change the color of text in the cells (and maybe the background
>     of the cells as well).

Subclass QTableItem.paint, and pass a different colour group to the
parent function.

> 
> Could a kind soul give me a kick in the pants to get me started?
> 

A kick, eh? Well, I must say I haven't tried all this; it's just
straight from the Qt documentation. You might run into some bugs
because this is relatively little testes. I still want to use QTable
in my Kura project, but I got side-tracked by a little language 
generator project and an editor :-).

-- 
Boudewijn Rempt | http://www.valdyas.org



More information about the Python-list mailing list