[PyKDE] PyQt4: Promoting a custom widget in qt4 designer

David Boddie david at boddie.org.uk
Tue Dec 5 13:59:27 GMT 2006


On Wed, 6 Dec 2006 13:37:39 +0100, Sebastian Kügler wrote:

> Slightly OT (in fact more a general question):
> 
> So it is possible to create a custom widget with PyQt4 and use it in 
> qt4-designer? 

Yes, it's possible.

> (I was thinking about the coolness of such a feature some time ago, so now
> I'd like to know for sure...)

I have two different implementations: the first requires some patches to
PyQt but enables any widget to be subclassed and used in Designer; the second
is based on a specific QWidget subclass and can be used as a container for
other custom widgets.

I wanted to try a third approach that used the special Designer custom widget
(as in the second case) but which automatically proxied signals, slots and
properties. Although this would mean that you could use your existing PyQt
installation to create custom widget plugins, the code I wrote to make all
this transparent to the developer looked really awful.

My plan was to fix up what I was working on and put it up on a website
somewhere, but perhaps I should just post the earlier version of the
code with the Designer custom widget container that's less convenient to
use but possible to maintain. :-)

David




More information about the PyQt mailing list