[PyKDE] alignment in table
Jim Bublitz
jbublitz at nwinternet.com
Fri May 12 21:54:00 BST 2006
On Friday 12 May 2006 13:22, you wrote:
> Thank you! but I have used QTable item together with setText. I added
> this method to the subclass of QTable and call it. I got no error
> while the table still looks like before.
>
> Still I appreciate if somebody can help!
> thanks.
You need to do something like this:
--------------------
class AlignTableItem (QTableItem):
def __init__ (self, table, et):
QTableItem.__init__ (self, table, et)
def alignment (self):
return Qt.AlignCenter
tbl = QTable (...)
tableItem = AlignTableItem (tbl, QTableItem.OnTyping)
tableItem.setText ("Foo")
tbl.setItem (row, col, tableItem)
--------------------
Alignment is a property of the QTableItem, not QTable (although you could
subclass QTable so that it creates AlignTableItems for cells instead of
QTableItems, and there are other ways you can make the whole process easier
to code).
Jim
More information about the PyQt
mailing list