[PyKDE] Remaining issues with PyQt

Phil Thompson phil at river-bank.demon.co.uk
Fri Sep 14 06:05:46 BST 2001


Boudewijn Rempt wrote:
> 
> I've very nearly finished all the text for my book (just have to
> do the intro on BlackAdder, a bit on compiling PyQt and some appendices),
> and I am making a list of things that don't quite work as they should,
> remain to be done or will be resolved in the Qt3 version of PyQt.
> 
> Before I touch up the text using these notes, I'd like comments
> on them:
> 
> * If a QString contains characters that are not in the ASCII character set,
>   it is necessary to hack around with
>         sys.setappdefaultencoding=sys.setdefaultencoding
>   and stuff - not really comfortable.

A Python problem - kick Guido. (He'll ask you to write a PEP.)

> * The  boolean decode(mimesource, string) should put the text in the string, so
>    it should return a tuple in Python:
>            (bool, string) = QTextDrag.decode(mimesource), as done in
>    QFontDialog.

Pros: It is the most natural construct.

Cons: I've always tried to mimic Qt as closely as possible and only
diverged when necessary - and it's not necessary in this case. It's not
just QTextDrag - the same point can be applied to all the drag classes.
I'm just too busy at the moment.

> * You cannot actually put something in or get something out of Qt's stream
>   classes, like QTextStream (<< and >> not implemented or implementable).

<< and >> are not implemented - they are implementable.

> * the tr() method doesn't work in PyQt versions based on Qt < 3 - there's
>   a hack around, namelijk implementing a
>    def tr(self, *args):
>         apply(qApp.translate,("widgetName",) + *args)

This can never be fixed in Qt2 - it works correctly in Qt3 (though I
haven't committed the changes yet).

> * Some methods from the base QObject class use QObject instead of a
>   higher-level class, like className(). In PyQt 2.5 this works very well:
> 
>     >>> from qt import *
>     >>> t=QTimer()
>     >>> print t.className()
>     QTimer
> 
>   However, when you try to do the same from a Python subclass, you get
>   referred back to QObject:
> 
>     >>> from qt import *
>     >>> class A(QTimer): pass
>     ...
>     >>> a = A()
>     >>> print a.className()
>     QObject

This is fixed in the CVS.

> * Cannot remove or replace widgets in layouts. (Using a widgetstack is not
>   always the answer).

The bug report that I lost was related to this - but nobody resent it.

> * QLayoutIterator - I'm not not sure what the status on this is.

PyQt (or rather SIP) could exploit the new features (like iterators)
that have been added to Python. These will have to wait until I find the
time, or until people send patches, or until somebody gives me a lump of
money to allow me to put the day job on hold for a few weeks.

Phil




More information about the PyQt mailing list