[PyKDE] [PyQt3] alignment issue on subclassed QTableItem

Hans-Peter Jansen hpj at urpla.net
Fri Aug 25 00:58:19 BST 2006


Hi PyQties,

I'm struggling with a strange effect in a subclassed QTableItem. For 
clearness reasons, I need a centered checkbox table item without text 
label.. 

First, I based my implementation on QCheckTableItem with only the paint 
method reimplemented, where I centered the checkbox. This worked fine 
as long as the field doesn't get any focus. Then the checkbox appears 
on the left again :-(. Studying Qt's source, it revealed, that this 
effect is due to a QCheckBox being created in createEditor(), which 
paints that way. 

Later I based by subclass on QTableItem with all important methods 
reimplemented. As you can see, I tried to circumvent the QCheckBox 
alignment issue with adding a stretched hbox layout to the field, but 
that approach, ugly as it is, doesn't seem to have any visual effects 
at all..

Even funnier, using the alternate edit type QTableItem.Always in ctor, 
the valueChanged(int, int) signals row/col values turn invalid 
(-1, -1).. Oh well. 

Obviously I'm stuck. Searching the Qt interest archives, it appears, it 
already nagged on other people brains, but doesn't provide a solution 
either.

I really hope, I do not have to reimplement QCheckBox/QButton for 
getting this to work.

May some brighter soul gives me a touch with his/her cluestick..

TIA,
Pete

SuSE 9.3/i386 with:
Python version: 2.4
sip version: 4.4.5
Qt version: 3.3.6
PyQt version: 3.16
-------------- next part --------------
A non-text attachment was scrubbed...
Name: checktableitem.py
Type: application/x-python
Size: 4002 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060825/0e9478d5/checktableitem.bin


More information about the PyQt mailing list