Simple Anchor Layout Example¶
Demonstrates anchor layout on a graphics view scene.
The Simple Anchor Layout example shows the basic use of the
QGraphicsAnchorLayoutclass.![]()
The example starts by creating a
QGraphicsScene(scene), 3 widgets (a,b, andc), and a QGraphicsAnchorlayout (layout).First it anchors the top left corner of item
ato the top left corner oflayout. This can be done in two steps:Or in one step:
Then the right anchor of
ais anchored to the left anchor ofb, and the top of itembis anchored to the bottom ofa.Place a third widget
cunder widgetb:Items
bandcare anchored to each other horizontally:Item c is anchored to the bottom right point of
layoutFinally, QGraphicsWidget
wis displayed inQGraphicsViewview.See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.