Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QGraphicsGridLayout Class Reference

The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View. More...

Inheritance diagram for QtGui.QGraphicsGridLayout:
Collaboration diagram for QtGui.QGraphicsGridLayout:

Public Member Functions

 QGraphicsGridLayout (IQGraphicsLayoutItem parent=null)
 
 
override void CreateProxy ()
 
new void AddItem (IQGraphicsLayoutItem item, int row, int column, Qt.AlignmentFlag alignment=0)
 
 
new void AddItem (IQGraphicsLayoutItem item, int row, int column, int rowSpan, int columnSpan, Qt.AlignmentFlag alignment=0)
 
 
new Qt.AlignmentFlag Alignment (IQGraphicsLayoutItem item)
 
 
new Qt.AlignmentFlag ColumnAlignment (int column)
 
 
new int ColumnCount ()
 
 
new double ColumnMaximumWidth (int column)
 
 
new double ColumnMinimumWidth (int column)
 
 
new double ColumnPreferredWidth (int column)
 
 
new double ColumnSpacing (int column)
 
 
new int ColumnStretchFactor (int column)
 
 
override int Count ()
 
 
override void Invalidate ()
 
 
override IQGraphicsLayoutItem ItemAt (int index)
 
 
new IQGraphicsLayoutItem ItemAt (int row, int column)
 
 
override void RemoveAt (int index)
 
 
new void RemoveItem (IQGraphicsLayoutItem item)
 
 
new Qt.AlignmentFlag RowAlignment (int row)
 
 
new int RowCount ()
 
 
new double RowMaximumHeight (int row)
 
 
new double RowMinimumHeight (int row)
 
 
new double RowPreferredHeight (int row)
 
 
new double RowSpacing (int row)
 
 
new int RowStretchFactor (int row)
 
 
new void SetAlignment (IQGraphicsLayoutItem item, Qt.AlignmentFlag alignment)
 
 
new void SetColumnAlignment (int column, Qt.AlignmentFlag alignment)
 
 
new void SetColumnFixedWidth (int column, double width)
 
 
new void SetColumnMaximumWidth (int column, double width)
 
 
new void SetColumnMinimumWidth (int column, double width)
 
 
new void SetColumnPreferredWidth (int column, double width)
 
 
new void SetColumnSpacing (int column, double spacing)
 
 
new void SetColumnStretchFactor (int column, int stretch)
 
 
new void SetRowAlignment (int row, Qt.AlignmentFlag alignment)
 
 
new void SetRowFixedHeight (int row, double height)
 
 
new void SetRowMaximumHeight (int row, double height)
 
 
new void SetRowMinimumHeight (int row, double height)
 
 
new void SetRowPreferredHeight (int row, double height)
 
 
new void SetRowSpacing (int row, double spacing)
 
 
new void SetRowStretchFactor (int row, int stretch)
 
 
new void SetSpacing (double spacing)
 
 
new QSizeF SizeHint (Qt.SizeHint which)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QGraphicsLayout
 QGraphicsLayout (IQGraphicsLayoutItem parent=null)
 
 
override void CreateProxy ()
 
new void Activate ()
 
 
override void GetContentsMargins (ref double left, ref double top, ref double right, ref double bottom)
 
 
new bool IsActivated ()
 
 
new void SetContentsMargins (double left, double top, double right, double bottom)
 
 
override void UpdateGeometry ()
 
 
virtual void OnWidgetEvent (QEvent e)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QGraphicsLayoutItem
 QGraphicsLayoutItem (IQGraphicsLayoutItem parent=null, bool isLayout=false)
 
 
new QRectF ContentsRect ()
 
 
new QSizeF EffectiveSizeHint (Qt.SizeHint which)
 
 
new QSizeF EffectiveSizeHint (Qt.SizeHint which, QSizeF constraint)
 
 
new IQGraphicsItem GraphicsItem ()
 
 
new bool IsLayout ()
 
 
new bool OwnedByLayout ()
 
 
new void SetMaximumSize (double w, double h)
 
 
new void SetMinimumSize (double w, double h)
 
 
new void SetPreferredSize (double w, double h)
 
 
new void SetSizePolicy (QSizePolicy.Policy hPolicy, QSizePolicy.Policy vPolicy, QSizePolicy.ControlType controlType=QSizePolicy.ControlType.DefaultType)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.IQGraphicsLayoutItem
new QRectF ContentsRect ()
 
