[PyQt] Designer plugins with non-default QString/etc. SIP API versions

Fabian Knittel fabian.knittel at lettink.de
Wed Jan 4 00:52:08 GMT 2012


Hi,

we're currently migrating our Python 2.x PyQt4 code from
QString/QVariant/... SIP API version 1 to version 2 in preparation for
Python 3. The app works fine and we're quite happy with API version 2.

Unfortunately, our app specific Qt Designer plugins have stopped
working. The plugins use code from the app and therefore now depend on
API version 2, but the PyQt designer plugin loader loads
PyQt4.QtDesigner.QPyDesignerCustomWidgetPlugin before loading any of
our plugins and therefore the API version gets set to the default
(version 1).

The attached patch lazy loads
PyQt4.QtDesigner.QPyDesignerCustomWidgetPlugin after the first
successful plugin module import. Assuming full control over all
plugins and further assuming that all plugins use the same API
versions, this allows the plugins to call sip.setapi before any
default APIs are set.

Would something like this be acceptable upstream?

Cheers
Fabian

PS: The patch is against 4.7.3, but (as far as I can tell) 4.9 doesn't
appear to have changed much in designer/pluginloader.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyqt4_late-api.diff
Type: text/x-patch
Size: 1483 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120104/54cf78d0/attachment.bin>


More information about the PyQt mailing list