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

Sebastian Kügler sebas at kde.org
Wed Dec 6 13:25:00 GMT 2006


On Monday 04 December 2006 13:53, Andreas Pakulat wrote:
> On 06.12.06 13:37:39, Sebastian Kügler wrote:
> > On Monday 04 December 2006 11:23, Andreas Pakulat wrote:
> > > On 04.12.06 03:38:47, Eriol wrote:
> > > > I'm trying to use custom widget promotion in qt4 designer. I attach
> > > > an example of what I'm doing: what's wrong with it?
> > > > I have searched for documentation about this, but I didn't find
> > > > anything for Python.
> > >
> > > You're creating the label without a parent widget, so it becomes a
> > > top-level window. Pass self to the constructor of QLabel and it works.
> >
> > 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 and now. It only works via the "Promote to Custom Widget" function,
> which means using one of the existing widgets and place it into the
> form, then choosing the "header" for the custom widget and the class via
> a dialog. You won't see the custom widget in Qt4 designer, all you'll
> see is the "standard" widget you placed into the form.

Fair enough.

> pyuic4 then translates foobar.h into foobar.py and puts:
>
> from foobar import FoobarClass
>
> into the generated code.
>
> Real custom widgets are rather complicated, for Qt3 somebody managed to
> have python-kparts which could be used in Python or C++ KDE apps which
> is also a plugin...

Thanks for the explanation!
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you want the holes in your knowledge showing up try teaching someone. - 
Alan Cox

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061204/672a3533/attachment.bin


More information about the PyQt mailing list