[PyKDE] PyQt4 Update
Phil Thompson
phil at riverbankcomputing.co.uk
Sun Dec 4 14:01:20 GMT 2005
On Saturday 03 December 2005 6:08 pm, Baz Walter wrote:
> On Thursday 01 Dec 2005 22:34, you wrote:
> > Tonight's PyQt4 snapshot has the QtGui module 99% complete. This means
> > PyQt4 is now officially useful, but note the following...
> >
> > - untested on Windows
> > - untested against Qt v4.1
> > - untested against GCC v4
> >
> > The Qt tutorials have been ported to Python as has the application.py
> > example. A really useful thing for people to do now would be to port as
> > many of the other Qt examples as possible and send them to me for
> > inclusion. Please follow the coding style I've used.
> >
> > Expect to see seg faults - it's unlikely(!) I've got all the ownership
> > issues correct at the first attempt.
> >
> > Always use the latest SIP snapshot. If you want to use PyQt4 and PyQt3
> > side by side then you will also need to use a PyQt3 snapshot. Otherwise
> > you'll be better off installing another Python instance dedicated to
> > PyQt4.
> >
> > There are a couple of differences between PyQt3 and PyQt4 that will catch
> > people out...
> >
> > - Whenever a method name clashes with a Python keyword then I have simply
> > appended "_" to the name. For example exec() became exec_loop() in PyQt3
> > but becomes exec_() in PyQt4.
> >
> > - emit() used to take 2 arguments - a signal name and a tuple of
> > arguments passed to the slot. In PyQt4 it takes a variable number of
> > arguments, the first being the signal name and any remaining arguments
> > are passed to the slot.
> >
> > Have fun.
> >
> > Phil
>
> 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.
Phil
More information about the PyQt
mailing list