[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QPainter.boundingRect & flags, mixing enum types issue...
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2007-06-30 13:07:35
Message-ID: 200706301407.35910.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Saturday 30 June 2007 12:12 pm, Baptiste Lepilleur wrote:
> I'm stumbled uppon the error below when attempting to use
> QPainter.boundingRect:
>
> flags = QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop | QtCore.Qt.TextSingleLine
> bound = painter.boundingRect( QtCore.QRectF(), flags, word.text )
>
> Traceback (most recent call last):
>   File "test.pyw", line 142, in paintEvent
>     flags = QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop |
> QtCore.Qt.TextSingleLine
> TypeError: unsupported operand type(s) for |: 'Alignment' and 'TextFlag'
>
> The error seems to indicate that I can not mix 'Alignment' and 'TextFlag'
> enums, but the doc clearly says that I can. Is this a bug? If so, where
> should it be reported ?
>
> As a work-around, I'm using:
> flags = int(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) |
> int(QtCore.Qt.TextSingleLine)

It's a feature not a bug. Your workaround is the correct one.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic