diff options
Diffstat (limited to 'src/widgets/graphicsview/qgraphicslinearlayout.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicslinearlayout.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp index 2118a8ff08..04693734d2 100644 --- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp +++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp @@ -14,12 +14,16 @@ passing Qt::Vertical to QGraphicsLinearLayout's constructor. The most common way to use QGraphicsLinearLayout is to construct an object - on the heap with no parent, add widgets and layouts by calling addItem(), - and finally assign the layout to a widget by calling - QGraphicsWidget::setLayout(). + on the heap, passing a parent widget to the constructor, then add widgets + and layouts by calling addItem(). \snippet code/src_gui_graphicsview_qgraphicslinearlayout.cpp 0 + Alternatively, if you do not pass a parent widget to the layout's constructor, + you will need to call QGraphicsWidget::setLayout() to set this layout as the + top-level layout for that widget, the widget will take ownership of + the layout. + You can add widgets, layouts, stretches (addStretch(), insertStretch() or setStretchFactor()), and spacings (setItemSpacing()) to a linear layout. The layout takes ownership of the items. In some cases when the layout |