new QSizeF EffectiveSizeHint (Qt.SizeHint which)
 
new QSizeF EffectiveSizeHint (Qt.SizeHint which, QSizeF constraint)
 
void GetContentsMargins (ref double left, ref double top, ref double right, ref double bottom)
 
new IQGraphicsItem GraphicsItem ()
 
new bool IsLayout ()
 
new bool OwnedByLayout ()
 
new void SetMaximumSize (double w, double h)
 
new void SetMinimumSize (double w, double h)
 
new void SetPreferredSize (double w, double h)
 
new void SetSizePolicy (QSizePolicy.Policy hPolicy, QSizePolicy.Policy vPolicy, QSizePolicy.ControlType controlType=QSizePolicy.ControlType.DefaultType)
 
void UpdateGeometry ()
 

Protected Member Functions

 QGraphicsGridLayout (System.Type dummy)
 
override QSizeF SizeHint (Qt.SizeHint which, QSizeF constraint)
 
 
- Protected Member Functions inherited from QtGui.QGraphicsLayout
 QGraphicsLayout (System.Type dummy)
 
new void AddChildLayoutItem (IQGraphicsLayoutItem layoutItem)
 
 
- Protected Member Functions inherited from QtGui.QGraphicsLayoutItem
 QGraphicsLayoutItem (System.Type dummy)
 
new void SetGraphicsItem (IQGraphicsItem item)
 
 
new void SetOwnedByLayout (bool ownedByLayout)
 
 
new QSizeF SizeHint (Qt.SizeHint which)
 
 

Properties

override QRectF Geometry [get, set]
 
 
new double HorizontalSpacing [get, set]
 
 
new double VerticalSpacing [get, set]
 
 
- Properties inherited from QtGui.QGraphicsLayout
static bool InstantInvalidatePropagation [get, set]
 
 
- Properties inherited from QtGui.QGraphicsLayoutItem
virtual QRectF Geometry [get, set]
 
 
new double MaximumHeight [get, set]
 
 
new QSizeF MaximumSize [get, set]
 
 
new double MaximumWidth [get, set]
 
 
new double MinimumHeight [get, set]
 
 
new QSizeF MinimumSize [get, set]
 
 
new double MinimumWidth [get, set]
 
 
new IQGraphicsLayoutItem ParentLayoutItem [get, set]
 
 
new double PreferredHeight [get, set]
 
 
new QSizeF PreferredSize [get, set]
 
 
new double PreferredWidth [get, set]
 
 
new QSizePolicy SizePolicy [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
- Properties inherited from QtGui.IQGraphicsLayoutItem
QRectF Geometry [get, set]
 
System.Double MaximumHeight [get, set]
 
QSizeF MaximumSize [get, set]
 
System.Double MaximumWidth [get, set]
 
System.Double MinimumHeight [get, set]
 
QSizeF MinimumSize [get, set]
 
System.Double MinimumWidth [get, set]
 
IQGraphicsLayoutItem ParentLayoutItem [get, set]
 
System.Double PreferredHeight [get, set]
 
QSizeF PreferredSize [get, set]
 
System.Double PreferredWidth [get, set]
 
QSizePolicy SizePolicy [get, set]
 

Additional Inherited Members

- Protected Attributes inherited from QtGui.QGraphicsLayoutItem
SmokeInvocation interceptor
 

Detailed Description

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.

Size Hints and Size Policies in QGraphicsGridLayout

QGraphicsGridLayout respects each item's size hints and size policies, and when a cell in the grid has more space than the items can fill, each item is arranged according to the layout's alignment for that item. You can set an alignment for each item by calling setAlignment(), and check the alignment for any item by calling alignment(). You can also set the alignment for an entire row or column by calling setRowAlignment() and setColumnAlignment() respectively. By default, items are aligned to the top left.

See also QGraphicsLinearLayout and QGraphicsWidget.

Constructor & Destructor Documentation

QtGui.QGraphicsGridLayout.QGraphicsGridLayout ( System.Type  dummy)
protected
QtGui.QGraphicsGridLayout.QGraphicsGridLayout ( IQGraphicsLayoutItem  parent = null)

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

Member Function Documentation

new void QtGui.QGraphicsGridLayout.AddItem ( IQGraphicsLayoutItem  item,
int  row,
int  column,
Qt.AlignmentFlag  alignment = 0 
)

Adds item to the grid on row and column. You can specify a rowSpan and columnSpan and an optional alignment.

new void QtGui.QGraphicsGridLayout.AddItem ( IQGraphicsLayoutItem  item,
int  row,
int  column,
int  rowSpan,
int  columnSpan,
Qt.AlignmentFlag  alignment = 0 
)

Adds item to the grid on row and column. You can specify a rowSpan and columnSpan and an optional alignment.

new Qt.AlignmentFlag QtGui.QGraphicsGridLayout.Alignment ( IQGraphicsLayoutItem  item)

Returns the alignment for item.

See also setAlignment().

new Qt.AlignmentFlag QtGui.QGraphicsGridLayout.ColumnAlignment ( int  column)

Returns the alignment for column.

See also setColumnAlignment().

new int QtGui.QGraphicsGridLayout.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).

