[PyKDE] Problem with QPainter.drawText() flags

Phil Thompson phil at riverbankcomputing.co.uk
Thu Oct 26 17:14:30 BST 2006


> Hi -
>
> In Qt4, the QPainter.drawText() variants that use a rectangle also have
> a flags parameter.  According to the Qt4 documentation, the flags
> parameter can be an OR combination of Qt.AlignmentFlag and Qt.TextFlag.
>
> In PyQt 4.01, the drawText() function works fine with a combination of
> alignment flags, but it throws a TypeError with a combination of
> alignment and text flags.

Cast then to ints first then or them. Something like...

    int(Qt.Alignment...|Qt.Alignment...)|int(Qt.Text...|Qt.Text...)

...or cast them to ints individually if you prefer.

Phil




More information about the PyQt mailing list