[PyKDE] PyQt4 Update

David Boddie david at boddie.org.uk
Sun Dec 4 19:46:35 GMT 2005


On Sunday 04 December 15:01:20, Phil Thompson wrote:
> On Saturday 03 December 2005 6:08 pm, Baz Walter wrote:

> > The only very minor issue I came across was the following error when
> > trying to pass Qt.AlignCenter to QLabel.setAlignment: 
> >
> >       TypeError: argument 1 of QLabel.setAlignment() has an invalid type
> >
> > type(Qt.AlignCenter) gives <class 'PyQt4.QtCore.AlignmentFlag'> but the Qt
> > docs suggest it should be of type Qt.Alignment. Anyway, it can be easily
> > fixed by ORing together Qt.AlignVCenter and Qt.AlignHCenter.
> 
> Thanks. The setAlignment() bug will be fixed in the next snapshot.

I just assumed that the strict rules for flags and enum values were being
applied for functions that take Qt.AlignmentFlag values. My workaround for
cases like these was to use Qt.Alignment:

  label.setAlignment(Qt.Alignment(Qt.AlignCenter))

David




More information about the PyQt mailing list