[Qt-qml] Advanced layout support
Adriano Rezende
adriano.rezende at openbossa.org
Thu Oct 20 18:07:11 CEST 2011
On Thu, Oct 20, 2011 at 7:48 AM, <jan-arve.saether at nokia.com> wrote:
> I would like to mention some disadvantages to all approaches mentioned here:
> Unless we make some smart decisions, the suggestions will make layouting much more complex.
> Such as:
> * What if label.implicitWidth changes? This opens several sub-questions:
This is still open for discussion. Currently, it's propagating
min/implicit/max sizes to upper layers.
> -> How should propagation be done? (rearranging the layout as an answer to a change in every single size hint will cause many redundant rearrangements)
I was thinking about merging these requests, in order to reduce the
number of recalculations, marking the layout as dirty and postponing
the relayout operation. Do you have any suggestion about this?
> -> What if the application have set a minimumWidth, should it just be overwritten (because of the property propagation)? This again opens the question how we can differentiate between min/max size (set by the user) and min/max size hints (indicated by the item). Should it be possible to override the size hints given by the item (just like QGraphicsLayoutItem allows?)
The current implementation let you override size hints. Basically,
default size hints could be defined in the Item declaration, but users
are free to change them if they will. For example:
// Button.qml
Item {
Layout.minimumWidth: 100
}
RowLayout {
Button {
// uses the default size (100)
}
Button {
Layout.minimumWidth: 200 // uses a custom size
}
}
> * How rigid is min and max sizes? Do they override the size property?
They are strictly applied. Basically, inside a Layout, the Layout
takes control over the Item geometry, but that could be flexible if
special size policies are introduced, working like Row/Column if it
makes sense.
Br,
Adriano
More information about the Qt-qml
mailing list