[PyQt] API 2 and Qt Designer
Phil Thompson
phil at riverbankcomputing.com
Tue Sep 28 11:03:25 BST 2010
On Tue, 28 Sep 2010 11:51:06 +0200, "Sybren A. Stüvel" <sybren at stuvel.eu>
wrote:
> Hi folks,
>
> I'd love to migrate my PyQt application to API 2, especially for the
> QString class. I'm still using Python 2.x, but I think API 2 feels
> much more Pythonic. It also will prepare my application for a future
> port to Python 3. However, when I use sip.setapi('QString', 2) my code
> seems to become incompatible with Qt Designer. When it tries to load
> my custom widget plugin, I get this:
>
> ValueError: API 'QString' has already been set to version 1
>
> Is it possible to move to API 2 and still keep using Qt Designer?
Yes, because the code generated by pyuic4 works with both Python2 and
Python3.
You have to make sure that you call setapi() before the very first PyQt
import.
Phil
More information about the PyQt
mailing list