[QtGui module]
该QGraphicsGridLayout类提供了在图形视图管理部件网格布局。More…
Methods
__init__ (self, QGraphicsLayoutItem parent = None)
addItem (self, QGraphicsLayoutItem item, int row, int column, int rowSpan, int columnSpan, Qt.Alignment alignment = 0)
addItem (self, QGraphicsLayoutItem aitem, int arow, int acolumn, Qt.Alignment alignment = 0)
Qt.Alignment alignment (self, QGraphicsLayoutItem item)
Qt.Alignment columnAlignment (self, int column)
int columnCount (self)
float columnMaximumWidth (self, int column)
float columnMinimumWidth (self, int column)
float columnPreferredWidth (self, int column)
float columnSpacing (self, int column)
int columnStretchFactor (self, int column)
int count (self)
float horizontalSpacing (self)
invalidate (self)
QGraphicsLayoutItem itemAt (self, int row, int column)
QGraphicsLayoutItem itemAt (self, int index)
removeAt (self, int index)
removeItem (self, QGraphicsLayoutItem item)
Qt.Alignment rowAlignment (self, int row)
int rowCount (self)
float rowMaximumHeight (self, int row)
float rowMinimumHeight (self, int row)
float rowPreferredHeight (self, int row)
float rowSpacing (self, int row)
int rowStretchFactor (self, int row)
setAlignment (self, QGraphicsLayoutItem item, Qt.Alignment alignment)
setColumnAlignment (self, int column, Qt.Alignment alignment)
setColumnFixedWidth (self, int column, float width)
setColumnMaximumWidth (self, int column, float width)
setColumnMinimumWidth (self, int column, float width)
setColumnPreferredWidth (self, int column, float width)
setColumnSpacing (self, int column, float spacing)
setColumnStretchFactor (self, int column, int stretch)
setGeometry (self, QRectF rect)
setHorizontalSpacing (self, float spacing)
setRowAlignment (self, int row, Qt.Alignment alignment)
setRowFixedHeight (self, int row, float height)
setRowMaximumHeight (self, int row, float height)
setRowMinimumHeight (self, int row, float height)
setRowPreferredHeight (self, int row, float height)
setRowSpacing (self, int row, float spacing)
setRowStretchFactor (self, int row, int stretch)
setSpacing (self, float spacing)
setVerticalSpacing (self, float spacing)
QSizeF sizeHint (self, Qt.SizeHint which, QSizeF constraint = QSizeF())
float verticalSpacing (self)
Detailed Description
该QGraphicsGridLayout类提供了在图形视图管理部件网格布局。
使用QGraphicsGridLayout最常用的方法是通过调用构造一个对象在堆中,没有父母,添加控件和布局addItem() ,最后是布局呼叫分配给一个小部件QGraphicsWidget.setLayout( ) 。当您添加的项目QGraphicsGridLayout自动计算网格的尺寸。
[QGraphicsScene](docs_qgraphicsscene.html) scene;
[QGraphicsWidget](docs_qgraphicswidget.html) *textEdit = scene.addWidget(new [QTextEdit](docs_qtextedit.html));
[QGraphicsWidget](docs_qgraphicswidget.html) *pushButton = scene.addWidget(new [QPushButton](docs_qpushbutton.html));
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
layout->addItem(textEdit, 0, 0);
layout->addItem(pushButton, 0, 1);
[QGraphicsWidget](docs_qgraphicswidget.html) *form = new [QGraphicsWidget](docs_qgraphicswidget.html);
form->setLayout(layout);
scene.addItem(form);
布局需要的物品的所有权。在某些情况下,当项目的布局也继承自QGraphicsItem(如QGraphicsWidget)会有因为布局项目属于两个层次的所有权所有权的模糊性。看到的文档QGraphicsLayoutItem.setOwnedByLayout( )如何处理这个问题。你可以通过调用访问布局每个项目count()和itemAt( ) 。调用removeAt( )会从布局中删除某个项目,而不破坏它。
Size Hints and Size Policies in QGraphicsGridLayout
QGraphicsGridLayout尊重每个项目的大小提示和大小政策,并在网格中的一个单元格有更多的空间比项目可以填写,每个项目是根据该项目的布局的对齐方式排列。你可以通过调用设置每个项目的对齐方式setAlignment( ) ,并通过调用检查对齐任何项目alignment( ) 。您也可以通过调用设置的对齐方式为整个行或列setRowAlignment()和setColumnAlignment( )分别。默认情况下,项目是一致的左上角。
Method Documentation
QGraphicsGridLayout.__init__ (self, QGraphicsLayoutItem parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个QGraphicsGridLayout实例。parent被传递给QGraphicsLayout的构造。
QGraphicsGridLayout.addItem (self, QGraphicsLayoutItem item, int row, int column, int rowSpan, int columnSpan, Qt.Alignment alignment = 0)
该item说法有它的所有权转移给Qt的。
添加item到网格上row和column。您可以指定一个rowSpan和columnSpan和可选的alignment。
QGraphicsGridLayout.addItem (self, QGraphicsLayoutItem aitem, int arow, int acolumn, Qt.Alignment alignment = 0)
该aitem的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
添加item到网格上row和column。您可以指定一个可选的alignment为item。
Qt.Alignment QGraphicsGridLayout.alignment (self, QGraphicsLayoutItem item)
[
返回对齐item。
](docs_index.htm)
See also setAlignment( ) 。
Qt.Alignment QGraphicsGridLayout.columnAlignment (self, int column)
[
返回对齐column。
](docs_index.htm)
See also setColumnAlignment( ) 。
int QGraphicsGridLayout.columnCount (self)
返回列的网格布局的数目。这总是比由布局项目佔据的最后一列的索引多一个(空列计数除了那些在最后) 。
float QGraphicsGridLayout.columnMaximumWidth (self, int column)
返回的最大宽度column。
See also setColumnMaximumWidth( ) 。
float QGraphicsGridLayout.columnMinimumWidth (self, int column)
返回的最小宽度column。
See also setColumnMinimumWidth( ) 。
float QGraphicsGridLayout.columnPreferredWidth (self, int column)
返回首选宽度column。
See also setColumnPreferredWidth( ) 。
float QGraphicsGridLayout.columnSpacing (self, int column)
返回列间距column。
See also setColumnSpacing( ) 。
int QGraphicsGridLayout.columnStretchFactor (self, int column)
返回的拉伸因子column。
See also setColumnStretchFactor( ) 。
int QGraphicsGridLayout.count (self)
从重新实现QGraphicsLayout.count( ) 。
返回布局的项目在此网格布局的数量。
float QGraphicsGridLayout.horizontalSpacing (self)
返回默认的水平间距的网格布局。
See also setHorizontalSpacing( ) 。
QGraphicsGridLayout.invalidate (self)
从重新实现QGraphicsLayout.invalidate( ) 。
QGraphicsLayoutItem QGraphicsGridLayout.itemAt (self, int row, int column)
[
返回一个指针布局项目时(row,column) 。
](docs_qgraphicslayoutitem.html)
QGraphicsLayoutItem QGraphicsGridLayout.itemAt (self, int index)
从重新实现QGraphicsLayout.itemAt( ) 。
返回位于布局项目index,或者0 ,如果没有布局这个项目索引处。
QGraphicsGridLayout.removeAt (self, int index)
从重新实现QGraphicsLayout.removeAt( ) 。
删除的项目布局index不破坏它。该项目的所有权转移给调用者。
See also addItem( ) 。
QGraphicsGridLayout.removeItem (self, QGraphicsLayoutItem item)
该item争论
删除布局项目item不破坏它。该项目的所有权转移给调用者。
此功能被引入Qt的4.8 。
See also addItem( ) 。
Qt.Alignment QGraphicsGridLayout.rowAlignment (self, int row)
[
返回的对齐方式row。
](docs_index.htm)
See also setRowAlignment( ) 。
int QGraphicsGridLayout.rowCount (self)
返回行的网格布局的数量。这总是比由布局项目佔据的最后一行的索引多一个(空的行计数,除了那些在最后) 。
float QGraphicsGridLayout.rowMaximumHeight (self, int row)
返回的最大高度为行,row。
See also setRowMaximumHeight( ) 。
float QGraphicsGridLayout.rowMinimumHeight (self, int row)
返回的最小高度为行,row。
See also setRowMinimumHeight( ) 。
float QGraphicsGridLayout.rowPreferredHeight (self, int row)
返回该行的首选高度,row。
See also setRowPreferredHeight( ) 。
float QGraphicsGridLayout.rowSpacing (self, int row)
返回的行间距row。
See also setRowSpacing( ) 。
int QGraphicsGridLayout.rowStretchFactor (self, int row)
返回的拉伸因子row。
See also setRowStretchFactor( ) 。
QGraphicsGridLayout.setAlignment (self, QGraphicsLayoutItem item, Qt.Alignment alignment)
设置对齐方式item至alignment。
See also alignment( ) 。
QGraphicsGridLayout.setColumnAlignment (self, int column, Qt.Alignment alignment)
设置对齐方式column至alignment。
See also columnAlignment( ) 。
QGraphicsGridLayout.setColumnFixedWidth (self, int column, float width)
设置的固定宽度column至width。
QGraphicsGridLayout.setColumnMaximumWidth (self, int column, float width)
设定的最大宽度column至width。
See also columnMaximumWidth( ) 。
QGraphicsGridLayout.setColumnMinimumWidth (self, int column, float width)
设置为最小宽度column至width。
See also columnMinimumWidth( ) 。
QGraphicsGridLayout.setColumnPreferredWidth (self, int column, float width)
设置为首选宽度column至width。
See also columnPreferredWidth( ) 。
QGraphicsGridLayout.setColumnSpacing (self, int column, float spacing)
设置间距column至spacing。
See also columnSpacing( ) 。
QGraphicsGridLayout.setColumnStretchFactor (self, int column, int stretch)
设置为拉伸因子column至stretch。
See also columnStretchFactor( ) 。
QGraphicsGridLayout.setGeometry (self, QRectF rect)
从重新实现QGraphicsLayoutItem.setGeometry( ) 。
设置网格布局的边界几何rect。
QGraphicsGridLayout.setHorizontalSpacing (self, float spacing)
设置默认的水平间距网格布局spacing。
See also horizontalSpacing( ) 。
QGraphicsGridLayout.setRowAlignment (self, int row, Qt.Alignment alignment)
设置的对齐方式row至alignment。
See also rowAlignment( ) 。
QGraphicsGridLayout.setRowFixedHeight (self, int row, float height)
设置为行的固定高度,row,以height。
QGraphicsGridLayout.setRowMaximumHeight (self, int row, float height)
设置最大高度为行,row,以height。
See also rowMaximumHeight( ) 。
QGraphicsGridLayout.setRowMinimumHeight (self, int row, float height)
设置最小高度为行,row,以height。
See also rowMinimumHeight( ) 。
QGraphicsGridLayout.setRowPreferredHeight (self, int row, float height)
设置为行的首选高度,row,以height。
See also rowPreferredHeight( ) 。
QGraphicsGridLayout.setRowSpacing (self, int row, float spacing)
设置间距row至spacing。
See also rowSpacing( ) 。
QGraphicsGridLayout.setRowStretchFactor (self, int row, int stretch)
设置为拉伸因子row至stretch。
See also rowStretchFactor( ) 。
QGraphicsGridLayout.setSpacing (self, float spacing)
设置网格布局的预设间距,垂直和水平,以spacing。
See also rowSpacing()和columnSpacing( ) 。
QGraphicsGridLayout.setVerticalSpacing (self, float spacing)
设置网格布局为默认的垂直间距spacing。
See also verticalSpacing( ) 。
QSizeF QGraphicsGridLayout.sizeHint (self, Qt.SizeHint which, QSizeF constraint = QSizeF())
从重新实现QGraphicsLayoutItem.sizeHint( ) 。
float QGraphicsGridLayout.verticalSpacing (self)
返回网格布局默认的垂直间距。
See also setVerticalSpacing( ) 。