[PyQt] Question about QPyDesignerCustomWidgetCollectionPlugin

Phil Thompson phil at riverbankcomputing.com
Tue Feb 1 09:18:22 GMT 2011


On Tue, 1 Feb 2011 09:36:48 +0100, Tiago Coutinho
<coutinhotiago at gmail.com>
wrote:
> Hello all,
> 
> Does anyone have an example on how to code the
> QtDesigner.QtDesigner.QPyDesignerCustomWidgetCollectionPlugin?
> 
> I am using Qt 4.7.0 and PyQt 4.7.4.
> 
> I have coded something like:
> 
> class MyCustomWidget1Plugin(QPyDesignerCustomWidgetPlugin):
> 
>     def createWidget(self, parent):
>         ...
> 
> class MyCustomWidget2Plugin(QPyDesignerCustomWidgetPlugin):
> 
>     def createWidget(self, parent):
>         ...
> 
> 
> class
> MyCustomWidgetCollectionPlugin(QPyDesignerCustomWidgetCollectionPlugin):
> 
>     def __init__(self, parent=None):
>         QPyDesignerCustomWidgetCollectionPlugin.__init__(parent)
>         self._plugins =
> [ MyCustomWidget1Plugin(self), MyCustomWidget2Plugin(self) ]
>         print "CREATED"
> 
>     def customWidgets(self):
>         return self._plugins
> 
> I see both my custom widgets in the designer without a problem but
> the MyCustomWidgetCollectionPlugin class never gets instanciated.
> 
> Am I doing something wrong?
> 
> Thanks in advance
> 
> Tiago

Look at the plugins.py example included with PyQt.

Phil


More information about the PyQt mailing list