new double QtGui.QGraphicsGridLayout.ColumnMaximumWidth ( int  column)

Returns the maximum width for column.

See also setColumnMaximumWidth().

new double QtGui.QGraphicsGridLayout.ColumnMinimumWidth ( int  column)

Returns the minimum width for column.

See also setColumnMinimumWidth().

new double QtGui.QGraphicsGridLayout.ColumnPreferredWidth ( int  column)

Returns the preferred width for column.

See also setColumnPreferredWidth().

new double QtGui.QGraphicsGridLayout.ColumnSpacing ( int  column)

Returns the column spacing for column.

See also setColumnSpacing().

new int QtGui.QGraphicsGridLayout.ColumnStretchFactor ( int  column)

Returns the stretch factor for column.

See also setColumnStretchFactor().

override int QtGui.QGraphicsGridLayout.Count ( )
virtual

Reimplemented from QGraphicsLayout::count().

Returns the number of layout items in this grid layout.

Implements QtGui.QGraphicsLayout.

override void QtGui.QGraphicsGridLayout.CreateProxy ( )
virtual

Reimplemented from QtGui.QGraphicsLayoutItem.

new void QtGui.QGraphicsGridLayout.Dispose ( )
override void QtGui.QGraphicsGridLayout.Invalidate ( )
virtual

Reimplemented from QGraphicsLayout::invalidate().

Reimplemented from QtGui.QGraphicsLayout.

override IQGraphicsLayoutItem QtGui.QGraphicsGridLayout.ItemAt ( int  index)
virtual

Reimplemented from QGraphicsLayout::itemAt().

Returns the layout item at index, or 0 if there is no layout item at this index.

Implements QtGui.QGraphicsLayout.

new IQGraphicsLayoutItem QtGui.QGraphicsGridLayout.ItemAt ( int  row,
int  column 
)

Returns a pointer to the layout item at (row, column).

override void QtGui.QGraphicsGridLayout.RemoveAt ( int  index)
virtual

Reimplemented from QGraphicsLayout::removeAt().

Removes the layout item at index without destroying it. Ownership of the item is transferred to the caller.

See also addItem().

Implements QtGui.QGraphicsLayout.

new void QtGui.QGraphicsGridLayout.RemoveItem ( IQGraphicsLayoutItem  item)

Removes the layout item item without destroying it. Ownership of the item is transferred to the caller.

This function was introduced in Qt 4.8.

See also addItem().

new Qt.AlignmentFlag QtGui.QGraphicsGridLayout.RowAlignment ( int  row)

Returns the alignment of row.

See also setRowAlignment().

new int QtGui.QGraphicsGridLayout.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).

new double QtGui.QGraphicsGridLayout.RowMaximumHeight ( int  row)

Returns the maximum height for row, row.

See also setRowMaximumHeight().

new double QtGui.QGraphicsGridLayout.RowMinimumHeight ( int  row)

Returns the minimum height for row, row.

See also setRowMinimumHeight().

new double QtGui.QGraphicsGridLayout.RowPreferredHeight ( int  row)

Returns the preferred height for row, row.

See also setRowPreferredHeight().

