[PyKDE] QTableWidget vs. QTableView

Andreas Pakulat apaku at gmx.de
Tue Jun 20 15:21:41 BST 2006


On 20.06.06 15:15:05, bastian salmela wrote:
> 
> I'm trying to create my own subclass from QTableWidget, but no matter what I 
> try, I always end up with just white blank area, no table grid at all. I then 
> tried to create it from QTableView and it works. 
> is this QT or PyQT bug? or am I just doing it wrong? 
> here is simply how I had it subclassed with QTableWidget (just for testing).. 
> shouldn't that already display atleast something? 
> class bbVuoroTaulu(QtGui.QTableWidget):
>   def __init__(self, parent=None):
> 	QtGui.QTableWidget.__init__(self, parent)
> 	self.setRowCount(8)
> 	self.setColumnCount(2) 

The following code works perfectly here:

>>> from PyQt4.QtGui import QApplication,QTableWidget
>>> import sys
>>> class mytable(QTableWidget):
...   def __init__(self, parent=None):
...     QTableWidget.__init__(self, parent)
...     self.setRowCount(8)
...     self.setColumnCount(2)
...
>>> app=QApplication(sys.argv)
>>> t=mytable()
>>> t.show()
>>> app.exec_()

Shows a table with 2 columns and 8 rows. I think the error is somewhere
else in the rest of your code...

Andreas

-- 
You will be surprised by a loud noise.




More information about the PyQt mailing list