Hi Jan,

Ignore the implementation in the gitorious. I didn't have time yet to
adjust it to the current proposal, which is like the following:

Layout.minimumWidth
Layout.minimumHeight
Layout.maximumWidth
Layout.maximumHeight
Layout.verticalSizePolicy
Layout.horizontalSizePolicy

RowLayout.spacing
RowLayout.stretchFactor

ColumnLayout.spacing
ColumnLayout.stretchFactor

GridLayout.span
GridLayout.row
GridLayout.column
GridLayout.rowSpan
GridLayout.columnSpan

On Thu, Oct 20, 2011 at 9:56 AM,  <jan-arve.saet...@nokia.com> wrote:
> * 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).

Well, the idea is that expanding is handled by vertical/horizontal
size policies, like:

Item {
    Layout.horizontalSizePolicy: Layout.Expanding
}

The stretchFactor is just a bonus and it's not tied to the Item
definition. Basically, it's related to a specific layout. For example:

RowLayout {
    Item {
        RowLayout.stretchFactor: 2 // this is just applied if
horizontalSizePolicy == Expanding
    }
}

Due that fact, I don't see a real drawback of having it. I have some
use cases where I need to use it, like in TableView delegates.

> * 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
>    }
> }

I also like this approach, you can have more complex spacers since you
can use all layout features to define an invisible spacer item, like:

RowLayout {
    Button { }

    // expanding spacer
    Item {
        Layout.minimumWidth: 10
        Layout.horizontalSizePolicy: Layout.Expanding
    }

    // fixed spacer
    Item {
        implicitWidth: 10
    }

    Button { }
}

I can remove the 'spacing' property from RowLayout and ColumnLayout.
It was just a fast way to provide the fixed spacer use case.

> * 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....

Actually, I tested both. I based the code on the qlayoutengine because
it provided a simple and self contained function to handle linear
layouts, which was the first target, but that can be changed. I just
wish to have more spare time to get on the Grid implementation :).


Cheers,
Adriano
_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to