Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View. More...
#include <QGraphicsGridLayout>
Inherits QGraphicsLayout.
This class was introduced in Qt 4.4.
The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View.
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 the dimensions of the grid as you add items.
QGraphicsScene scene; QGraphicsWidget *textEdit = scene.addWidget(new QTextEdit); QGraphicsWidget *pushButton = scene.addWidget(new QPushButton); QGraphicsGridLayout *layout = new QGraphicsGridLayout; layout->addItem(textEdit, 0, 0); layout->addItem(pushButton, 0, 1); QGraphicsWidget *form = new QGraphicsWidget; form->setLayout(layout); scene.addItem(form);
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. See the documentation of QGraphicsLayoutItem::setOwnedByLayout() how to handle this. You can access each item in the layout by calling count() and itemAt(). Calling removeAt() will remove an item from the layout, without destroying it.
See also QGraphicsLinearLayout and QGraphicsWidget.
Constructs a QGraphicsGridLayout instance. parent is passed to QGraphicsLayout's constructor.
Destroys the QGraphicsGridLayout object.
Adds item to the grid on row and column. You can specify a rowSpan and columnSpan and an optional alignment.
Adds item to the grid on row and column. You can specify an optional alignment for item.
Returns the alignment for item.
See also setAlignment().
Returns the alignment for column.
See also setColumnAlignment().
Returns the number of columns in the grid layout. This is always one more than the index of the last column that is occupied by a layout item (empty columns are counted except for those at the end).
Returns the maximum width for column.
See also setColumnMaximumWidth().
Returns the minimum width for column.
See also setColumnMinimumWidth().
Returns the preferred width for column.
See also setColumnPreferredWidth().
Returns the column spacing for column.
See also setColumnSpacing().
Returns the stretch factor for column.
See also setColumnStretchFactor().
Returns the number of layout items in this grid layout.
Reimplemented from QGraphicsLayout.
Returns the default horizontal spacing for the grid layout.
See also setHorizontalSpacing().
Returns a pointer to the layout item at (row, column).
Returns the layout item at index, or 0 if there is no layout item at this index.
Reimplemented from QGraphicsLayout.
Removes the layout item at index without destroying it. Ownership of the item is transferred to the caller.
Reimplemented from QGraphicsLayout.
See also addItem().
Returns the alignment of row.
See also setRowAlignment().
Returns the number of rows in the grid layout. This is always one more than the index of the last row that is occupied by a layout item (empty rows are counted except for those at the end).
Returns the maximum height for row, row.
See also setRowMaximumHeight().
Returns the minimum height for row, row.
See also setRowMinimumHeight().
Returns the preferred height for row, row.
See also setRowPreferredHeight().
Returns the row spacing for row.
See also setRowSpacing().
Returns the stretch factor for row.
See also setRowStretchFactor().
Sets the alignment for item to alignment.
See also alignment().
Sets the alignment for column to alignment.
See also columnAlignment().
Sets the fixed width of column to width.
Sets the maximum width of column to width.
See also columnMaximumWidth().
Sets the minimum width for column to width.
See also columnMinimumWidth().
Sets the preferred width for column to width.
See also columnPreferredWidth().
Sets the spacing for column to spacing.
See also columnSpacing().
Sets the stretch factor for column to stretch.
See also columnStretchFactor().
Sets the bounding geometry of the grid layout to rect.
Reimplemented from QGraphicsLayoutItem.
Sets the default horizontal spacing for the grid layout to spacing.
See also horizontalSpacing().
Sets the alignment of row to alignment.
See also rowAlignment().
Sets the fixed height for row, row, to height.
Sets the maximum height for row, row, to height.
See also rowMaximumHeight().
Sets the minimum height for row, row, to height.
See also rowMinimumHeight().
Sets the preferred height for row, row, to height.
See also rowPreferredHeight().
Sets the spacing for row to spacing.
See also rowSpacing().
Sets the stretch factor for row to stretch.
See also rowStretchFactor().
Sets the grid layout's default spacing, both vertical and horizontal, to spacing.
See also rowSpacing() and columnSpacing().
Sets the default vertical spacing for the grid layout to spacing.
See also verticalSpacing().
Returns the default vertical spacing for the grid layout.
See also setVerticalSpacing().
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt 4.5.1 |