[PyKDE] Aligning Text in a Table
Simon Edwards
simon at simonzone.com
Sun Jun 29 21:42:01 BST 2003
Hi,
On Sunday 29 June 2003 01:00, Bob Parnes wrote:
> I did not read your post carefully enough and thought that I had to make
> the call to paintCell. However, it is confusing, because now I do not
> understand the purpose of the arguments beyond the row and column.
The other args specify if the cell is selected (and therefore should be drawn
in the selected state) and which colours should be used etc.
> Anyway, I did manage to successfully draw an example, so long as the
> code was in the paintCell implementation.
That is correct.
> But I could not write
> to the table at a later time.
* BobTable stores the contents of the cells somewhere. (array of strings if
the cells hold strings etc).
* paintCell() looks up the contents of the cell (i.e. grab it's string
contents) and draws the string on the QPainter object.
* BobTable has a method for changing a cell's contents (i.e.
setStuff(row,col,newstring) )
* setStuff() modifies the internal array of strings (cell contents) and then
calls QTable's updateCell(row,col). This tells Qt to repaint (redraw) that
cell.
* When Qt is ready. Qt will call paintCell() for any cells that need
repainting.
For a C++ example of how to do this kind of thing look at Guarddog's
checktablelistitem.cpp file:
http://www.simonzone.com/software/guarddog/
cheers,
--
Simon Edwards | Guarddog Firewall
simon at simonzone.com | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."
More information about the PyQt
mailing list