summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview/qgraphicsgridlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsgridlayout.cpp')
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index dbd5407b90..e4599d20bb 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -11,13 +11,16 @@
\inmodule QtWidgets
The most common way to use QGraphicsGridLayout 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(). QGraphicsGridLayout automatically computes
+ on the heap, passing a parent widget to the constructor, then add widgets
+ and layouts by calling addItem(). QGraphicsGridLayout automatically computes
the dimensions of the grid as you add items.
\snippet code/src_gui_graphicsview_qgraphicsgridlayout.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.
+
The layout takes ownership of the items. In some cases when the layout
item also inherits from QGraphicsItem (such as QGraphicsWidget) there will be a
ambiguity in ownership because the layout item belongs to two ownership hierarchies.
@@ -143,7 +146,7 @@ void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column
}
/*!
- \fn QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = 0)
+ \fn QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment)
Adds \a item to the grid on \a row and \a column. You can specify
an optional \a alignment for \a item.