📄 qgridlayout.3qt
字号:
Constructs a new QGridLayout with \fInRows\fR rows, \fInCols\fR columns and parent widget, \fIparent\fR. \fIparent\fR may not be 0. The grid layout is called \fIname\fR..PP\fImargin\fR is the number of pixels between the edge of the widget and its managed children. \fIspace\fR is the default number of pixels between cells. If \fIspace\fR is -1, the value of \fImargin\fR is used..SH "QGridLayout::QGridLayout ( int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )"Constructs a new grid with \fInRows\fR rows and \fInCols\fR columns. If \fIspacing\fR is -1, this QGridLayout inherits its parent's spacing(); otherwise \fIspacing\fR is used. The grid layout is called \fIname\fR..PPYou must insert this grid into another layout. You can insert widgets and layouts into this layout at any time, but laying out will not be performed before this is inserted into another layout..SH "QGridLayout::QGridLayout ( QLayout * parentLayout, int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )"Constructs a new grid that is placed inside \fIparentLayout\fR with \fInRows\fR rows and \fInCols\fR columns. If \fIspacing\fR is -1, this QGridLayout inherits its parent's spacing(); otherwise \fIspacing\fR is used. The grid layout is called \fIname\fR..PPThis grid is placed according to \fIparentLayout\fR's default placement rules..SH "QGridLayout::~QGridLayout ()"Destroys the grid layout. Geometry management is terminated if this is a top-level grid..PPThe layout's widgets aren't destroyed..SH "void QGridLayout::add ( QLayoutItem * item, int row, int col )\fC [protected]\fR"Adds \fIitem\fR at position \fIrow\fR, \fIcol\fR. The layout takes ownership of the \fIitem\fR..SH "void QGridLayout::addColSpacing ( int col, int minsize )"Sets the minimum width of column \fIcol\fR to \fIminsize\fR pixels..SH "void QGridLayout::addItem ( QLayoutItem * item, int row, int col )"Adds \fIitem\fR at position \fIrow\fR, \fIcol\fR. The layout takes ownership of the \fIitem\fR..SH "void QGridLayout::addItem ( QLayoutItem * item )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPAdds \fIitem\fR to the next free position of this layout..PPReimplemented from QLayout..SH "void QGridLayout::addLayout ( QLayout * layout, int row, int col )"Places the \fIlayout\fR at position (\fIrow\fR, \fIcol\fR) in the grid. The top-left position is (0, 0)..PPExamples:.)l listbox/listbox.cpp, progressbar/progressbar.cpp, t10/main.cpp, and t13/gamebrd.cpp..SH "void QGridLayout::addMultiCell ( QLayoutItem * item, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )"Adds the \fIitem\fR to the cell grid, spanning multiple rows/columns..PPThe cell will span from \fIfromRow\fR, \fIfromCol\fR to \fItoRow\fR, \fItoCol\fR. Alignment is specified by \fIalignment\fR, which is a bitwise OR of Qt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell..SH "void QGridLayout::addMultiCellLayout ( QLayout * layout, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )"Adds the layout \fIlayout\fR to the cell grid, spanning multiple rows/columns. The cell will span from \fIfromRow\fR, \fIfromCol\fR to \fItoRow\fR, \fItoCol\fR..PPAlignment is specified by \fIalignment\fR, which is a bitwise OR of Qt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell..PPA non-zero alignment indicates that the layout should not grow to fill the available space but should be sized according to sizeHint()..SH "void QGridLayout::addMultiCellWidget ( QWidget * w, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )"Adds the widget \fIw\fR to the cell grid, spanning multiple rows/columns. The cell will span from \fIfromRow\fR, \fIfromCol\fR to \fItoRow\fR, \fItoCol\fR..PPAlignment is specified by \fIalignment\fR, which is a bitwise OR of Qt::AlignmentFlags values. 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:.)l cursor/cursor.cpp, layout/layout.cpp, and progressbar/progressbar.cpp..SH "void QGridLayout::addRowSpacing ( int row, int minsize )"Sets the minimum height of row \fIrow\fR to \fIminsize\fR pixels..SH "void QGridLayout::addWidget ( QWidget * w, int row, int col, int alignment = 0 )"Adds the widget \fIw\fR to the cell grid at \fIrow\fR, \fIcol\fR. The top-left position is (0, 0) by default..PPAlignment is specified by \fIalignment\fR, which is a bitwise OR of Qt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell..TPYou should not call this if you have enabled the auto-add facility of the layout..IP.TPFrom Qt 3.0, the \fIalignment\fR 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:.)l addressbook/centralwidget.cpp, layout/layout.cpp, rot13/rot13.cpp, sql/overview/form1/main.cpp, sql/overview/form2/main.cpp, t14/gamebrd.cpp, and t8/main.cpp..SH "QRect QGridLayout::cellGeometry ( int row, int col ) const"Returns the geometry of the cell with row \fIrow\fR and column \fIcol\fR in the grid. Returns an invalid rectangle if \fIrow\fR or \fIcol\fR is outside the grid..PP\fBWarning:\fR in the current version of Qt this function does not return valid results until setGeometry() has been called, i.e. after the mainWidget() is visible..SH "int QGridLayout::colStretch ( int col ) const"Returns the stretch factor for column \fIcol\fR..PPSee also setColStretch()..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 because QGridLayout expands automatically as new items are inserted..SH "QSizePolicy::ExpandData QGridLayout::expanding () const\fC [virtual]\fR"Returns whether this layout can make use of more space than sizeHint(). A value of Vertical or Horizontal means that it wants to grow in only one dimension, whereas \fCBothDirections\fR means that it wants to grow in both dimensions..PPReimplemented from QLayout..SH "bool QGridLayout::findWidget ( QWidget * w, int * row, int * col )\fC [protected]\fR"Searches for widget \fIw\fR in this layout (not including child layouts). If \fIw\fR is found, it sets \fC*<em>row</em>\fR and \fC*<em>col</em>\fR to the row and column and returns TRUE; otherwise returns FALSE..PPNote: if a widget spans multiple rows/columns, the top-left cell is returned..SH "bool QGridLayout::hasHeightForWidth () const\fC [virtual]\fR"Returns TRUE if this layout's preferred height depends on its width; otherwise returns FALSE..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 QLayout..SH "QSize QGridLayout::maximumSize () const\fC [virtual]\fR"Returns the maximum size needed by this grid..PPReimplemented from QLayout..SH "QSize QGridLayout::minimumSize () const\fC [virtual]\fR"Returns the minimum size needed by this grid..PPReimplemented from QLayout..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 "Corner QGridLayout::origin () const"Returns the corner that's used for the grid's origin, i.e. for position (0, 0)..SH "int QGridLayout::rowStretch ( int row ) const"Returns the stretch factor for row \fIrow\fR..PPSee also setRowStretch()..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 a 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..PPSee also colStretch(), addColSpacing(), and setRowStretch()..PPExamples:.)l layout/layout.cpp, t14/gamebrd.cpp, and t8/main.cpp..SH "void QGridLayout::setGeometry ( const QRect & r )\fC [virtual]\fR"Resizes managed widgets within the rectangle \fIr\fR..PPReimplemented from QLayout..SH "void QGridLayout::setOrigin ( Corner c )"Sets the grid's origin corner, i.e. position (0, 0), to \fIc\fR..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 a 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..PPSee also rowStretch(), addRowSpacing(), and setColStretch()..PPExample: addressbook/centralwidget.cpp..SH "QSize QGridLayout::sizeHint () const\fC [virtual]\fR"Returns the preferred size of this grid..PPReimplemented from QLayoutItem..SH "SEE ALSO".BR http://doc.trolltech.com/qgridlayout.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qgridlayout.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -