41 The resulting layouts look like this, depending on the width of the window.
42
43 \div {class="float-right"}
44 \inlineimage simpleProxy.png
45 {Narrow window with stacked layout and wide window with
46 side-by-side layout}
47 \enddiv
48
49 Various levels of layouts and items can be nested but \l {Item}{Items} can only be moved within a their \l{Item::parent}{Item.parent}.
50
51 \section2 States
52
53 The same result can be achieved with \l {Qt Quick States}. The upside of
54 using states is that the \l {Layout} properties for a specific layout are
55 collected at a single point in the QML file (at least the changing ones).
56 The previously shown example can be implemented as follows and the result
57 looks and behaves the exact same.
58
59 \snippet layouts/responsiveStates.qml document
60
61 \section2 LayoutItemProxy
62
63 A third approach is the application of the \l {LayoutItemProxy}. The
64 implementation of the previously shown minimalistic example can be found in
65 the type documentation. In contrast to previously shown solutions, the
66 \l {LayoutItemProxy} enables the declaration of completely separate layouts
67 for various form factors. Especially with more complex layouts this might be
68 useful to improve and maintain a reasonable source code structure.
69
70 Note, that the \l{LayoutItemProxy} API is in a technology preview state and might
71 be subject to change or removal in future Qt versions.
72
73 \section1 Adaptive hierarchy, adaptive layout
74
75 More complex reconstructions of the layout might require changes to
76 the hierarchy. A small stand-alone button in a small layout might be
77 combined with other buttons and put into a box of a larger layout. An item
78 that is fully visible in one layout, might require a \l {Flickable} in
79 another, smaller layout. In this scenario, it is best to rely on the \l {LayoutItemProxy}. The \l {LayoutItemProxy} allows to move \l{Item}{Items} across various hierarchy levels and between different \l{Item::parent}{Item.parent}.
80
81 The \l {Qt Quick Layouts - Responsive Layout Example} shows a case where an
82 item is moved between different hierarchy levels, put into a \l {Flickable}
83 in one case and on the top level in another layout. The two resulting