QGraphicsGridLayout

概要

函数

详细描述

PySide.QtGui.QGraphicsGridLayout 类提供在图形视图管理 Widget 的栅格。

The most common way to use PySide.QtGui.QGraphicsGridLayout is to construct an object on the heap with no parent, add widgets and layouts by calling PySide.QtGui.QGraphicsGridLayout.addItem() , and finally assign the layout to a widget by calling QGraphicsWidget.setLayout() . PySide.QtGui.QGraphicsGridLayout automatically computes the dimensions of the grid as you add items.

scene = QGraphicsScene()
textEdit = scene.addWidget(QTextEdit())
pushButton = scene.addWidget(QPushButton())
layout = QGraphicsGridLayout()
layout.addItem(textEdit, 0, 0)
layout.addItem(pushButton, 0, 1)
form = QGraphicsWidget()
form.setLayout(layout)
scene.addItem(form)
										

The layout takes ownership of the items. In some cases when the layout item also inherits from PySide.QtGui.QGraphicsItem (譬如 PySide.QtGui.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 PySide.QtGui.QGraphicsGridLayout.count() and PySide.QtGui.QGraphicsGridLayout.itemAt() 。调用 PySide.QtGui.QGraphicsGridLayout.removeAt() will remove an item from the layout, without destroying it.

在 QGraphicsGridLayout 中的尺寸提示和尺寸策略

PySide.QtGui.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 PySide.QtGui.QGraphicsGridLayout.setAlignment() , and check the alignment for any item by calling PySide.QtGui.QGraphicsGridLayout.alignment() . You can also set the alignment for an entire row or column by calling PySide.QtGui.QGraphicsGridLayout.setRowAlignment() and PySide.QtGui.QGraphicsGridLayout.setColumnAlignment() respectively. By default, items are aligned to the top left.

class PySide.QtGui. QGraphicsGridLayout ( [ parent=None ] )
参数: parent PySide.QtGui.QGraphicsLayoutItem

构造 PySide.QtGui.QGraphicsGridLayout 实例。 parent 会被传递给 PySide.QtGui.QGraphicsLayout ‘s constructor.

PySide.QtGui.QGraphicsGridLayout. addItem ( item , row , column , rowSpan , columnSpan [ , alignment=0 ] )
参数:
  • item PySide.QtGui.QGraphicsLayoutItem
  • row PySide.QtCore.int
  • column PySide.QtCore.int
  • rowSpan PySide.QtCore.int
  • columnSpan PySide.QtCore.int
  • alignment PySide.QtCore.Qt.Alignment
PySide.QtGui.QGraphicsGridLayout. addItem ( item , row , column [ , alignment=0 ] )
参数:
PySide.QtGui.QGraphicsGridLayout. alignment ( item )
参数: item PySide.QtGui.QGraphicsLayoutItem
返回类型: PySide.QtCore.Qt.Alignment

返回对齐方式为 item .

PySide.QtGui.QGraphicsGridLayout. columnAlignment ( column )
参数: column PySide.QtCore.int
返回类型: PySide.QtCore.Qt.Alignment

返回对齐方式为 column .

PySide.QtGui.QGraphicsGridLayout. columnCount ( )
返回类型: PySide.QtCore.int

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).

PySide.QtGui.QGraphicsGridLayout. columnMaximumWidth ( column )
参数: column PySide.QtCore.int
返回类型: PySide.QtCore.qreal

返回最大宽度为 column .

PySide.QtGui.QGraphicsGridLayout. columnMinimumWidth ( column )
参数: column PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the minimum width for column .

PySide.QtGui.QGraphicsGridLayout. columnPreferredWidth ( column )
参数: column PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the preferred width for column .

PySide.QtGui.QGraphicsGridLayout. columnSpacing ( column )
参数: column PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the column spacing for column .

PySide.QtGui.QGraphicsGridLayout. columnStretchFactor ( column )
参数: column PySide.QtCore.int
返回类型: PySide.QtCore.int

Returns the stretch factor for column .

PySide.QtGui.QGraphicsGridLayout. horizontalSpacing ( )
返回类型: PySide.QtCore.qreal

Returns the default horizontal spacing for the grid layout.

PySide.QtGui.QGraphicsGridLayout. itemAt ( row , column )
参数:
  • row PySide.QtCore.int
  • column PySide.QtCore.int
返回类型:

PySide.QtGui.QGraphicsLayoutItem

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