new double QtGui.QGraphicsGridLayout.RowSpacing ( int  row)

Returns the row spacing for row.

See also setRowSpacing().

new int QtGui.QGraphicsGridLayout.RowStretchFactor ( int  row)

Returns the stretch factor for row.

See also setRowStretchFactor().

new void QtGui.QGraphicsGridLayout.SetAlignment ( IQGraphicsLayoutItem  item,
Qt.AlignmentFlag  alignment 
)

Sets the alignment for item to alignment.

See also alignment().

new void QtGui.QGraphicsGridLayout.SetColumnAlignment ( int  column,
Qt.AlignmentFlag  alignment 
)

Sets the alignment for column to alignment.

See also columnAlignment().

new void QtGui.QGraphicsGridLayout.SetColumnFixedWidth ( int  column,
double  width 
)

Sets the fixed width of column to width.

new void QtGui.QGraphicsGridLayout.SetColumnMaximumWidth ( int  column,
double  width 
)

Sets the maximum width of column to width.

See also columnMaximumWidth().

new void QtGui.QGraphicsGridLayout.SetColumnMinimumWidth ( int  column,
double  width 
)

Sets the minimum width for column to width.

See also columnMinimumWidth().

new void QtGui.QGraphicsGridLayout.SetColumnPreferredWidth ( int  column,
double  width 
)

Sets the preferred width for column to width.

See also columnPreferredWidth().

new void QtGui.QGraphicsGridLayout.SetColumnSpacing ( int  column,
double  spacing 
)

Sets the spacing for column to spacing.

See also columnSpacing().

new void QtGui.QGraphicsGridLayout.SetColumnStretchFactor ( int  column,
int  stretch 
)

Sets the stretch factor for column to stretch.

See also columnStretchFactor().

new void QtGui.QGraphicsGridLayout.SetRowAlignment ( int  row,
Qt.AlignmentFlag  alignment 
)

Sets the alignment of row to alignment.

See also rowAlignment().

new void QtGui.QGraphicsGridLayout.SetRowFixedHeight ( int  row,
double  height 
)

Sets the fixed height for row, row, to height.

new void QtGui.QGraphicsGridLayout.SetRowMaximumHeight ( int  row,
double  height 
)

Sets the maximum height for row, row, to height.

See also rowMaximumHeight().

new void QtGui.QGraphicsGridLayout.SetRowMinimumHeight ( int  row,
double  height 
)

Sets the minimum height for row, row, to height.

See also rowMinimumHeight().

new void QtGui.QGraphicsGridLayout.SetRowPreferredHeight ( int  row,
double  height 
)

Sets the preferred height for row, row, to height.

See also rowPreferredHeight().

new void QtGui.QGraphicsGridLayout.SetRowSpacing ( int  row,
double  spacing 
)

Sets the spacing for row to spacing.

See also rowSpacing().

new void QtGui.QGraphicsGridLayout.SetRowStretchFactor ( int  row,
int  stretch 
)

Sets the stretch factor for row to stretch.

See also rowStretchFactor().

new void QtGui.QGraphicsGridLayout.SetSpacing ( double  spacing)

Sets the grid layout's default spacing, both vertical and horizontal, to spacing.

See also rowSpacing() and columnSpacing().

new QSizeF QtGui.QGraphicsGridLayout.SizeHint ( Qt.SizeHint  which)

Reimplemented from QGraphicsLayoutItem::sizeHint().

override QSizeF QtGui.QGraphicsGridLayout.SizeHint ( Qt.SizeHint  which,
QSizeF  constraint 
)
protectedvirtual

Reimplemented from QGraphicsLayoutItem::sizeHint().

Implements QtGui.QGraphicsLayoutItem.

Property Documentation

override QRectF QtGui.QGraphicsGridLayout.Geometry
getset

Reimplemented from QGraphicsLayoutItem::setGeometry().

Sets the bounding geometry of the grid layout to rect.

new double QtGui.QGraphicsGridLayout.HorizontalSpacing
getset

Returns the default horizontal spacing for the grid layout.

Sets the default horizontal spacing for the grid layout to spacing.

new double QtGui.QGraphicsGridLayout.VerticalSpacing
getset

Returns the default vertical spacing for the grid layout.

Sets the default vertical spacing for the grid layout to spacing.