[PyQt] New PyQt APIs

Martin Teichmann lkb.teichmann at gmail.com
Thu Feb 18 12:52:57 GMT 2010


Hi Sybren, Hi List,

>  On Monday 15 February 2010 14:06:20 Martin Teichmann wrote:
>  > that you can just write:
>  >
>  > from PyQt4.__future__ import QString
>
> I can do simply "from PyQt4.QtCore import QString" and then use it. Can you
>  give an example of where this fails?

That was not my point. Certainly, I can import QString. Point of the
new (already existing) API (see chapter 4 in the reference documentation
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html)
is that you won't need to import QString anymore, because it's
automagically mapped to a Python string, so that you never see
the QString anymore.

My suggestion now goes into a complete different direction: in order to
use this new API, you have to start your program with the lines

import sip
sip.setapi('QString', 2)

which I consider not nice, especially because then you have executed
code in the beginning of your files, where you usually only have
imports.

I guess my proposed names were a bit misleading, and it should be calles
something like

from PyQt4.__future__ import invisible_qstring

or so, for a better understanding.

Greetings

Martin


More information about the PyQt mailing list