[PyKDE] PyQt4 Update
bazwal at ftml.net
Mon Dec 5 00:33:41 GMT 2005
On Sunday 04 Dec 2005 14:01, Phil Thompson wrote:
> On Saturday 03 December 2005 6:08 pm, Baz Walter wrote:
> > Hello Phil
> > I've created a PyQt4 port of the tetrix example from Qt v4.x, which is
> > attached. It's not been tested to destruction, but almost everything
> > seemed to work okay for me. 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.
After some further playing around with the tetrix example I have found another
fairly minor issue which picks up on some points made later in this thread.
There are some functions in the QPainter class which have a const QBrush
argument but which can take a QColor due to an implicit QBrush(color)
conversion. They all seem to work with the exception of this one:
QPainter.fillRect(int x,int y,int w,int h,const QBrush & brush)
When passed a QColor, this fails with "TypeError: argument 5 of
QPainter.fillRect() has an invalid type" followed by a segmentation fault
(sometimes). Of course, this can be cured with an explicit conversion.
(NB: I also back-ported the tetrix example to Qt3 and got the same error).
More information about the PyQt