com.trolltech.qt.gui
Class QGraphicsGridLayout

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.gui.QGraphicsLayout
                  extended by com.trolltech.qt.gui.QGraphicsGridLayout
All Implemented Interfaces:
QGraphicsLayoutItemInterface, QtJambiInterface

public class QGraphicsGridLayout
extends QGraphicsLayout

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 = new QGraphicsScene();
        QGraphicsWidget textEdit = scene.addWidget(new QTextEdit());
        QGraphicsWidget pushButton = scene.addWidget(new QPushButton());

        QGraphicsLinearLayout layout = new QGraphicsLinearLayout();
        layout.addItem(textEdit);
        layout.addItem(pushButton);

        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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QGraphicsGridLayout()
          Constructs a QGraphicsGridLayout instance.
QGraphicsGridLayout(QGraphicsLayoutItemInterface parent)
          Constructs a QGraphicsGridLayout instance.
 
Method Summary
 void addItem(QGraphicsLayoutItemInterface item, int row, int column)
          Adds item to the grid on row and column.
 void addItem(QGraphicsLayoutItemInterface item, int row, int column, int rowSpan, int columnSpan)
          Adds item to the grid on row and column.
 void addItem(QGraphicsLayoutItemInterface item, int row, int column, int rowSpan, int columnSpan, Qt.Alignment alignment)
          Adds item to the grid on row and column.
 void addItem(QGraphicsLayoutItemInterface item, int row, int column, int rowSpan, int columnSpan, Qt.AlignmentFlag[] alignment)
          This is an overloaded method provided for convenience.
 void addItem(QGraphicsLayoutItemInterface item, int row, int column, Qt.Alignment alignment)
          Adds item to the grid on row and column.
 void addItem(QGraphicsLayoutItemInterface item, int row, int column, Qt.AlignmentFlag[] alignment)
          This is an overloaded method provided for convenience.
 Qt.Alignment alignment(QGraphicsLayoutItemInterface item)
          Returns the alignment for item.
 Qt.Alignment columnAlignment(int column)
          Returns the alignment for column.
 int columnCount()
          Returns the number of columns in the grid layout.
 double columnMaximumWidth(int column)
          Returns the maximum width for column.
 double columnMinimumWidth(int column)
          Returns the minimum width for column.
 double columnPreferredWidth(int column)
          Returns the preferred width for column.
 double columnSpacing(int column)
          Returns the column spacing for column.
 int columnStretchFactor(int column)
          Returns the stretch factor for column.
 double horizontalSpacing()
          Returns the default horizontal spacing for the grid layout.
 QGraphicsLayoutItemInterface itemAt(int row, int column)
          Returns a pointer to the layout item at (row, column).
 Qt.Alignment rowAlignment(int row)
          Returns the alignment of row.
 int rowCount()
          Returns the number of rows in the grid layout.
 double rowMaximumHeight(int row)
          Returns the maximum height for row, row.
 double rowMinimumHeight(int row)
          Returns the minimum height for row, row.
 double rowPreferredHeight(int row)
          Returns the preferred height for row, row.
 double rowSpacing(int row)
          Returns the row spacing for row.
 int rowStretchFactor(int row)
          Returns the stretch factor for row.
 void setAlignment(QGraphicsLayoutItemInterface item, Qt.Alignment alignment)
          Sets the alignment for item to alignment.
 void setAlignment(QGraphicsLayoutItemInterface item, Qt.AlignmentFlag[] alignment)
          This is an overloaded method provided for convenience.
 void setColumnAlignment(int column, Qt.Alignment alignment)
          Sets the alignment for column to alignment.
 void setColumnAlignment(int column, Qt.AlignmentFlag[] alignment)
          This is an overloaded method provided for convenience.
 void setColumnFixedWidth(int column, double width)
          Sets the fixed width of column to width.
 void setColumnMaximumWidth(int column, double width)
          Sets the maximum width of column to width.
 void setColumnMinimumWidth(int column, double width)
          Sets the minimum width for column to width.
 void setColumnPreferredWidth(int column, double width)
          Sets the preferred width for column to width.
 void setColumnSpacing(int column, double spacing)
          Sets the spacing for column to spacing.
 void setColumnStretchFactor(int column, int stretch)
          Sets the stretch factor for column to stretch.
 void setHorizontalSpacing(double spacing)
          Sets the default horizontal spacing for the grid layout to spacing.
 void setRowAlignment(int row, Qt.Alignment alignment)
          Sets the alignment of row to alignment.
 void setRowAlignment(int row, Qt.AlignmentFlag[] alignment)
          This is an overloaded method provided for convenience.
 void setRowFixedHeight(int row, double height)
          Sets the fixed height for row, row, to height.
 void setRowMaximumHeight(int row, double height)
          Sets the maximum height for row, row, to height.
 void setRowMinimumHeight(int row, double height)
          Sets the minimum height for row, row, to height.
 void setRowPreferredHeight(int row, double height)
          Sets the preferred height for row, row, to height.
 void setRowSpacing(int row, double spacing)
          Sets the spacing for row to spacing.
 void setRowStretchFactor(int row, int stretch)
          Sets the stretch factor for row to stretch.
 void setSpacing(double spacing)
          Sets the grid layout's default spacing, both vertical and horizontal, to spacing.
 void setVerticalSpacing(double spacing)
          Sets the default vertical spacing for the grid layout to spacing.
 double verticalSpacing()
          Returns the default vertical spacing for the grid layout.
 
