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

jens.bache-wiig at nokia.com jens.bache-wiig at nokia.com
Fri Oct 21 00:34:39 CEST 2011


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

Perhaps just the name Layout.sizePolicy is precise enough. Is there a case where it is relevant to set both in the same layout as long as you still have to specify Row or Column?

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

I would suggest that we keep it. Partially I want to keep it more or less compatible with row/column and I almost always want some default spacing between widgets. In fact I think the default spacing should be set to 4 pixels and not 0 by default. (unless we want per-component style based values) Apart from that, I would suggest that stretching is off on items by default. (Keep stretchFactor at 1.0 as default but ignore it unless Layout.sizePolicy === Layout.Expanding.)

I am currently a little bit puzzled by the behavior when no items have a stretch factor. I wonder if we should insert an invisible expanding item implicitly at the end?
The other thing that was odd was having to set Layout.implicitWidth on an Item to create a spacer. For some reason I expected just setting width to work. But I can see how that makes sense though… Perhaps a convenience Spacer{} would be worth it.

> 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 :).

I am happy that you are managing to find some time to work on this though. It is already very useful.

Regards,
Jens


More information about the Qt-qml mailing list