One solution I have found is to make a QML component and wrap the QGW into a 
QML Item. And then in Component.onCompleted set the width & height to 
preferredSize.width & .height. Also some kind of 'polish' call might be needed, 
if the widgets use late layouting & size calculation in polish event handler 
and not calculate their sizeHints after setting each relevant property.

Something like this in your Widget.qml:

import Qt 4.7
import MyGraphicsWidgets

Item {
    id: wrapper
    property alias text: hbwidget.text

    MyWidget {
        id: mywidget
        text: ""
        x: 0; y: 0
        width: wrapper.width; height: wrapper.height
    }

    Component.onCompleted: {
        mywidget.polish () // To calculate the preferredSize
        width = mywidget.preferredSize.width;
        height = mywidget.preferredSize.height;
    }
}


Another solution is to set the height (if one is inside Column) or width (in 
Row) explicitly. Then no wrapper component is needed.

- Tapani

On Thursday 22 April 2010 16:21:33 Kellomaki Pertti (Nokia-D/Tampere) wrote:
> I am trying to put non-QML widgets inside a Column, but all the widgets 
> get drawn on top of each other. What does an element need to understand 
> ori provide in order to be positioned by a Column?
> 
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to