[Qt-interest] Custom composite widgets in Qt designer

André Somers andre at familiesomers.nl
Sun Mar 29 11:45:43 CEST 2009


Hi,

Maybe you should check out the "widget promotion" feature in Designer. It 
allows you to place one of the standard widgets (preferably the closest base 
class of the widget you actually want there) on the form in designer, and 
have it replaced by your actual widget in your application.

I think it will solve your problem.

André

"Jan Krajicek" <j.krajicek at atlas.cz> schreef in bericht 
news:200903282015.05966.j.krajicek at atlas.cz...
> Hi everyone,
>
> The Qt documentation mentions "composite widgets" -- a bunch of simple
> widgets layed out in a container widget (eg. QFrame).  These sound like a
> nice idea, but I need some help making/using them.
>
> What I'd like to do is make a simple composite widget (just a QLineEdit
> and two buttons), code some logic into it and then use it on different
> places in the user interface (twice in the main window, most
> importantly).  It would make sense for the composite widget's logic to be
> separated from the main window's code, all the main window will need from
> the widget is one value.
>
> I think this wouldn't be hard to do in just code, but I'd like to use Qt
> designer.  Is it possible to make/use such a composite widget from Qt
> designer? Of course I could just put the 3 widgets that make up the
> composite one right into the main window for each use, and integrate the
> logic into the main window, but that doesn't sound like a very nice
> approach.  It would be great if I could put the composite widget into the
> main window just like any other widgets and separate its code from the
> main window.
>
> Can someone give me advice how to do it? 




More information about the Qt-interest-old mailing list