[PyKDE] Tableitem center text + font size

Dave S eric3 at pusspaws.net
Thu Sep 7 19:51:01 BST 2006


My project (and learning adventure !) continues ...

(1) How do I center text in a TableItem ? I realize that I need to set an 
alignment flag ie AlignHCenter but am struggling to do so. My QT3 docs 
say ...

The Qt class is a namespace for miscellaneous identifiers that need to be 
global-like. Normally, you can ignore this class. QObject and a few other 
classes inherit it, so all the identifiers in the Qt namespace are normally 
usable without qualification. However, you may occasionally need to say 
Qt::black instead of just black, particularly in static utility functions 
(such as many class factories). See also Miscellaneous Classes.

I have tried many different ways of getting centralization to work including 
self.AlignHCenter() which fails with  

 File "./view2.py", line 75, in DispErrorHeader self.AlignHCenter()
TypeError: 'AlignmentFlags' object is not callable
QGVector::remove: Index -3 out of range

I am trying to centralize in the context of ...

    def DispErrorHeader(self, row):
        self.tableitem = ModTableItem(self.table1, QTableItem.Never, 'Errors')
        self.AlignHCenter()
        self.tableitem.SetColors(Qt.red, Qt.gray)
        self.table1.setItem(row, 0, self.tableitem)
        self.tableitem.setSpan(1,2)

Any Suggestions

(2) How do I enlarge the font of text in a TableItem - and possibly 
invoke 'bold' ? I have to admit I have been mainly banging my head against 
the alignment problem but this will be my next hurdle - I would appreciate a 
pointer :)

Many thanks in advance

Dave





More information about the PyQt mailing list