qgridlayout.3qt
来自「tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件」· 3QT 代码 · 共 266 行
3QT
266 行
.TH QGridLayout 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQGridLayout \- Lays out widgets in a grid.SH SYNOPSIS.br.PP\fC#include <qlayout.h>\fR.PPInherits QLayout..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQGridLayout\fR ( QWidget * " "parent" ", int " "nRows" ", int " "nCols" ", int " "border" "=0, int " "space" " = -1, const char * " "name" "=0 )".br.ti -1c.BI "\fBQGridLayout\fR ( int " "nRows" ", int " "nCols" ", int " "space" " = -1, const char * " "name" "=0 )".br.ti -1c.BI "\fBQGridLayout\fR ( QLayout * " "parentLayout" ", int " "nRows" ", int " "nCols" ", int " "space" " = -1, const char * " "name" "=0 )".br.ti -1c.BI "\fB~QGridLayout\fR ()".br.ti -1c.BI "QSize \fBsizeHint\fR () const".br.ti -1c.BI "virtual QSize \fBminimumSize\fR () const".br.ti -1c.BI "virtual QSize \fBmaximumSize\fR () const".br.ti -1c.BI "virtual void \fBsetRowStretch\fR ( int " "row" ", int stretch )".br.ti -1c.BI "virtual void \fBsetColStretch\fR ( int " "col" ", int stretch )".br.ti -1c.BI "int \fBnumRows\fR () const".br.ti -1c.BI "int \fBnumCols\fR () const".br.ti -1c.BI "virtual bool \fBhasHeightForWidth\fR () const".br.ti -1c.BI "virtual int \fBheightForWidth\fR ( int ) const".br.ti -1c.BI "virtual QSizePolicy::ExpandData \fBexpanding\fR () const".br.ti -1c.BI "virtual void \fBinvalidate\fR ()".br.ti -1c.BI "virtual void \fBaddItem\fR ( QLayoutItem * )".br.ti -1c.BI "void \fBaddMultiCell\fR ( QLayoutItem *, int " "fromRow" ", int " "toRow" ", int " "fromCol" ", int " "toCol" ", int " "align" " = 0 )".br.ti -1c.BI "void \fBaddWidget\fR ( QWidget *, int " "row" ", int " "col" ", int " "align" " = 0 )".br.ti -1c.BI "void \fBaddMultiCellWidget\fR ( QWidget *, int " "fromRow" ", int " "toRow" ", int " "fromCol" ", int " "toCol" ", int " "align" " = 0 )".br.ti -1c.BI "void \fBaddLayout\fR ( QLayout * " "layout" ", int " "row" ", int col )".br.ti -1c.BI "void \fBaddRowSpacing\fR ( int " "row" ", int minsize )".br.ti -1c.BI "void \fBaddColSpacing\fR ( int " "col" ", int minsize )".br.ti -1c.BI "void \fBexpand\fR ( int " "rows" ", int cols )".br.ti -1c.BI "enum \fBCorner\fR { TopLeft, TopRight, BottomLeft, BottomRight }".br.ti -1c.BI "void \fBsetOrigin\fR ( Corner )".br.ti -1c.BI "virtual QLayoutIterator \fBiterator\fR ()".br.ti -1c.BI "virtual void \fBsetGeometry\fR ( const QRect & )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "bool \fBfindWidget\fR ( QWidget * " "w" ", int * " "r" ", int * c )".br.ti -1c.BI "void \fBadd\fR ( QLayoutItem *, int " "row" ", int col )".br.in -1c.SH DESCRIPTIONThe QGridLayout class lays out widgets in a grid..PPQGridLayout takes the space it gets (from its parent layout or from the mainWidget()), divides it up into rows and columns, and puts each of the widgets it manages into the correct cell(s)..PPColumns and rows behave identically; we will discuss columns but there are equivalent functions for rows..PPEach column has a minimum width and a stretch factor. The minimum width is the greatest of that set using addColSpacing() and the minimum width of each widget in that column. The stretch factor is set using setColStretch() and determines how much of the available space the column will get, over and above its necessary minimum..PPNormally, each managed widget or layout is put into a cell of its own using addWidget(), addLayout(), or by the auto-add facility, but you can also put widget into multiple cells using addMultiCellWidget(). If you do that, QGridLayout will make a guess at how to distribute the size over the columns/rows (based on the stretch factors). You can adjust the minimum width of each column/row using addColSpacing()/addRowSpacing()..PPThis illustration shows a fragment of a dialog with a five-column, three-row grid (the grid is shown overlaid in magenta):.PP<img src="gridlayout.png" width="425" height="150">.PPColumns 0, 2 and 4 in this dialog fragment are made up of a QLabel, a QLineEdit and a QListBox. Columns 1 and 2 are placeholders, made with setColSpacing(). Row 0 consists of three QLabel objects, row 1 of three QLineEdit objects and row 2 of three QListBox objects..PPSince we did not want any space between the rows, we had to use placeholder columns to get the right amount of space between the columns..PPNote that the columns and rows are not equally wide/tall: If you want two columns to be equally wide, you must set the columns' minimum widths and stretch factors to be the same yourself. You do this using addColSpacing() and setStretch()..PPIf the QGridLayout is not the top-level layout (ie. is not managing all of the widget's area and children), you must add it to its parent layout when you have created it, but before you can do anything with it. The normal way to add a layout is by calling parentLayout->addLayout()..PPOnce you have done that, you can start putting widgets and other layouts in the cells of your grid layout using addWidget(), addLayout() and addMultiCellWidget()..PPQGridLayout also includes two margin widths: The border width and the inter-box width. The border width is the width of the reserved space along each of the QGridLayout's four sides. The intra-widget width is the width of the automatically allocated spacing between neighbouring boxes..PPThe border width defaults to 0, and the intra-widget width defaults to the same as the border width. Both are set using arguments to the constructor..PPExamples:.(llayout/layout.cpp rot13/rot13.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QGridLayout::QGridLayout ( QLayout * parentLayout, int nRows, int nCols, int space = -1, const char * name=0 )"Constructs a new grid that is placed inside \fIparentLayout,\fR with \fInRows\fR rows and \fInCols\fR columns, If \fIspace\fR is -1, this QGridLayout will inherits its parent's spacing(), otherwise \fIspace\fR is used..PPThis grid is placed according to \fIparentLayout's\fR default placement rules..SH "QGridLayout::QGridLayout ( QWidget * parent, int nRows, int nCols, int border=0, int space = -1, const char * name=0 )"Constructs a new QGridLayout with \fInRows\fR rows, \fInCols\fR columns and main widget \fIparent. parent\fR may not be 0..PP\fIborder\fR is the number of pixels between the edge of the widget and the managed children. \fIspace\fR is the default number of pixels between cells. If \fIspace\fR is -1 the value of \fIborder\fR is used..PP\fIname\fR is the internal object name..SH "QGridLayout::QGridLayout ( int nRows, int nCols, int space = -1, const char * name=0 )"Constructs a new grid with \fInRows\fR rows and \fInCols\fR columns, If \fIspace\fR is -1, this QGridLayout will inherits its parent's spacing(), otherwise \fIspace\fR is used..PPYou have to insert this grid into another layout. You can insert widgets and layouts in this layout at any time, but layout will not be performed before it is inserted..SH "QGridLayout::~QGridLayout ()"Deletes this grid. Geometry management is terminated if this is a top-level grid..SH "void QGridLayout::add ( QLayoutItem * item, int row, int col ) \fC[protected]\fR"Adds \fIitem\fR at position \fIrow, col.\fR The layout takes over ownership of \fIitem.\fR.SH "void QGridLayout::addColSpacing ( int col, int minsize )"Sets the minimum width of \fIcol\fR to \fIminsize\fR pixels..SH "void QGridLayout::addItem ( QLayoutItem * item ) \fC[virtual]\fR"Adds \fIitem\fR to the next free position of this layout..PPReimplemented from QLayout..SH "void QGridLayout::addLayout ( QLayout * layout, int row, int col )"Places another layout at position (\fIrow, col)\fR in the grid. The top left position is (0,0)..SH "void QGridLayout::addMultiCell ( QLayoutItem * item, int fromRow, int toRow, int fromCol, int toCol, int alignmnt = 0 )"Adds the \fIitem\fR to the cell grid, spanning multiple rows/columns..PPAlignment is specified by \fIalignmnt\fR.SH "void QGridLayout::addMultiCellWidget ( QWidget * w, int fromRow, int toRow, int fromCol, int toCol, int alignmnt = 0 )"Adds the widget \fIw\fR to the cell grid, spanning multiple rows/columns..PPAlignment is specified by \fIalignmnt\fR which takes the same arguments as QLabel::setAlignment(). The default alignment is 0, which means that the widget fills the entire cell..PPA non-zero alignment indicates that the widget should not grow to fill the available space, but should be sized according to sizeHint()..PPExamples:.(llayout/layout.cpp.)l.SH "void QGridLayout::addRowSpacing ( int row, int minsize )"Sets the minimum height of \fIrow\fR to \fIminsize\fR pixels..SH "void QGridLayout::addWidget ( QWidget * w, int row, int col, int alignmnt = 0 )"Adds the widget \fIw\fR to the cell grid at \fIrow, col.\fR The top left position is (0,0).PPAlignment is specified by \fIalignmnt\fR which takes the same arguments as QLabel::setAlignment(). The default alignment is 0, which means that the widget fills the entire cell..PPNote 1: You should not call this if you have enabled the auto-add facility of the layout..PPNote 2: The alignment parameter is interpreted more aggressively than in previous versions of Qt. A non-default alignment now indicates that the widget should not grow to fill the available space, but should be sized according to sizeHint()..PPExamples:.(llayout/layout.cpp rot13/rot13.cpp.)l.SH "void QGridLayout::expand ( int nRows, int nCols )"Expands this grid so that it will have \fInRows\fR rows and \fInCols\fR columns. Will not shrink the grid. You should not need to call this function, as QGridLayout expands automatically as new items are inserted..SH "bool QGridLayout::findWidget ( QWidget * w, int * row, int * col ) \fC[protected]\fR"Searches for \fIw\fR in this layout (not including child layouts). If \fIw\fR is found, it sets \fIrow\fR and \fIcol\fR to the row and column and returns TRUE. If \fIw\fR is not found, FALSE is returned..PP\fBWarning:\fR If a widget spans multiple rows/columns, the top-left cell is returne..SH "bool QGridLayout::hasHeightForWidth () const \fC[virtual]\fR"Returns whether this layout's preferred height depends on its width..PPReimplemented from QLayoutItem..SH "int QGridLayout::heightForWidth ( int w ) const \fC[virtual]\fR"Returns the layout's preferred height when it is \fIw\fR pixels wide..PPReimplemented from QLayoutItem..SH "void QGridLayout::invalidate () \fC[virtual]\fR"Resets cached information..PPReimplemented from QLayoutItem..SH "QLayoutIterator QGridLayout::iterator () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QLayoutItem..SH "QSize QGridLayout::maximumSize () const \fC[virtual]\fR"Returns the maximum size needed by this grid..PPReimplemented from QLayoutItem..SH "QSize QGridLayout::minimumSize () const \fC[virtual]\fR"Returns the minimum size needed by this grid..PPReimplemented from QLayoutItem..SH "int QGridLayout::numCols () const"Returns the number of columns in this grid..SH "int QGridLayout::numRows () const"Returns the number of rows in this grid..SH "void QGridLayout::setColStretch ( int col, int stretch ) \fC[virtual]\fR"Sets the stretch factor of column \fIcol\fR to \fIstretch.\fR The first column is number 0..PPThe stretch factor is relative to the other columns in this grid. Columns with higher stretch factor take more of the available space..PPThe default stretch factor is 0. If the stretch factor is 0 and no other column in this table can grow at all, the column may still grow..PPExamples:.(llayout/layout.cpp.)l.SH "void QGridLayout::setGeometry ( const QRect & s ) \fC[virtual]\fR"Resizes managed widgets within the rectangle \fIs.\fR.PPReimplemented from QLayoutItem..SH "void QGridLayout::setOrigin ( Corner c )"Sets which of the four corners of the grid corresponds to (0,0)..SH "void QGridLayout::setRowStretch ( int row, int stretch ) \fC[virtual]\fR"Sets the stretch factor of row \fIrow\fR to \fIstretch.\fR The first row is number 0..PPThe stretch factor is relative to the other rows in this grid. Rows with higher stretch factor take more of the available space..PPThe default stretch factor is 0. If the stretch factor is 0 and no other row in this table can grow at all, the row may still grow..SH "QSize QGridLayout::sizeHint () const"Returns the preferred size of this grid..SH "SEE ALSO".BR http://www.troll.no/qt/qgridlayout.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?