[Qt-qml] Advanced layout support
Adriano Rezende
adriano.rezende at openbossa.org
Tue Oct 18 19:18:16 CEST 2011
On Mon, Oct 17, 2011 at 5:27 PM, Charley Bay <charleyb123 at gmail.com> wrote:
> Adriano spaketh:
> ASSERTION: The QWidget (e.g., "desktop") model for real-estate usage (and
> "component ownership") is VERY DIFFERENT from the QML model. IMHO, great
> care must be taken in merging the models (we need to think this through).
> In the absence of "thinking it through", we'll merely super-impose the
> desktop model onto QML, which IMHO, probably won't work well. Maybe it
> will. I don't know.
The QML layout model is basically an anchor layout without an explicit
layout manager (Row, Column and Grid components are special cases).
This kind of layout approach is very powerful and I'm fan of it since
2007. I've worked on a port of Edje (EFL libraries) to Qt before QML
arrived (http://www.youtube.com/watch?v=QZUwUDeJfX0) and it's
basically its main feature. But there are several cases where a simple
layout manager is the right way to go, like in tabs, table views, form
widgets and specially in the desktop box model. IMO, both approaches
are necessary and they complement each other.
> GOAL: We need to be able to specify
> "placement-and-real-estate-sub-division" for QML components. QWidgets do
> this with layouts, which is a "top-down" model. QML components currently
> are "independent actors" that do their own placement[*] (permitting
> Z-order). As a result, QML components can animate, move, and resize
> themselves.
Regarding Z-order, it's not related to layouts per say. It's not a
space coordinate, it just dictates the painting order.
> [*] The QML components can do some level of "anchoring-to-parent-component",
> but IMHO that is not a "fundamental" mechanism, because parent components
> are not required to themselves be "visible" (this is different for
> QWidgets). Further, things like QML "transitions" imply different
> size-and-placement concerns where "layout" capability may be needed between
> "parents" (such as transitioning components in a "flock-of-birds" pattern
> from one parent to another).
It's also possible to provide animations between different layouts if
you think in reparent animations and if you use items slots
(wrappers). You could move items from a row layout to a grid layout
and animate the items during the reparent operation in order to show a
fluid transition.
Br,
Adriano
More information about the Qt-qml
mailing list