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

📄 qgridlayout.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QGridLayout 3qt "24 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.br.PP\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 " "border" "=0, int " "space" " = -1, const char * " "name" "=0 ) ".br.ti -1c.BI "\fBQGridLayout\fR ( int " "nRows" " = 1, int " "nCols" " = 1, int " "space" " = -1, const char * " "name" "=0 ) ".br.ti -1c.BI "\fBQGridLayout\fR ( QLayout * " "parentLayout" ", int " "nRows" " = 1, int " "nCols" " = 1, int " "space" " = -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 "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 ) 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 \fBaddItem\fR ( QLayoutItem * " "item" ", int " "row" ", int col ) ".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 \fBaddMultiCellLayout\fR ( QLayout * " "layout" ", int " "fromRow" ", int " "toRow" ", int " "fromCol" ", int " "toCol" ", int " "align" " = 0 ) ".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 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.ce 1.B "[Image Omitted]".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 addColSpacing(). 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..PPSee also the Layout Overview documentation..PPExamples:.(lcursor/cursor.cpp layout/layout.cpp rot13/rot13.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QGridLayout::QGridLayout ( QLayout * parentLayout, int nRows = 1, int nCols = 1, 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.

⌨️ 快捷键说明

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