[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qlayout.cpp:884 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QGridLayout Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QGridLayout Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QGridLayout class lays out widgets in a grid.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qlayout-h.html">qlayout.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qlayout.html">QLayout</a>.
|
---|
| 38 | <p><a href="qgridlayout-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QGridLayout"><b>QGridLayout</b></a> ( QWidget * parent, int nRows = 1, int nCols = 1, int margin = 0, int space = -1, const char * name = 0 )</li>
|
---|
| 42 | <li class=fn><a href="#QGridLayout-2"><b>QGridLayout</b></a> ( int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )</li>
|
---|
| 43 | <li class=fn><a href="#QGridLayout-3"><b>QGridLayout</b></a> ( QLayout * parentLayout, int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )</li>
|
---|
| 44 | <li class=fn><a href="#~QGridLayout"><b>~QGridLayout</b></a> ()</li>
|
---|
| 45 | <li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
|
---|
| 46 | <li class=fn>virtual QSize <a href="#minimumSize"><b>minimumSize</b></a> () const</li>
|
---|
| 47 | <li class=fn>virtual QSize <a href="#maximumSize"><b>maximumSize</b></a> () const</li>
|
---|
| 48 | <li class=fn>virtual void <a href="#setRowStretch"><b>setRowStretch</b></a> ( int row, int stretch )</li>
|
---|
| 49 | <li class=fn>virtual void <a href="#setColStretch"><b>setColStretch</b></a> ( int col, int stretch )</li>
|
---|
| 50 | <li class=fn>int <a href="#rowStretch"><b>rowStretch</b></a> ( int row ) const</li>
|
---|
| 51 | <li class=fn>int <a href="#colStretch"><b>colStretch</b></a> ( int col ) const</li>
|
---|
| 52 | <li class=fn>void <a href="#setRowSpacing"><b>setRowSpacing</b></a> ( int row, int minSize )</li>
|
---|
| 53 | <li class=fn>void <a href="#setColSpacing"><b>setColSpacing</b></a> ( int col, int minSize )</li>
|
---|
| 54 | <li class=fn>int <a href="#rowSpacing"><b>rowSpacing</b></a> ( int row ) const</li>
|
---|
| 55 | <li class=fn>int <a href="#colSpacing"><b>colSpacing</b></a> ( int col ) const</li>
|
---|
| 56 | <li class=fn>int <a href="#numRows"><b>numRows</b></a> () const</li>
|
---|
| 57 | <li class=fn>int <a href="#numCols"><b>numCols</b></a> () const</li>
|
---|
| 58 | <li class=fn>QRect <a href="#cellGeometry"><b>cellGeometry</b></a> ( int row, int col ) const</li>
|
---|
| 59 | <li class=fn>virtual bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</li>
|
---|
| 60 | <li class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int w ) const</li>
|
---|
| 61 | <li class=fn>virtual QSizePolicy::ExpandData <a href="#expanding"><b>expanding</b></a> () const</li>
|
---|
| 62 | <li class=fn>virtual void <a href="#invalidate"><b>invalidate</b></a> ()</li>
|
---|
| 63 | <li class=fn>virtual void <a href="#addItem-2"><b>addItem</b></a> ( QLayoutItem * item )</li>
|
---|
| 64 | <li class=fn>void <a href="#addItem"><b>addItem</b></a> ( QLayoutItem * item, int row, int col )</li>
|
---|
| 65 | <li class=fn>void <a href="#addMultiCell"><b>addMultiCell</b></a> ( QLayoutItem * item, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )</li>
|
---|
| 66 | <li class=fn>void <a href="#addWidget"><b>addWidget</b></a> ( QWidget * w, int row, int col, int alignment = 0 )</li>
|
---|
| 67 | <li class=fn>void <a href="#addMultiCellWidget"><b>addMultiCellWidget</b></a> ( QWidget * w, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )</li>
|
---|
| 68 | <li class=fn>void <a href="#addLayout"><b>addLayout</b></a> ( QLayout * layout, int row, int col )</li>
|
---|
| 69 | <li class=fn>void <a href="#addMultiCellLayout"><b>addMultiCellLayout</b></a> ( QLayout * layout, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )</li>
|
---|
| 70 | <li class=fn>void addRowSpacing ( int row, int minsize ) <em>(obsolete)</em></li>
|
---|
| 71 | <li class=fn>void addColSpacing ( int col, int minsize ) <em>(obsolete)</em></li>
|
---|
| 72 | <li class=fn>void <a href="#expand"><b>expand</b></a> ( int nRows, int nCols )</li>
|
---|
| 73 | <li class=fn>enum <a href="#Corner-enum"><b>Corner</b></a> { TopLeft, TopRight, BottomLeft, BottomRight }</li>
|
---|
| 74 | <li class=fn>void <a href="#setOrigin"><b>setOrigin</b></a> ( Corner c )</li>
|
---|
| 75 | <li class=fn>Corner <a href="#origin"><b>origin</b></a> () const</li>
|
---|
| 76 | <li class=fn>virtual void <a href="#setGeometry"><b>setGeometry</b></a> ( const QRect & r )</li>
|
---|
| 77 | </ul>
|
---|
| 78 | <h2>Protected Members</h2>
|
---|
| 79 | <ul>
|
---|
| 80 | <li class=fn>bool <a href="#findWidget"><b>findWidget</b></a> ( QWidget * w, int * row, int * col )</li>
|
---|
| 81 | <li class=fn>void <a href="#add"><b>add</b></a> ( QLayoutItem * item, int row, int col )</li>
|
---|
| 82 | </ul>
|
---|
| 83 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | <p> The QGridLayout class lays out widgets in a grid.
|
---|
| 87 | <p>
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | <p> QGridLayout takes the space made available to it (by its parent
|
---|
| 91 | layout or by the <a href="qlayout.html#mainWidget">mainWidget</a>()), divides it up into rows and
|
---|
| 92 | columns, and puts each widget it manages into the correct cell.
|
---|
| 93 | <p> Columns and rows behave identically; we will discuss columns, but
|
---|
| 94 | there are equivalent functions for rows.
|
---|
| 95 | <p> Each column has a minimum width and a <a href="layout.html#stretch-factor">stretch factor</a>. The minimum
|
---|
| 96 | width is the greatest of that set using <a href="#addColSpacing">addColSpacing</a>() and the
|
---|
| 97 | minimum width of each widget in that column. The stretch factor is
|
---|
| 98 | set using <a href="#setColStretch">setColStretch</a>() and determines how much of the available
|
---|
| 99 | space the column will get over and above its necessary minimum.
|
---|
| 100 | <p> Normally, each managed widget or layout is put into a cell of its
|
---|
| 101 | own using <a href="#addWidget">addWidget</a>(), <a href="#addLayout">addLayout</a>() or by the <a href="qlayout.html#setAutoAdd">auto-add facility</a>. It is also
|
---|
| 102 | possible for a widget to occupy multiple cells using
|
---|
| 103 | <a href="#addMultiCellWidget">addMultiCellWidget</a>(). If you do this, QGridLayout will guess how
|
---|
| 104 | to distribute the size over the columns/rows (based on the stretch
|
---|
| 105 | factors).
|
---|
| 106 | <p> To remove a widget from a layout, call <a href="qlayout.html#remove">remove</a>(). Calling
|
---|
| 107 | <a href="qwidget.html#hide">QWidget::hide</a>() on a widget also effectively removes the widget
|
---|
| 108 | from the layout until <a href="qwidget.html#show">QWidget::show</a>() is called.
|
---|
| 109 | <p> This illustration shows a fragment of a dialog with a five-column,
|
---|
| 110 | three-row grid (the grid is shown overlaid in magenta):
|
---|
| 111 | <p> <center><img src="gridlayout.png"></center>
|
---|
| 112 | <p> Columns 0, 2 and 4 in this dialog fragment are made up of a
|
---|
| 113 | <a href="qlabel.html">QLabel</a>, a <a href="qlineedit.html">QLineEdit</a>, and a <a href="qlistbox.html">QListBox</a>. Columns 1 and 3 are
|
---|
| 114 | placeholders made with <a href="#addColSpacing">addColSpacing</a>(). Row 0 consists of three
|
---|
| 115 | QLabel objects, row 1 of three QLineEdit objects and row 2 of
|
---|
| 116 | three QListBox objects. We used placeholder columns (1 and 3) to
|
---|
| 117 | get the right amount of space between the columns.
|
---|
| 118 | <p> Note that the columns and rows are not equally wide or tall. If
|
---|
| 119 | you want two columns to have the same width, you must set their
|
---|
| 120 | minimum widths and stretch factors to be the same yourself. You do
|
---|
| 121 | this using addColSpacing() and <a href="#setColStretch">setColStretch</a>().
|
---|
| 122 | <p> If the QGridLayout is not the top-level layout (i.e. does not
|
---|
| 123 | manage all of the widget's area and children), you must add it to
|
---|
| 124 | its parent layout when you create it, but before you do anything
|
---|
| 125 | with it. The normal way to add a layout is by calling
|
---|
| 126 | parentLayout->addLayout().
|
---|
| 127 | <p> Once you have added your layout you can start putting widgets and
|
---|
| 128 | other layouts into the cells of your grid layout using
|
---|
| 129 | <a href="#addWidget">addWidget</a>(), <a href="#addLayout">addLayout</a>() and <a href="#addMultiCellWidget">addMultiCellWidget</a>().
|
---|
| 130 | <p> QGridLayout also includes two margin widths: the border and the
|
---|
| 131 | spacing. The border is the width of the reserved space along each
|
---|
| 132 | of the QGridLayout's four sides. The spacing is the width of the
|
---|
| 133 | automatically allocated spacing between neighboring boxes.
|
---|
| 134 | <p> Both the border and the spacing are parameters of the constructor
|
---|
| 135 | and default to 0.
|
---|
| 136 | <p> <p>See also <a href="qgrid.html">QGrid</a>, <a href="layout.html">Layout Overview</a>, <a href="appearance.html">Widget Appearance and Style</a>, and <a href="geomanagement.html">Layout Management</a>.
|
---|
| 137 |
|
---|
| 138 | <hr><h2>Member Type Documentation</h2>
|
---|
| 139 | <h3 class=fn><a name="Corner-enum"></a>QGridLayout::Corner</h3>
|
---|
| 140 |
|
---|
| 141 | <p> This enum identifies which corner is the origin (0, 0) of the
|
---|
| 142 | layout.
|
---|
| 143 | <ul>
|
---|
| 144 | <li><tt>QGridLayout::TopLeft</tt> - the top-left corner
|
---|
| 145 | <li><tt>QGridLayout::TopRight</tt> - the top-right corner
|
---|
| 146 | <li><tt>QGridLayout::BottomLeft</tt> - the bottom-left corner
|
---|
| 147 | <li><tt>QGridLayout::BottomRight</tt> - the bottom-right corner
|
---|
| 148 | </ul>
|
---|
| 149 | <hr><h2>Member Function Documentation</h2>
|
---|
| 150 | <h3 class=fn><a name="QGridLayout"></a>QGridLayout::QGridLayout ( <a href="qwidget.html">QWidget</a> * parent, int nRows = 1, int nCols = 1, int margin = 0, int space = -1, const char * name = 0 )
|
---|
| 151 | </h3>
|
---|
| 152 | Constructs a new QGridLayout with <em>nRows</em> rows, <em>nCols</em> columns
|
---|
| 153 | and parent widget, <em>parent</em>. <em>parent</em> may not be 0. The grid
|
---|
| 154 | layout is called <em>name</em>.
|
---|
| 155 | <p> <em>margin</em> is the number of pixels between the edge of the widget
|
---|
| 156 | and its managed children. <em>space</em> is the default number of pixels
|
---|
| 157 | between cells. If <em>space</em> is -1, the value of <em>margin</em> is used.
|
---|
| 158 |
|
---|
| 159 | <h3 class=fn><a name="QGridLayout-2"></a>QGridLayout::QGridLayout ( int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )
|
---|
| 160 | </h3>
|
---|
| 161 | Constructs a new grid with <em>nRows</em> rows and <em>nCols</em> columns. If
|
---|
| 162 | <em>spacing</em> is -1, this QGridLayout inherits its parent's
|
---|
| 163 | <a href="qlayout.html#spacing">spacing</a>(); otherwise <em>spacing</em> is used. The grid layout is called
|
---|
| 164 | <em>name</em>.
|
---|
| 165 | <p> You must insert this grid into another layout. You can insert
|
---|
| 166 | widgets and layouts into this layout at any time, but laying out
|
---|
| 167 | will not be performed before this is inserted into another layout.
|
---|
| 168 |
|
---|
| 169 | <h3 class=fn><a name="QGridLayout-3"></a>QGridLayout::QGridLayout ( <a href="qlayout.html">QLayout</a> * parentLayout, int nRows = 1, int nCols = 1, int spacing = -1, const char * name = 0 )
|
---|
| 170 | </h3>
|
---|
| 171 | Constructs a new grid that is placed inside <em>parentLayout</em> with
|
---|
| 172 | <em>nRows</em> rows and <em>nCols</em> columns. If <em>spacing</em> is -1, this
|
---|
| 173 | QGridLayout inherits its parent's <a href="qlayout.html#spacing">spacing</a>(); otherwise <em>spacing</em>
|
---|
| 174 | is used. The grid layout is called <em>name</em>.
|
---|
| 175 | <p> This grid is placed according to <em>parentLayout</em>'s default
|
---|
| 176 | placement rules.
|
---|
| 177 |
|
---|
| 178 | <h3 class=fn><a name="~QGridLayout"></a>QGridLayout::~QGridLayout ()
|
---|
| 179 | </h3>
|
---|
| 180 | Destroys the grid layout. Geometry management is terminated if
|
---|
| 181 | this is a top-level grid.
|
---|
| 182 | <p> The layout's widgets aren't destroyed.
|
---|
| 183 |
|
---|
| 184 | <h3 class=fn>void <a name="add"></a>QGridLayout::add ( <a href="qlayoutitem.html">QLayoutItem</a> * item, int row, int col )<tt> [protected]</tt>
|
---|
| 185 | </h3>
|
---|
| 186 | Adds <em>item</em> at position <em>row</em>, <em>col</em>. The layout takes
|
---|
| 187 | ownership of the <em>item</em>.
|
---|
| 188 |
|
---|
| 189 | <h3 class=fn>void <a name="addColSpacing"></a>QGridLayout::addColSpacing ( int col, int minsize )
|
---|
| 190 | </h3>
|
---|
| 191 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
| 192 | <p> Sets the minimum width of column <em>col</em> to <em>minsize</em> pixels.
|
---|
| 193 | <p> Use <a href="#setColSpacing">setColSpacing</a>() instead.
|
---|
| 194 |
|
---|
| 195 | <h3 class=fn>void <a name="addItem"></a>QGridLayout::addItem ( <a href="qlayoutitem.html">QLayoutItem</a> * item, int row, int col )
|
---|
| 196 | </h3>
|
---|
| 197 | Adds <em>item</em> at position <em>row</em>, <em>col</em>. The layout takes
|
---|
| 198 | ownership of the <em>item</em>.
|
---|
| 199 |
|
---|
| 200 | <h3 class=fn>void <a name="addItem-2"></a>QGridLayout::addItem ( <a href="qlayoutitem.html">QLayoutItem</a> * item )<tt> [virtual]</tt>
|
---|
| 201 | </h3>
|
---|
| 202 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 203 | <p> Adds <em>item</em> to the next free position of this layout.
|
---|
| 204 |
|
---|
| 205 | <p>Reimplemented from <a href="qlayout.html#addItem">QLayout</a>.
|
---|
| 206 | <h3 class=fn>void <a name="addLayout"></a>QGridLayout::addLayout ( <a href="qlayout.html">QLayout</a> * layout, int row, int col )
|
---|
| 207 | </h3>
|
---|
| 208 | Places the <em>layout</em> at position (<em>row</em>, <em>col</em>) in the grid. The
|
---|
| 209 | top-left position is (0, 0).
|
---|
| 210 | <p> <em>layout</em> becomes a child of the grid layout.
|
---|
| 211 | <p> When a layout is constructed with another layout as its parent,
|
---|
| 212 | you don't need to call <a href="#addLayout">addLayout</a>(); the child layout is
|
---|
| 213 | automatically added to the parent layout as it is constructed.
|
---|
| 214 | <p> <p>See also <a href="#addMultiCellLayout">addMultiCellLayout</a>().
|
---|
| 215 |
|
---|
| 216 | <p>Examples: <a href="listbox-example.html#x1430">listbox/listbox.cpp</a>, <a href="progressbar-example.html#x964">progressbar/progressbar.cpp</a>, <a href="tutorial1-10.html#x2365">t10/main.cpp</a>, and <a href="tutorial1-13.html#x2413">t13/gamebrd.cpp</a>.
|
---|
| 217 | <h3 class=fn>void <a name="addMultiCell"></a>QGridLayout::addMultiCell ( <a href="qlayoutitem.html">QLayoutItem</a> * item, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )
|
---|
| 218 | </h3>
|
---|
| 219 | Adds the <em>item</em> to the cell grid, spanning multiple rows/columns.
|
---|
| 220 | <p> The cell will span from <em>fromRow</em>, <em>fromCol</em> to <em>toRow</em>, <em>toCol</em>. Alignment is specified by <em>alignment</em>, which is a bitwise
|
---|
| 221 | OR of <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0,
|
---|
| 222 | which means that the widget fills the entire cell.
|
---|
| 223 |
|
---|
| 224 | <h3 class=fn>void <a name="addMultiCellLayout"></a>QGridLayout::addMultiCellLayout ( <a href="qlayout.html">QLayout</a> * layout, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )
|
---|
| 225 | </h3>
|
---|
| 226 | Adds the layout <em>layout</em> to the cell grid, spanning multiple
|
---|
| 227 | rows/columns. The cell will span from <em>fromRow</em>, <em>fromCol</em> to <em>toRow</em>, <em>toCol</em>.
|
---|
| 228 | <p> Alignment is specified by <em>alignment</em>, which is a bitwise OR of
|
---|
| 229 | <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which
|
---|
| 230 | means that the widget fills the entire cell.
|
---|
| 231 | <p> A non-zero alignment indicates that the layout should not grow to
|
---|
| 232 | fill the available space but should be sized according to
|
---|
| 233 | <a href="#sizeHint">sizeHint</a>().
|
---|
| 234 | <p> <em>layout</em> becomes a child of the grid layout.
|
---|
| 235 | <p> <p>See also <a href="#addLayout">addLayout</a>().
|
---|
| 236 |
|
---|
| 237 | <h3 class=fn>void <a name="addMultiCellWidget"></a>QGridLayout::addMultiCellWidget ( <a href="qwidget.html">QWidget</a> * w, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )
|
---|
| 238 | </h3>
|
---|
| 239 | Adds the widget <em>w</em> to the cell grid, spanning multiple
|
---|
| 240 | rows/columns. The cell will span from <em>fromRow</em>, <em>fromCol</em> to <em>toRow</em>, <em>toCol</em>.
|
---|
| 241 | <p> Alignment is specified by <em>alignment</em>, which is a bitwise OR of
|
---|
| 242 | <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which
|
---|
| 243 | means that the widget fills the entire cell.
|
---|
| 244 | <p> A non-zero alignment indicates that the widget should not grow to
|
---|
| 245 | fill the available space but should be sized according to
|
---|
| 246 | <a href="#sizeHint">sizeHint</a>().
|
---|
| 247 | <p> <p>See also <a href="#addWidget">addWidget</a>().
|
---|
| 248 |
|
---|
| 249 | <p>Examples: <a href="cursor-example.html#x1116">cursor/cursor.cpp</a>, <a href="layout-example.html#x532">layout/layout.cpp</a>, and <a href="progressbar-example.html#x965">progressbar/progressbar.cpp</a>.
|
---|
| 250 | <h3 class=fn>void <a name="addRowSpacing"></a>QGridLayout::addRowSpacing ( int row, int minsize )
|
---|
| 251 | </h3>
|
---|
| 252 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
| 253 | <p> Sets the minimum height of row <em>row</em> to <em>minsize</em> pixels.
|
---|
| 254 | <p> Use <a href="#setRowSpacing">setRowSpacing</a>() instead.
|
---|
| 255 |
|
---|
| 256 | <h3 class=fn>void <a name="addWidget"></a>QGridLayout::addWidget ( <a href="qwidget.html">QWidget</a> * w, int row, int col, int alignment = 0 )
|
---|
| 257 | </h3>
|
---|
| 258 | Adds the widget <em>w</em> to the cell grid at <em>row</em>, <em>col</em>. The
|
---|
| 259 | top-left position is (0, 0) by default.
|
---|
| 260 | <p> Alignment is specified by <em>alignment</em>, which is a bitwise OR of
|
---|
| 261 | <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which
|
---|
| 262 | means that the widget fills the entire cell.
|
---|
| 263 | <p> <ul>
|
---|
| 264 | <li> You should not call this if you have enabled the
|
---|
| 265 | <a href="qlayout.html#setAutoAdd">auto-add facility of the layout</a>.
|
---|
| 266 | <p> <li> From Qt 3.0, the <em>alignment</em> parameter is interpreted more
|
---|
| 267 | aggressively than in previous versions of Qt. A non-default
|
---|
| 268 | alignment now indicates that the widget should not grow to fill
|
---|
| 269 | the available space, but should be sized according to <a href="#sizeHint">sizeHint</a>().
|
---|
| 270 | </ul>
|
---|
| 271 | <p> <p>See also <a href="#addMultiCellWidget">addMultiCellWidget</a>().
|
---|
| 272 |
|
---|
| 273 | <p>Examples: <a href="addressbook-example.html#x578">addressbook/centralwidget.cpp</a>, <a href="layout-example.html#x533">layout/layout.cpp</a>, <a href="rot-example.html#x1370">rot13/rot13.cpp</a>, <a href="sql.html#x2221">sql/overview/form1/main.cpp</a>, <a href="sql.html#x2230">sql/overview/form2/main.cpp</a>, <a href="tutorial1-14.html#x2441">t14/gamebrd.cpp</a>, and <a href="tutorial1-08.html#x2337">t8/main.cpp</a>.
|
---|
| 274 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="cellGeometry"></a>QGridLayout::cellGeometry ( int row, int col ) const
|
---|
| 275 | </h3>
|
---|
| 276 | Returns the geometry of the cell with row <em>row</em> and column <em>col</em>
|
---|
| 277 | in the grid. Returns an invalid rectangle if <em>row</em> or <em>col</em> is
|
---|
| 278 | outside the grid.
|
---|
| 279 | <p> <b>Warning:</b> in the current version of Qt this function does not
|
---|
| 280 | return valid results until <a href="#setGeometry">setGeometry</a>() has been called, i.e.
|
---|
| 281 | after the <a href="qlayout.html#mainWidget">mainWidget</a>() is visible.
|
---|
| 282 |
|
---|
| 283 | <h3 class=fn>int <a name="colSpacing"></a>QGridLayout::colSpacing ( int col ) const
|
---|
| 284 | </h3>
|
---|
| 285 | Returns the column spacing for column <em>col</em>.
|
---|
| 286 | <p> <p>See also <a href="#setColSpacing">setColSpacing</a>().
|
---|
| 287 |
|
---|
| 288 | <h3 class=fn>int <a name="colStretch"></a>QGridLayout::colStretch ( int col ) const
|
---|
| 289 | </h3>
|
---|
| 290 | Returns the <a href="layout.html#stretch-factor">stretch factor</a> for column <em>col</em>.
|
---|
| 291 | <p> <p>See also <a href="#setColStretch">setColStretch</a>().
|
---|
| 292 |
|
---|
| 293 | <h3 class=fn>void <a name="expand"></a>QGridLayout::expand ( int nRows, int nCols )
|
---|
| 294 | </h3>
|
---|
| 295 | Expands this grid so that it will have <em>nRows</em> rows and <em>nCols</em>
|
---|
| 296 | columns. Will not shrink the grid. You should not need to call
|
---|
| 297 | this function because QGridLayout expands automatically as new
|
---|
| 298 | items are inserted.
|
---|
| 299 |
|
---|
| 300 | <h3 class=fn><a href="qsizepolicy.html#ExpandData-enum">QSizePolicy::ExpandData</a> <a name="expanding"></a>QGridLayout::expanding () const<tt> [virtual]</tt>
|
---|
| 301 | </h3>
|
---|
| 302 | Returns whether this layout can make use of more space than
|
---|
| 303 | <a href="#sizeHint">sizeHint</a>(). A value of <a href="qt.html#Orientation-enum">Vertical</a> or <a href="qt.html#Orientation-enum">Horizontal</a> means that it wants
|
---|
| 304 | to grow in only one dimension, whereas <tt>BothDirections</tt> means that
|
---|
| 305 | it wants to grow in both dimensions.
|
---|
| 306 |
|
---|
| 307 | <p>Reimplemented from <a href="qlayout.html#expanding">QLayout</a>.
|
---|
| 308 | <h3 class=fn>bool <a name="findWidget"></a>QGridLayout::findWidget ( <a href="qwidget.html">QWidget</a> * w, int * row, int * col )<tt> [protected]</tt>
|
---|
| 309 | </h3>
|
---|
| 310 | Searches for widget <em>w</em> in this layout (not including child
|
---|
| 311 | layouts). If <em>w</em> is found, it sets <tt><em>row</em></tt> and <tt><em>col</em></tt> to
|
---|
| 312 | the row and column and returns TRUE; otherwise returns FALSE.
|
---|
| 313 | <p> Note: if a widget spans multiple rows/columns, the top-left cell
|
---|
| 314 | is returned.
|
---|
| 315 |
|
---|
| 316 | <h3 class=fn>bool <a name="hasHeightForWidth"></a>QGridLayout::hasHeightForWidth () const<tt> [virtual]</tt>
|
---|
| 317 | </h3>
|
---|
| 318 | Returns TRUE if this layout's preferred height depends on its
|
---|
| 319 | width; otherwise returns FALSE.
|
---|
| 320 |
|
---|
| 321 | <p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem</a>.
|
---|
| 322 | <h3 class=fn>int <a name="heightForWidth"></a>QGridLayout::heightForWidth ( int w ) const<tt> [virtual]</tt>
|
---|
| 323 | </h3>
|
---|
| 324 | Returns the layout's preferred height when it is <em>w</em> pixels wide.
|
---|
| 325 |
|
---|
| 326 | <p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem</a>.
|
---|
| 327 | <h3 class=fn>void <a name="invalidate"></a>QGridLayout::invalidate ()<tt> [virtual]</tt>
|
---|
| 328 | </h3>
|
---|
| 329 | Resets cached information.
|
---|
| 330 |
|
---|
| 331 | <p>Reimplemented from <a href="qlayout.html#invalidate">QLayout</a>.
|
---|
| 332 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="maximumSize"></a>QGridLayout::maximumSize () const<tt> [virtual]</tt>
|
---|
| 333 | </h3>
|
---|
| 334 | Returns the maximum size needed by this grid.
|
---|
| 335 |
|
---|
| 336 | <p>Reimplemented from <a href="qlayout.html#maximumSize">QLayout</a>.
|
---|
| 337 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSize"></a>QGridLayout::minimumSize () const<tt> [virtual]</tt>
|
---|
| 338 | </h3>
|
---|
| 339 | Returns the minimum size needed by this grid.
|
---|
| 340 |
|
---|
| 341 | <p>Reimplemented from <a href="qlayout.html#minimumSize">QLayout</a>.
|
---|
| 342 | <h3 class=fn>int <a name="numCols"></a>QGridLayout::numCols () const
|
---|
| 343 | </h3>
|
---|
| 344 | Returns the number of columns in this grid.
|
---|
| 345 |
|
---|
| 346 | <h3 class=fn>int <a name="numRows"></a>QGridLayout::numRows () const
|
---|
| 347 | </h3>
|
---|
| 348 | Returns the number of rows in this grid.
|
---|
| 349 |
|
---|
| 350 | <h3 class=fn><a href="qgridlayout.html#Corner-enum">Corner</a> <a name="origin"></a>QGridLayout::origin () const
|
---|
| 351 | </h3>
|
---|
| 352 | Returns the corner that's used for the grid's origin, i.e. for
|
---|
| 353 | position (0, 0).
|
---|
| 354 |
|
---|
| 355 | <h3 class=fn>int <a name="rowSpacing"></a>QGridLayout::rowSpacing ( int row ) const
|
---|
| 356 | </h3>
|
---|
| 357 | Returns the row spacing for row <em>row</em>.
|
---|
| 358 | <p> <p>See also <a href="#setRowSpacing">setRowSpacing</a>().
|
---|
| 359 |
|
---|
| 360 | <h3 class=fn>int <a name="rowStretch"></a>QGridLayout::rowStretch ( int row ) const
|
---|
| 361 | </h3>
|
---|
| 362 | Returns the <a href="layout.html#stretch-factor">stretch factor</a> for row <em>row</em>.
|
---|
| 363 | <p> <p>See also <a href="#setRowStretch">setRowStretch</a>().
|
---|
| 364 |
|
---|
| 365 | <h3 class=fn>void <a name="setColSpacing"></a>QGridLayout::setColSpacing ( int col, int minSize )
|
---|
| 366 | </h3>
|
---|
| 367 | Sets the minimum width of column <em>col</em> to <em>minSize</em> pixels.
|
---|
| 368 | <p> <p>See also <a href="#colSpacing">colSpacing</a>() and <a href="#setRowSpacing">setRowSpacing</a>().
|
---|
| 369 |
|
---|
| 370 | <h3 class=fn>void <a name="setColStretch"></a>QGridLayout::setColStretch ( int col, int stretch )<tt> [virtual]</tt>
|
---|
| 371 | </h3>
|
---|
| 372 | Sets the <a href="layout.html#stretch-factor">stretch factor</a> of column <em>col</em> to <em>stretch</em>. The first
|
---|
| 373 | column is number 0.
|
---|
| 374 | <p> The stretch factor is relative to the other columns in this grid.
|
---|
| 375 | Columns with a higher stretch factor take more of the available
|
---|
| 376 | space.
|
---|
| 377 | <p> The default stretch factor is 0. If the stretch factor is 0 and no
|
---|
| 378 | other column in this table can grow at all, the column may still
|
---|
| 379 | grow.
|
---|
| 380 | <p> <p>See also <a href="#colStretch">colStretch</a>(), <a href="#addColSpacing">addColSpacing</a>(), and <a href="#setRowStretch">setRowStretch</a>().
|
---|
| 381 |
|
---|
| 382 | <p>Examples: <a href="layout-example.html#x534">layout/layout.cpp</a>, <a href="tutorial1-14.html#x2442">t14/gamebrd.cpp</a>, and <a href="tutorial1-08.html#x2338">t8/main.cpp</a>.
|
---|
| 383 | <h3 class=fn>void <a name="setGeometry"></a>QGridLayout::setGeometry ( const <a href="qrect.html">QRect</a> & r )<tt> [virtual]</tt>
|
---|
| 384 | </h3>
|
---|
| 385 | Resizes managed widgets within the rectangle <em>r</em>.
|
---|
| 386 |
|
---|
| 387 | <p>Reimplemented from <a href="qlayout.html#setGeometry">QLayout</a>.
|
---|
| 388 | <h3 class=fn>void <a name="setOrigin"></a>QGridLayout::setOrigin ( <a href="qgridlayout.html#Corner-enum">Corner</a> c )
|
---|
| 389 | </h3>
|
---|
| 390 | Sets the grid's origin corner, i.e. position (0, 0), to <em>c</em>.
|
---|
| 391 |
|
---|
| 392 | <h3 class=fn>void <a name="setRowSpacing"></a>QGridLayout::setRowSpacing ( int row, int minSize )
|
---|
| 393 | </h3>
|
---|
| 394 | Sets the minimum height of row <em>row</em> to <em>minSize</em> pixels.
|
---|
| 395 | <p> <p>See also <a href="#rowSpacing">rowSpacing</a>() and <a href="#setColSpacing">setColSpacing</a>().
|
---|
| 396 |
|
---|
| 397 | <h3 class=fn>void <a name="setRowStretch"></a>QGridLayout::setRowStretch ( int row, int stretch )<tt> [virtual]</tt>
|
---|
| 398 | </h3>
|
---|
| 399 | Sets the <a href="layout.html#stretch-factor">stretch factor</a> of row <em>row</em> to <em>stretch</em>. The first row
|
---|
| 400 | is number 0.
|
---|
| 401 | <p> The stretch factor is relative to the other rows in this grid.
|
---|
| 402 | Rows with a higher stretch factor take more of the available
|
---|
| 403 | space.
|
---|
| 404 | <p> The default stretch factor is 0. If the stretch factor is 0 and no
|
---|
| 405 | other row in this table can grow at all, the row may still grow.
|
---|
| 406 | <p> <p>See also <a href="#rowStretch">rowStretch</a>(), <a href="#setRowSpacing">setRowSpacing</a>(), and <a href="#setColStretch">setColStretch</a>().
|
---|
| 407 |
|
---|
| 408 | <p>Examples: <a href="addressbook-example.html#x579">addressbook/centralwidget.cpp</a> and <a href="qaxcontainer-example-qutlook.html#x2722">qutlook/centralwidget.cpp</a>.
|
---|
| 409 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QGridLayout::sizeHint () const<tt> [virtual]</tt>
|
---|
| 410 | </h3>
|
---|
| 411 | Returns the preferred size of this grid.
|
---|
| 412 |
|
---|
| 413 | <p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem</a>.
|
---|
| 414 | <!-- eof -->
|
---|
| 415 | <hr><p>
|
---|
| 416 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 417 | Copyright © 1995-2007
|
---|
| 418 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 419 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 420 | <td>Copyright © 2007
|
---|
| 421 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 422 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 423 | </table></div></address></body>
|
---|
| 424 | </html>
|
---|