Methods inherited from class com.trolltech.qt.gui.QGraphicsLayout
activate, contentsRect, count, effectiveSizeHint, geometry, getContentsMargins, graphicsItem, invalidate, isActivated, isLayout, itemAt, maximumHeight, maximumSize, maximumWidth, minimumHeight, minimumSize, minimumWidth, ownedByLayout, parentLayoutItem, preferredHeight, preferredSize, preferredWidth, removeAt, setContentsMargins, setGeometry, setGraphicsItem, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setOwnedByLayout, setParentLayoutItem, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSizePolicy, setSizePolicy, sizeHint, sizePolicy, updateGeometry, widgetEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QGraphicsGridLayout

public QGraphicsGridLayout()
Constructs a QGraphicsGridLayout instance. parent is passed to QGraphicsLayout's constructor.


QGraphicsGridLayout

public QGraphicsGridLayout(QGraphicsLayoutItemInterface parent)
Constructs a QGraphicsGridLayout instance. parent is passed to QGraphicsLayout's constructor.

Method Detail

addItem

public final void addItem(QGraphicsLayoutItemInterface item,
                          int row,
                          int column,
                          Qt.AlignmentFlag[] alignment)
This is an overloaded method provided for convenience.


addItem

public final void addItem(QGraphicsLayoutItemInterface item,
                          int row,
                          int column)
Adds item to the grid on row and column. You can specify an optional alignment for item.


addItem

public final void addItem(QGraphicsLayoutItemInterface item,
                          int row,
                          int column,
                          Qt.Alignment alignment)
Adds item to the grid on row and column. You can specify an optional alignment for item.


addItem

public final void addItem(QGraphicsLayoutItemInterface item,
                          int row,
                          int column,
                          int rowSpan,
                          int columnSpan,
                          Qt.AlignmentFlag[] alignment)
This is an overloaded method provided for convenience.


addItem

public final void addItem(QGraphicsLayoutItemInterface item,
                          int row,
                          int column,
                          int rowSpan,
                          int columnSpan)
Adds item to the grid on row and column. You can specify a rowSpan and columnSpan and an optional alignment.


addItem

public final void addItem(QGraphicsLayoutItemInterface item,
                          int row,
                          int column,
                          int rowSpan,
                          int columnSpan,
                          Qt.Alignment alignment)
Adds item to the grid on row and column. You can specify a rowSpan and columnSpan and an optional alignment.


alignment

public final Qt.Alignment alignment(QGraphicsLayoutItemInterface item)
Returns the alignment for item.

See also:
setAlignment().


columnAlignment

public final Qt.Alignment columnAlignment(int column)
Returns the alignment for column.

See also:
setColumnAlignment().


columnCount

public final int columnCount()
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).


columnMaximumWidth

public final double columnMaximumWidth(int column)
Returns the maximum width for column.

See also:
setColumnMaximumWidth().


columnMinimumWidth

public final double columnMinimumWidth(int column)
Returns the minimum width for column.

See also:
setColumnMinimumWidth().


columnPreferredWidth

public final double columnPreferredWidth(int column)
Returns the preferred width for column.

See also:
setColumnPreferredWidth().


columnSpacing

public final double columnSpacing(int column)
Returns the column spacing for column.

See also:
setColumnSpacing().


columnStretchFactor

public final int columnStretchFactor(int column)
Returns the stretch factor for column.

See also:
setColumnStretchFactor().


horizontalSpacing

public final double horizontalSpacing()
Returns the default horizontal spacing for the grid layout.

See also:
setHorizontalSpacing().


itemAt

public final QGraphicsLayoutItemInterface itemAt(int row,
                                                 int column)
Returns a pointer to the layout item at (row, column).


rowAlignment

public final Qt.Alignment rowAlignment(int row)
Returns the alignment of row.

See also:
setRowAlignment().


rowCount

public final int rowCount()
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).


rowMaximumHeight

public final double rowMaximumHeight(int row)
Returns the maximum height for row, row.

See also:
setRowMaximumHeight().


rowMinimumHeight

public final double rowMinimumHeight(int row)
Returns the minimum height for row, row.

See also:
setRowMinimumHeight().


rowPreferredHeight

public final double rowPreferredHeight(int row)
Returns the preferred height for row, row.

See also:
setRowPreferredHeight().


rowSpacing

public final double rowSpacing(int row)
Returns the row spacing for row.

See also:
setRowSpacing().


rowStretchFactor

public final int rowStretchFactor(int row)
Returns the stretch factor for row.

See also:
setRowStretchFactor().


setAlignment

public final void setAlignment(QGraphicsLayoutItemInterface item,
                               Qt.AlignmentFlag[] alignment)
This is an overloaded method provided for convenience.


setAlignment

public final void setAlignment(QGraphicsLayoutItemInterface item,
                               Qt.Alignment alignment)
Sets the alignment for item to alignment.

See also:
alignment().


setColumnAlignment

public final void setColumnAlignment(int column,
                                     Qt.AlignmentFlag[] alignment)
This is an overloaded method provided for convenience.


setColumnAlignment

public final void setColumnAlignment(int column,
                                     Qt.Alignment alignment)
Sets the alignment for column to alignment.

See also:
columnAlignment().


setColumnFixedWidth

public final void setColumnFixedWidth(int column,
                                      double width)
Sets the fixed width of column to width.


setColumnMaximumWidth

public final void setColumnMaximumWidth(int column,
                                        double width)
Sets the maximum width of column to width.

See also:
columnMaximumWidth().


setColumnMinimumWidth

public final void setColumnMinimumWidth(int column,
                                        double width)
Sets the minimum width for column to width.

See also:
columnMinimumWidth().


setColumnPreferredWidth

public final void setColumnPreferredWidth(int column,
                                          double width)
Sets the preferred width for column to width.

See also:
columnPreferredWidth().


setColumnSpacing

public final void setColumnSpacing(int column,
                                   double spacing)
Sets the spacing for column to spacing.

See also:
columnSpacing().


setColumnStretchFactor

public final void setColumnStretchFactor(int column,
                                         int stretch)
Sets the stretch factor for column to stretch.

See also:
columnStretchFactor().


setHorizontalSpacing

public final void setHorizontalSpacing(double spacing)
Sets the default horizontal spacing for the grid layout to spacing.

See also:
horizontalSpacing().


setRowAlignment

public final void setRowAlignment(int row,
                                  Qt.AlignmentFlag[] alignment)
This is an overloaded method provided for convenience.


setRowAlignment

public final void setRowAlignment(int row,
                                  Qt.Alignment alignment)
Sets the alignment of row to alignment.

See also:
rowAlignment().


setRowFixedHeight

public final void setRowFixedHeight(int row,
                                    double height)
Sets the fixed height for row, row, to height.


setRowMaximumHeight

public final void setRowMaximumHeight(int row,
                                      double height)
Sets the maximum height for row, row, to height.

See also:
rowMaximumHeight().


setRowMinimumHeight

public final void setRowMinimumHeight(int row,
                                      double height)
Sets the minimum height for row, row, to height.

See also:
rowMinimumHeight().


setRowPreferredHeight

public final void setRowPreferredHeight(int row,
                                        double height)
Sets the preferred height for row, row, to height.

See also:
rowPreferredHeight().


setRowSpacing

public final void setRowSpacing(int row,
                                double spacing)
Sets the spacing for row to spacing.

See also:
rowSpacing().


setRowStretchFactor

public final void setRowStretchFactor(int row,
                                      int stretch)
Sets the stretch factor for row to stretch.

See also:
rowStretchFactor().


setSpacing

public final void setSpacing(double spacing)
Sets the grid layout's default spacing, both vertical and horizontal, to spacing.

See also:
rowSpacing(), and columnSpacing().


setVerticalSpacing

public final void setVerticalSpacing(double spacing)
Sets the default vertical spacing for the grid layout to spacing.

See also:
verticalSpacing().


verticalSpacing

public final double verticalSpacing()
Returns the default vertical spacing for the grid layout.

See also:
setVerticalSpacing().