[Qt-interest] Custom widget in designer with simple container

Friedemann Kleint Friedemann.Kleint at nokia.com
Wed Sep 22 11:35:59 CEST 2010


Hi.

> I tried but the result is not so good.
> Then: even deriving a basic container Qframe/QWidget and putting it in
> the designer is not enough to make it layout-able.

To clarify:

For a simple container like QFrame that does not have internal children, it 
should be sufficient to return 'true' from
bool QDesignerCustomWidgetInterface::isContainer (). The user drops child 
widgets directly onto those.

You need a QDesignerContainerExtension in case the container has nested pages 
like QStackedWidget or QScrollArea. It helps Qt Designer to traverse the 
internal children and find the actual page widgets where to let the user drop 
additional widgets. In that case, the XML returned by domXML() should create a 
child on the widget. For QScrollArea, it looks like:

<widget class="QScrollArea">
    <widget class="QWidget" name="scrollAreaWidgetContents"/>
</widget>

Relevant code is in:
tools/designer/src/components/formeditor/default_container.cpp

Regards,
Friedemann
-- 
Friedemann Kleint
Nokia, Qt Development Frameworks



More information about the Qt-interest-old mailing list