Hi, I've pushed a commit that simplifies the API.
http://qt.gitorious.org/~arezende/qt-components/arezende-desktop/commit/611cc0a8796024811aea4411ecf304a554fe0de6 It removes stretchFactor and the individual item spacing as suggested. So, there is no attached property for Row or Column anymore (these features can be added later if it's really needed). Now it just provides the Layout attached property with the following variables: Layout.minimumWidth Layout.maximumWidth Layout.minimumHeight Layout.maximumHeight Layout.verticalSizePolicy Layout.horizontalSizePolicy Currently, there are just 2 size policies (Fixed and Expanding) and the items are uniformly stretched if Layout.Expanding is used. Should we follow QSizePolicy::Policy? On Thu, Oct 20, 2011 at 7:34 PM, <jens.bache-w...@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: > > 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 think it's needed in some cases like the Button widget, where you want it to increase in width but keeping a fixed height. Since, these informations are not layout-specific, I think these 2 size policies are still needed; a user wouldn't have to change the button size policy when using it inside a Row or a 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 think Jan-arve was just proposing to remove the individual spacing, present in the attached property, since it's not a common use case and it can be provided with invisible spacers; the layout spacing is still present. It makes sense to change the default spacing to start with 4px, I'll do that. The current implementation is already looking for sizePolicy, stretching uniformly all items. > 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. Yes, I was wondering which property we should look to get the default sizehint. The width or the implicitWidth? Currently, it's based on implicitWidth/implicitHeight, which is generally the desired size, but that is not so straightforward when setting the hint inside the layout. Looking width/height it would behave exactly as the Row/Column official components when Fixed is used. What's the best choice? Br, Adriano _______________________________________________ Qt-qml mailing list Qt-qml@qt.nokia.com http://lists.qt.nokia.com/mailman/listinfo/qt-qml