[Qt-qml] Comments to API of RowLayout/ ColumnLayout

jan-arve.saether at nokia.com jan-arve.saether at nokia.com
Thu Oct 20 14:56:11 CEST 2011


Hi Adriano.

I just signed up to qt-qml list, so sorry if some of my comments are already mentioned in some earlier posts.

Some comments to the API:

* I would rather have an expanding property in favor of stretchFactor. How often do we need to say that item A should expand a bit more than item B? (I don't do that very often). Stretch factors adds also several possible behaviors. (Which one is the best? Which one does the end user expect?) (QBoxLayout and QGraphicsLinearLayout differs in this respect).

* I don't like how individual spacing is specified:

RowLayout {
    spacing: 6
    Rectangle {
        color: "green"
        height: parent.height
        Layout.spacing: 10
    }
    Rectangle {
        color: "blue"
        height: parent.height
    }
}

If possible, I would prefer:

RowLayout {
    spacing: 6
    Rectangle {
        color: "green"
        height: parent.height
    }
    TransparentItem {	// Ideally this would not even create an item
        spacing: 10
    }    
    Rectangle {
        color: "blue"
        height: parent.height
    }
}


* Finally, I would base my code on a generic grid layout engine (maybe QGridLayoutEngine) instead. The problem with QBoxLayout and QGridLayout is that they don't share implementation, causing a 1x4 gridlayout to behave differently than a 4-item RowLayout in some scenarios. This is an implementation detail though....





More information about the Qt-qml mailing list