PySide.QtGui.QGraphicsGridLayout. removeItem ( item )
参数: item PySide.QtGui.QGraphicsLayoutItem

移除布局项 item without destroying it. Ownership of the item is transferred to the caller.

PySide.QtGui.QGraphicsGridLayout. rowAlignment ( row )
参数: row PySide.QtCore.int
返回类型: PySide.QtCore.Qt.Alignment

Returns the alignment of row .

PySide.QtGui.QGraphicsGridLayout. rowCount ( )
返回类型: PySide.QtCore.int

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).

PySide.QtGui.QGraphicsGridLayout. rowMaximumHeight ( row )
参数: row PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the maximum height for row, row .

PySide.QtGui.QGraphicsGridLayout. rowMinimumHeight ( row )
参数: row PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the minimum height for row, row .

PySide.QtGui.QGraphicsGridLayout. rowPreferredHeight ( row )
参数: row PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the preferred height for row, row .

PySide.QtGui.QGraphicsGridLayout. rowSpacing ( row )
参数: row PySide.QtCore.int
返回类型: PySide.QtCore.qreal

Returns the row spacing for row .

PySide.QtGui.QGraphicsGridLayout. rowStretchFactor ( row )
参数: row PySide.QtCore.int
返回类型: PySide.QtCore.int

Returns the stretch factor for row .

PySide.QtGui.QGraphicsGridLayout. setAlignment ( item , alignment )
参数:
PySide.QtGui.QGraphicsGridLayout. setColumnAlignment ( column , alignment )
参数:
  • column PySide.QtCore.int
  • alignment PySide.QtCore.Qt.Alignment
PySide.QtGui.QGraphicsGridLayout. setColumnFixedWidth ( column , width )
参数:
  • column PySide.QtCore.int
  • width PySide.QtCore.qreal

Sets the fixed width of column to width .

PySide.QtGui.QGraphicsGridLayout. setColumnMaximumWidth ( column , width )
参数:
  • column PySide.QtCore.int
  • width PySide.QtCore.qreal

Sets the maximum width of column to width .

PySide.QtGui.QGraphicsGridLayout. setColumnMinimumWidth ( column , width )
参数:
  • column PySide.QtCore.int
  • width PySide.QtCore.qreal

Sets the minimum width for column to width .

PySide.QtGui.QGraphicsGridLayout. setColumnPreferredWidth ( column , width )
参数:
  • column PySide.QtCore.int
  • width PySide.QtCore.qreal

Sets the preferred width for column to width .

PySide.QtGui.QGraphicsGridLayout. setColumnSpacing ( column , spacing )
参数:
  • column PySide.QtCore.int
  • spacing PySide.QtCore.qreal

Sets the spacing for column to spacing .

PySide.QtGui.QGraphicsGridLayout. setColumnStretchFactor ( column , stretch )
参数:
  • column PySide.QtCore.int
  • stretch PySide.QtCore.int

设置拉伸因子为 column to stretch .

PySide.QtGui.QGraphicsGridLayout. setHorizontalSpacing ( spacing )
参数: spacing PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. setRowAlignment ( row , alignment )
参数:
  • row PySide.QtCore.int
  • alignment PySide.QtCore.Qt.Alignment
PySide.QtGui.QGraphicsGridLayout. setRowFixedHeight ( row , height )
参数:
  • row PySide.QtCore.int
  • height PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. setRowMaximumHeight ( row , height )
参数:
  • row PySide.QtCore.int
  • height PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. setRowMinimumHeight ( row , height )
参数:
  • row PySide.QtCore.int
  • height PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. setRowPreferredHeight ( row , height )
参数:
  • row PySide.QtCore.int
  • height PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. setRowSpacing ( row , spacing )
参数:
  • row PySide.QtCore.int
  • spacing PySide.QtCore.qreal

Sets the spacing for row to spacing .

PySide.QtGui.QGraphicsGridLayout. setRowStretchFactor ( row , stretch )
参数:
  • row PySide.QtCore.int
  • stretch PySide.QtCore.int

设置拉伸因子为 row to stretch .

PySide.QtGui.QGraphicsGridLayout. setSpacing ( spacing )
参数: spacing PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. setVerticalSpacing ( spacing )
参数: spacing PySide.QtCore.qreal

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

PySide.QtGui.QGraphicsGridLayout. verticalSpacing ( )
返回类型: PySide.QtCore.qreal

Returns the default vertical spacing for the grid layout.