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/widgets/qgridview.cpp:45 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QGridView 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>QGridView Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QGridView class provides an abstract base for
|
---|
35 | fixed-size grids.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p><tt>#include <<a href="qgridview-h.html">qgridview.h</a>></tt>
|
---|
38 | <p>Inherits <a href="qscrollview.html">QScrollView</a>.
|
---|
39 | <p><a href="qgridview-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QGridView"><b>QGridView</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
---|
43 | <li class=fn><a href="#~QGridView"><b>~QGridView</b></a> ()</li>
|
---|
44 | <li class=fn>int <a href="#numRows"><b>numRows</b></a> () const</li>
|
---|
45 | <li class=fn>virtual void <a href="#setNumRows"><b>setNumRows</b></a> ( int )</li>
|
---|
46 | <li class=fn>int <a href="#numCols"><b>numCols</b></a> () const</li>
|
---|
47 | <li class=fn>virtual void <a href="#setNumCols"><b>setNumCols</b></a> ( int )</li>
|
---|
48 | <li class=fn>int <a href="#cellWidth"><b>cellWidth</b></a> () const</li>
|
---|
49 | <li class=fn>virtual void <a href="#setCellWidth"><b>setCellWidth</b></a> ( int )</li>
|
---|
50 | <li class=fn>int <a href="#cellHeight"><b>cellHeight</b></a> () const</li>
|
---|
51 | <li class=fn>virtual void <a href="#setCellHeight"><b>setCellHeight</b></a> ( int )</li>
|
---|
52 | <li class=fn>QRect <a href="#cellRect"><b>cellRect</b></a> () const</li>
|
---|
53 | <li class=fn>QRect <a href="#cellGeometry"><b>cellGeometry</b></a> ( int row, int column )</li>
|
---|
54 | <li class=fn>QSize <a href="#gridSize"><b>gridSize</b></a> () const</li>
|
---|
55 | <li class=fn>int <a href="#rowAt"><b>rowAt</b></a> ( int y ) const</li>
|
---|
56 | <li class=fn>int <a href="#columnAt"><b>columnAt</b></a> ( int x ) const</li>
|
---|
57 | <li class=fn>void <a href="#repaintCell"><b>repaintCell</b></a> ( int row, int column, bool erase = TRUE )</li>
|
---|
58 | <li class=fn>void <a href="#updateCell"><b>updateCell</b></a> ( int row, int column )</li>
|
---|
59 | <li class=fn>void <a href="#ensureCellVisible"><b>ensureCellVisible</b></a> ( int row, int column )</li>
|
---|
60 | </ul>
|
---|
61 | <h2>Properties</h2>
|
---|
62 | <ul>
|
---|
63 | <li class=fn>int <a href="#cellHeight-prop"><b>cellHeight</b></a> - the height of a grid row</li>
|
---|
64 | <li class=fn>int <a href="#cellWidth-prop"><b>cellWidth</b></a> - the width of a grid column</li>
|
---|
65 | <li class=fn>int <a href="#numCols-prop"><b>numCols</b></a> - the number of columns in the grid</li>
|
---|
66 | <li class=fn>int <a href="#numRows-prop"><b>numRows</b></a> - the number of rows in the grid</li>
|
---|
67 | </ul>
|
---|
68 | <h2>Protected Members</h2>
|
---|
69 | <ul>
|
---|
70 | <li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter * p, int row, int col ) = 0</li>
|
---|
71 | <li class=fn>virtual void <a href="#paintEmptyArea"><b>paintEmptyArea</b></a> ( QPainter * p, int cx, int cy, int cw, int ch )</li>
|
---|
72 | <li class=fn>virtual void <a href="#dimensionChange"><b>dimensionChange</b></a> ( int oldNumRows, int oldNumCols )</li>
|
---|
73 | </ul>
|
---|
74 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
75 |
|
---|
76 |
|
---|
77 | The QGridView class provides an abstract base for
|
---|
78 | fixed-size grids.
|
---|
79 | <p>
|
---|
80 | <p> A grid view consists of a number of abstract cells organized in
|
---|
81 | rows and columns. The cells have a fixed size and are identified
|
---|
82 | with a row index and a column index. The top-left cell is in row
|
---|
83 | 0, column 0. The bottom-right cell is in row <a href="#numRows">numRows</a>()-1, column
|
---|
84 | <a href="#numCols">numCols</a>()-1.
|
---|
85 | <p> You can define <a href="#numRows-prop">numRows</a>, <a href="#numCols-prop">numCols</a>, <a href="#cellWidth-prop">cellWidth</a> and <a href="#cellHeight-prop">cellHeight</a>. Reimplement the pure virtual function <a href="#paintCell">paintCell</a>() to
|
---|
86 | draw the contents of a cell.
|
---|
87 | <p> With <a href="#ensureCellVisible">ensureCellVisible</a>(), you can ensure a certain cell is
|
---|
88 | visible. With <a href="#rowAt">rowAt</a>() and <a href="#columnAt">columnAt</a>() you can find a cell based on
|
---|
89 | the given x- and y-coordinates.
|
---|
90 | <p> If you need to monitor changes to the grid's dimensions (i.e. when
|
---|
91 | numRows or numCols is changed), reimplement the <a href="#dimensionChange">dimensionChange</a>()
|
---|
92 | change handler.
|
---|
93 | <p> Note: the row and column indices are always given in the order,
|
---|
94 | row (vertical offset) then column (horizontal offset). This order
|
---|
95 | is the opposite of all pixel operations, which are given in the
|
---|
96 | order x (horizontal offset), y (vertical offset).
|
---|
97 | <p> QGridView is a very simple abstract class based on <a href="qscrollview.html">QScrollView</a>. It
|
---|
98 | is designed to simplify the task of drawing many cells of the same
|
---|
99 | size in a potentially scrollable canvas. If you need rows and
|
---|
100 | columns with different sizes, use a <a href="qtable.html">QTable</a> instead. If you need a
|
---|
101 | simple list of items, use a <a href="qlistbox.html">QListBox</a>. If you need to present
|
---|
102 | hierachical data use a <a href="qlistview.html">QListView</a>, and if you need random objects
|
---|
103 | at random positions, consider using either a <a href="qiconview.html">QIconView</a> or a
|
---|
104 | <a href="qcanvas.html">QCanvas</a>.
|
---|
105 | <p>See also <a href="abstractwidgets.html">Abstract Widget Classes</a>.
|
---|
106 |
|
---|
107 | <hr><h2>Member Function Documentation</h2>
|
---|
108 | <h3 class=fn><a name="QGridView"></a>QGridView::QGridView ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
---|
109 | </h3>
|
---|
110 | Constructs a grid view.
|
---|
111 | <p> The <em>parent</em>, <em>name</em> and <a href="qt.html#WidgetFlags">widget flag</a>, <em>f</em>, arguments are passed
|
---|
112 | to the <a href="qscrollview.html">QScrollView</a> constructor.
|
---|
113 |
|
---|
114 | <h3 class=fn><a name="~QGridView"></a>QGridView::~QGridView ()
|
---|
115 | </h3>
|
---|
116 | Destroys the grid view.
|
---|
117 |
|
---|
118 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="cellGeometry"></a>QGridView::cellGeometry ( int row, int column )
|
---|
119 | </h3>
|
---|
120 | Returns the geometry of cell (<em>row</em>, <em>column</em>) in the content
|
---|
121 | coordinate system.
|
---|
122 | <p> <p>See also <a href="#cellRect">cellRect</a>().
|
---|
123 |
|
---|
124 | <h3 class=fn>int <a name="cellHeight"></a>QGridView::cellHeight () const
|
---|
125 | </h3><p>Returns the height of a grid row.
|
---|
126 | See the <a href="qgridview.html#cellHeight-prop">"cellHeight"</a> property for details.
|
---|
127 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="cellRect"></a>QGridView::cellRect () const
|
---|
128 | </h3>
|
---|
129 |
|
---|
130 | <p> Returns the geometry of a cell in a cell's coordinate system. This
|
---|
131 | is a convenience function useful in <a href="#paintCell">paintCell</a>(). It is equivalent
|
---|
132 | to <a href="qrect.html">QRect</a>( 0, 0, <a href="#cellWidth">cellWidth</a>(), <a href="#cellHeight">cellHeight</a>() ).
|
---|
133 | <p> <p>See also <a href="#cellGeometry">cellGeometry</a>().
|
---|
134 |
|
---|
135 | <p>
|
---|
136 | <h3 class=fn>int <a name="cellWidth"></a>QGridView::cellWidth () const
|
---|
137 | </h3><p>Returns the width of a grid column.
|
---|
138 | See the <a href="qgridview.html#cellWidth-prop">"cellWidth"</a> property for details.
|
---|
139 | <h3 class=fn>int <a name="columnAt"></a>QGridView::columnAt ( int x ) const
|
---|
140 | </h3>
|
---|
141 |
|
---|
142 | <p> Returns the number of the column at position <em>x</em>. <em>x</em> must be
|
---|
143 | given in content coordinates.
|
---|
144 | <p> <p>See also <a href="#rowAt">rowAt</a>().
|
---|
145 |
|
---|
146 | <h3 class=fn>void <a name="dimensionChange"></a>QGridView::dimensionChange ( int oldNumRows, int oldNumCols )<tt> [virtual protected]</tt>
|
---|
147 | </h3>
|
---|
148 |
|
---|
149 | <p> This change handler is called whenever any of the grid's
|
---|
150 | dimensions change. <em>oldNumRows</em> and <em>oldNumCols</em> contain the
|
---|
151 | old dimensions, <a href="#numRows">numRows</a>() and <a href="#numCols">numCols</a>() contain the new
|
---|
152 | dimensions.
|
---|
153 |
|
---|
154 | <h3 class=fn>void <a name="ensureCellVisible"></a>QGridView::ensureCellVisible ( int row, int column )
|
---|
155 | </h3>
|
---|
156 | Ensures cell (<em>row</em>, <em>column</em>) is visible, scrolling the grid
|
---|
157 | view if necessary.
|
---|
158 |
|
---|
159 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="gridSize"></a>QGridView::gridSize () const
|
---|
160 | </h3>
|
---|
161 |
|
---|
162 | <p> Returns the size of the grid in pixels.
|
---|
163 | <p>
|
---|
164 | <h3 class=fn>int <a name="numCols"></a>QGridView::numCols () const
|
---|
165 | </h3><p>Returns the number of columns in the grid.
|
---|
166 | See the <a href="qgridview.html#numCols-prop">"numCols"</a> property for details.
|
---|
167 | <h3 class=fn>int <a name="numRows"></a>QGridView::numRows () const
|
---|
168 | </h3><p>Returns the number of rows in the grid.
|
---|
169 | See the <a href="qgridview.html#numRows-prop">"numRows"</a> property for details.
|
---|
170 | <h3 class=fn>void <a name="paintCell"></a>QGridView::paintCell ( <a href="qpainter.html">QPainter</a> * p, int row, int col )<tt> [pure virtual protected]</tt>
|
---|
171 | </h3>
|
---|
172 |
|
---|
173 | <p> This pure virtual function is called to paint the single cell at
|
---|
174 | (<em>row</em>, <em>col</em>) using painter <em>p</em>. The painter must be open when
|
---|
175 | <a href="#paintCell">paintCell</a>() is called and must remain open.
|
---|
176 | <p> The coordinate system is <a href="qpainter.html#translate">translated</a> so that the origin is at the top-left corner of the cell
|
---|
177 | to be painted, i.e. <em>cell</em> coordinates. Do not scale or shear
|
---|
178 | the coordinate system (or if you do, restore the <a href="qwmatrix.html#TransformationMode">transformation matrix</a> before you return).
|
---|
179 | <p> The painter is not clipped by default in order to get maximum
|
---|
180 | efficiency. If you want clipping, use
|
---|
181 | <p> <pre>
|
---|
182 | p->setClipRect( <a href="#cellRect">cellRect</a>(), QPainter::CoordPainter );
|
---|
183 | //... your drawing code
|
---|
184 | p->setClipping( FALSE );
|
---|
185 |
|
---|
186 | </pre>
|
---|
187 |
|
---|
188 |
|
---|
189 | <h3 class=fn>void <a name="paintEmptyArea"></a>QGridView::paintEmptyArea ( <a href="qpainter.html">QPainter</a> * p, int cx, int cy, int cw, int ch )<tt> [virtual protected]</tt>
|
---|
190 | </h3>
|
---|
191 | This function fills the <em>cw</em> pixels wide and <em>ch</em> pixels high
|
---|
192 | rectangle starting at position (<em>cx</em>, <em>cy</em>) with the background
|
---|
193 | color using the painter <em>p</em>.
|
---|
194 | <p> <a href="#paintEmptyArea">paintEmptyArea</a>() is invoked by <a href="qscrollview.html#drawContents">drawContents</a>() to erase or fill
|
---|
195 | unused areas.
|
---|
196 |
|
---|
197 | <h3 class=fn>void <a name="repaintCell"></a>QGridView::repaintCell ( int row, int column, bool erase = TRUE )
|
---|
198 | </h3>
|
---|
199 | Repaints cell (<em>row</em>, <em>column</em>).
|
---|
200 | <p> If <em>erase</em> is TRUE, Qt erases the area of the cell before the
|
---|
201 | <a href="#paintCell">paintCell</a>() call; otherwise no erasing takes place.
|
---|
202 | <p> <p>See also <a href="qwidget.html#repaint">QWidget::repaint</a>().
|
---|
203 |
|
---|
204 | <h3 class=fn>int <a name="rowAt"></a>QGridView::rowAt ( int y ) const
|
---|
205 | </h3>
|
---|
206 |
|
---|
207 | <p> Returns the number of the row at position <em>y</em>. <em>y</em> must be given
|
---|
208 | in content coordinates.
|
---|
209 | <p> <p>See also <a href="#columnAt">columnAt</a>().
|
---|
210 |
|
---|
211 | <h3 class=fn>void <a name="setCellHeight"></a>QGridView::setCellHeight ( int )<tt> [virtual]</tt>
|
---|
212 | </h3><p>Sets the height of a grid row.
|
---|
213 | See the <a href="qgridview.html#cellHeight-prop">"cellHeight"</a> property for details.
|
---|
214 | <h3 class=fn>void <a name="setCellWidth"></a>QGridView::setCellWidth ( int )<tt> [virtual]</tt>
|
---|
215 | </h3><p>Sets the width of a grid column.
|
---|
216 | See the <a href="qgridview.html#cellWidth-prop">"cellWidth"</a> property for details.
|
---|
217 | <h3 class=fn>void <a name="setNumCols"></a>QGridView::setNumCols ( int )<tt> [virtual]</tt>
|
---|
218 | </h3><p>Sets the number of columns in the grid.
|
---|
219 | See the <a href="qgridview.html#numCols-prop">"numCols"</a> property for details.
|
---|
220 | <h3 class=fn>void <a name="setNumRows"></a>QGridView::setNumRows ( int )<tt> [virtual]</tt>
|
---|
221 | </h3><p>Sets the number of rows in the grid.
|
---|
222 | See the <a href="qgridview.html#numRows-prop">"numRows"</a> property for details.
|
---|
223 | <h3 class=fn>void <a name="updateCell"></a>QGridView::updateCell ( int row, int column )
|
---|
224 | </h3>
|
---|
225 | Updates cell (<em>row</em>, <em>column</em>).
|
---|
226 | <p> <p>See also <a href="qwidget.html#update">QWidget::update</a>().
|
---|
227 |
|
---|
228 | <hr><h2>Property Documentation</h2>
|
---|
229 | <h3 class=fn>int <a name="cellHeight-prop"></a>cellHeight</h3>
|
---|
230 | <p>This property holds the height of a grid row.
|
---|
231 | <p>All rows in a grid view have the same height.
|
---|
232 | <p> <p>See also <a href="#cellWidth-prop">cellWidth</a>.
|
---|
233 |
|
---|
234 | <p>Set this property's value with <a href="#setCellHeight">setCellHeight</a>() and get this property's value with <a href="#cellHeight">cellHeight</a>().
|
---|
235 | <h3 class=fn>int <a name="cellWidth-prop"></a>cellWidth</h3>
|
---|
236 | <p>This property holds the width of a grid column.
|
---|
237 | <p>All columns in a grid view have the same width.
|
---|
238 | <p> <p>See also <a href="#cellHeight-prop">cellHeight</a>.
|
---|
239 |
|
---|
240 | <p>Set this property's value with <a href="#setCellWidth">setCellWidth</a>() and get this property's value with <a href="#cellWidth">cellWidth</a>().
|
---|
241 | <h3 class=fn>int <a name="numCols-prop"></a>numCols</h3>
|
---|
242 | <p>This property holds the number of columns in the grid.
|
---|
243 | <p>Set this property's value with <a href="#setNumCols">setNumCols</a>() and get this property's value with <a href="#numCols">numCols</a>().
|
---|
244 | <p><p>See also <a href="#numRows-prop">numRows</a>.
|
---|
245 |
|
---|
246 | <h3 class=fn>int <a name="numRows-prop"></a>numRows</h3>
|
---|
247 | <p>This property holds the number of rows in the grid.
|
---|
248 | <p>Set this property's value with <a href="#setNumRows">setNumRows</a>() and get this property's value with <a href="#numRows">numRows</a>().
|
---|
249 | <p><p>See also <a href="#numCols-prop">numCols</a>.
|
---|
250 |
|
---|
251 | <!-- eof -->
|
---|
252 | <hr><p>
|
---|
253 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
254 | Copyright © 1995-2007
|
---|
255 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
256 | <table width=100% cellspacing=0 border=0><tr>
|
---|
257 | <td>Copyright © 2007
|
---|
258 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
259 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
260 | </table></div></address></body>
|
---|
261 | </html>
|
---|