[Qt-interest] Widget promotion feature

Paul Dixon lordelph at gmail.com
Mon Jun 1 21:42:33 CEST 2009


> I am reading this article
> http://doc.trolltech.com/4.5/designer-using-custom-widgets.html
> and I can't understand it very well...
> Can somebody explain me what is this Promotion for, after all ?

Let's say you made a cool widget called FooWidget, and wanted to use
it in Qt Designer - you could drop a regular Widget object into your
layout, then "promote" it to a FooWidget, which enables the generated
code to include the relevant header and create a FooWidget rather than
a Widget.

If your FooWidget is a specialised version of a widget Qt Designer
already knows about, e.g. a QSlider, you can tell it to use that as a
base class when you promote it, which will allow more access to its
custom properties in Qt Designer.

To put it another way, it's a quick way of getting Qt Designer to work
with *your* widget classes rather than the Qt defaults.



More information about the Qt-interest-old mailing list