[PyQt] QT Designer for Custom Widgets.

David Boddie david at boddie.org.uk
Thu Apr 17 22:34:43 BST 2008


On Wed, 16 Apr 2008 13:10:01 +0300, objectref wrote:

> I am reading Mark Summerfields' "Rapid Gui Programming with Python and Qt".
> Until the chapter I am now, I saw that we can build a new custom widget by
> subclassing an existing one and adding our own stuff. All this by code.
>
> Can I achieve the same thing by using solely the Qt Designer ?? I mean,
> let's say I want to make a widget that practically it is a collection of
> some other, predefined ones, and I want to define some properties on it in
> a way that I can see these properties in Designer's Property Editor. Can I
> do this somehow ?

You can use another widget as a placeholder for your custom widget by
"promoting" it - the custom widget in your application must be a subclass
of the widget you use as a placeholder.

I forget whether you can define new properties for the promoted widget. I'm
certain you can do this with the upcoming Qt 4.4 version of Qt Designer, and
it may also be possible with Qt 4.3.

David


More information about the PyQt mailing list