[PyKDE] python qtable

Gordon Tyler gordon at doxxx.net
Thu Jan 30 19:45:01 GMT 2003


Sandeep C wrote:
> I have a QTable in place, how do i dynamically add and delete data to
> the table? 

   self.tblTable.setItem(row, column, item)

Where item is an instance of QTableItem or one of its subclasses, 
QComboTableItem and QCheckTableItem.

Or:

   self.tblTable.setText(row, column, string)

Read the docs, it's all there: http://doc.trolltech.com/3.1/qtable.html

 > Also how do i set the title of the columns?

self.tblTable.horizontalHeader().setLabel(index, title)

>     def updateTableView(self,schema):
>          header = self.tblTable.horizontalHeader()
>          count = header.count()
>          for i in range(count):
>              header.removeLabel(i)

The line above should be: header.removeLabel(0)

Ciao,
Gordon





More information about the PyQt mailing list