⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qgridlayout.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QGridLayout 3qt "21 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech 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\fC#include <qlayout.h>\fR.PPInherits QLayout..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQGridLayout\fR ( QWidget * parent, int nRows = 1, int nCols = 1, int margin = 0, int space = -1, const char * name = 0 )".br.ti -1c.BI "\fBQGridLayout\fR ( int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )".br.ti -1c.BI "\fBQGridLayout\fR ( QLayout * parentLayout, int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )".br.ti -1c.BI "\fB~QGridLayout\fR ()".br.ti -1c.BI "virtual 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 \fBrowStretch\fR ( int row ) const".br.ti -1c.BI "int \fBcolStretch\fR ( int col ) const".br.ti -1c.BI "void \fBsetRowSpacing\fR ( int row, int minSize )".br.ti -1c.BI "void \fBsetColSpacing\fR ( int col, int minSize )".br.ti -1c.BI "int \fBrowSpacing\fR ( int row ) const".br.ti -1c.BI "int \fBcolSpacing\fR ( int col ) const".br.ti -1c.BI "int \fBnumRows\fR () const".br.ti -1c.BI "int \fBnumCols\fR () const".br.ti -1c.BI "QRect \fBcellGeometry\fR ( int row, int col ) const".br.ti -1c.BI "virtual bool \fBhasHeightForWidth\fR () const".br.ti -1c.BI "virtual int \fBheightForWidth\fR ( int w ) 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 * item )".br.ti -1c.BI "void \fBaddItem\fR ( QLayoutItem * item, int row, int col )".br.ti -1c.BI "void \fBaddMultiCell\fR ( QLayoutItem * item, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )".br.ti -1c.BI "void \fBaddWidget\fR ( QWidget * w, int row, int col, int alignment = 0 )".br.ti -1c.BI "void \fBaddMultiCellWidget\fR ( QWidget * w, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )".br.ti -1c.BI "void \fBaddLayout\fR ( QLayout * layout, int row, int col )".br.ti -1c.BI "void \fBaddMultiCellLayout\fR ( QLayout * layout, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )".br.ti -1c.BI "void addRowSpacing ( int row, int minsize )  \fI(obsolete)\fR".br.ti -1c.BI "void addColSpacing ( int col, int minsize )  \fI(obsolete)\fR".br.ti -1c.BI "void \fBexpand\fR ( int nRows, int nCols )".br.ti -1c.BI "enum \fBCorner\fR { TopLeft, TopRight, BottomLeft, BottomRight }".br.ti -1c.BI "void \fBsetOrigin\fR ( Corner c )".br.ti -1c.BI "Corner \fBorigin\fR () const".br.ti -1c.BI "virtual void \fBsetGeometry\fR ( const QRect & r )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "bool \fBfindWidget\fR ( QWidget * w, int * row, int * col )".br.ti -1c.BI "void \fBadd\fR ( QLayoutItem * item, int row, int col )".br.in -1c.SH DESCRIPTIONThe QGridLayout class lays out widgets in a grid..PPQGridLayout takes the space made available to it (by its parent layout or by the mainWidget()), divides it up into rows and columns, and puts each widget it manages into the correct cell..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. It is also possible for a widget to occupy multiple cells using addMultiCellWidget(). If you do this, QGridLayout will guess how to distribute the size over the columns/rows (based on the stretch factors)..PPTo remove a widget from a layout, call remove(). Calling QWidget::hide() on a widget also effectively removes the widget from the layout until QWidget::show() is called..PPThis illustration shows a fragment of a dialog with a five-column, three-row grid (the grid is shown overlaid in magenta):.PP<center>.ce 1.B "[Image Omitted]".PP</center>.PPColumns 0, 2 and 4 in this dialog fragment are made up of a QLabel, a QLineEdit, and a QListBox. Columns 1 and 3 are placeholders made with addColSpacing(). Row 0 consists of three QLabel objects, row 1 of three QLineEdit objects and row 2 of three QListBox objects. We used placeholder columns (1 and 3) to get the right amount of space between the columns..PPNote that the columns and rows are not equally wide or tall. If you want two columns to have the same width, you must set their minimum widths and stretch factors to be the same yourself. You do this using addColSpacing() and setColStretch()..PPIf the QGridLayout is not the top-level layout (i.e. does not manage all of the widget's area and children), you must add it to its parent layout when you create it, but before you do anything with it. The normal way to add a layout is by calling parentLayout->addLayout()..PPOnce you have added your layout you can start putting widgets and other layouts into the cells of your grid layout using addWidget(), addLayout() and addMultiCellWidget()..PPQGridLayout also includes two margin widths: the border and the spacing. The border is the width of the reserved space along each of the QGridLayout's four sides. The spacing is the width of the automatically allocated spacing between neighboring boxes..PPBoth the border and the spacing are parameters of the constructor and default to 0..PPSee also QGrid, Layout Overview, Widget Appearance and Style, and Layout Management..SS "Member Type Documentation".SH "QGridLayout::Corner"This enum identifies which corner is the origin (0, 0) of the layout..TP\fCQGridLayout::TopLeft\fR - the top-left corner.TP\fCQGridLayout::TopRight\fR - the top-right corner.TP\fCQGridLayout::BottomLeft\fR - the bottom-left corner.TP\fCQGridLayout::BottomRight\fR - the bottom-right corner.SH MEMBER FUNCTION DOCUMENTATION.SH "QGridLayout::QGridLayout ( QWidget * parent, int nRows = 1, int nCols = 1, int margin = 0, int space = -1, const char * name = 0 )"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..PP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -