[PyKDE] Aligning Text in a Table

Bob Parnes rparnes at megalink.net
Sun Jun 29 23:18:00 BST 2003


On Sun, Jun 29, 2003 at 09:39:20PM +0200, Simon Edwards wrote:
> 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."
> 
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Thanks. I just downloaded guarddog and will look it up.
-- 
Bob Parnes
rparnes at megalink.net




More information about the PyQt mailing list