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