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 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QTableView Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QTableView Class Reference</h1><br clear="all">
<p>
This is an abstract base class for implementing tables
<a href="#details">More...</a>
<p>
<code>#include <<a href="qtableview-h.html">qtableview.h</a>></code>
<p>
Inherits <a href="qframe.html">QFrame</a>.
<p>Inherited by <a href="qmultilineedit.html">QMultiLineEdit</a>.
<p><a href="qtableview-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn">virtualvoid<b>setBackgroundColor</b>(constQColor&)(internal)</div>
<li><div class="fn">void<a href="#49f85b"><b>repaint</b></a>(boolerase=TRUE)</div>
<li><div class="fn">void<a href="#a783dc"><b>repaint</b></a>(intx, inty, intw, inth, boolerase=TRUE)</div>
<li><div class="fn">void<a href="#58d029"><b>repaint</b></a>(constQRect&, boolerase=TRUE)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn"><a href="#10f0df"><b>QTableView</b></a>(QWidget*parent=0, constchar*name=0, WFlagsf=0)</div>
<li><div class="fn"><a href="#8a8e63"><b>~QTableView</b></a>()</div>
<li><div class="fn">int<a href="#5d9eee"><b>numRows</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#41a2f2"><b>setNumRows</b></a>(int)</div>
<li><div class="fn">int<a href="#4e3659"><b>numCols</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#72282a"><b>setNumCols</b></a>(int)</div>
<li><div class="fn">int<a href="#67ccdf"><b>topCell</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#d9d86b"><b>setTopCell</b></a>(introw)</div>
<li><div class="fn">int<a href="#6a73cd"><b>leftCell</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#63123c"><b>setLeftCell</b></a>(intcol)</div>
<li><div class="fn">virtualvoid<a href="#538aba"><b>setTopLeftCell</b></a>(introw, intcol)</div>
<li><div class="fn">int<a href="#5eca5c"><b>xOffset</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#26b6d5"><b>setXOffset</b></a>(int)</div>
<li><div class="fn">int<a href="#b27182"><b>yOffset</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#0676b2"><b>setYOffset</b></a>(int)</div>
<li><div class="fn">virtualvoid<a href="#d54803"><b>setOffset</b></a>(intx, inty, boolupdateScrBars=TRUE)</div>
<li><div class="fn">virtualint<a href="#2503ca"><b>cellWidth</b></a>(intcol)</div>
<li><div class="fn">virtualint<a href="#5ee1fb"><b>cellHeight</b></a>(introw)</div>
<li><div class="fn">int<a href="#b9b22b"><b>cellWidth</b></a>()const</div>
<li><div class="fn">int<a href="#d9bfb7"><b>cellHeight</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#aa3791"><b>setCellWidth</b></a>(int)</div>
<li><div class="fn">virtualvoid<a href="#298e28"><b>setCellHeight</b></a>(int)</div>
<li><div class="fn">virtualint<a href="#6889ff"><b>totalWidth</b></a>()</div>
<li><div class="fn">virtualint<a href="#f5648d"><b>totalHeight</b></a>()</div>
<li><div class="fn">uint<a href="#92ddc5"><b>tableFlags</b></a>()const</div>
<li><div class="fn">bool<a href="#b22ac0"><b>testTableFlags</b></a>(uintf)const</div>
<li><div class="fn">virtualvoid<a href="#114e3a"><b>setTableFlags</b></a>(uintf)</div>
<li><div class="fn">void<a href="#44983d"><b>clearTableFlags</b></a>(uintf=~0)</div>
<li><div class="fn">bool<a href="#798153"><b>autoUpdate</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#ebb520"><b>setAutoUpdate</b></a>(bool)</div>
<li><div class="fn">void<a href="#8be89f"><b>updateCell</b></a>(introw, intcolumn, boolerase=TRUE)</div>
<li><div class="fn">QRect<a href="#209dc7"><b>cellUpdateRect</b></a>()const</div>
<li><div class="fn">QRect<a href="#cb656a"><b>viewRect</b></a>()const</div>
<li><div class="fn">int<a href="#7e3b8b"><b>lastRowVisible</b></a>()const</div>
<li><div class="fn">int<a href="#cb7e68"><b>lastColVisible</b></a>()const</div>
<li><div class="fn">bool<a href="#6caa7f"><b>rowIsVisible</b></a>(introw)const</div>
<li><div class="fn">bool<a href="#7b707d"><b>colIsVisible</b></a>(intcol)const</div>
<li><div class="fn">QScrollBar*<a href="#604b25"><b>verticalScrollBar</b></a>()const</div>
<li><div class="fn">QScrollBar*<a href="#a371df"><b>horizontalScrollBar</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#9ee77d"><b>paintCell</b></a>(QPainter*, introw, intcol)</div>
<li><div class="fn">virtualvoid<a href="#8389b8"><b>setupPainter</b></a>(QPainter*)</div>
<li><div class="fn">virtualvoid<a href="#5343f7"><b>paintEvent</b></a>(QPaintEvent*)</div>
<li><div class="fn">int<a href="#e2a9d6"><b>findRow</b></a>(intyPos)const</div>
<li><div class="fn">int<a href="#d473e6"><b>findCol</b></a>(intxPos)const</div>
<li><div class="fn">bool<a href="#9a95ca"><b>rowYPos</b></a>(introw, int*yPos)const</div>
<li><div class="fn">bool<a href="#190f64"><b>colXPos</b></a>(intcol, int*xPos)const</div>
<li><div class="fn">int<a href="#06411c"><b>maxXOffset</b></a>()</div>
<li><div class="fn">int<a href="#bc5261"><b>maxYOffset</b></a>()</div>
<li><div class="fn">int<a href="#32841f"><b>maxColOffset</b></a>()</div>
<li><div class="fn">int<a href="#60ab3f"><b>maxRowOffset</b></a>()</div>
<li><div class="fn">int<a href="#b673d1"><b>minViewX</b></a>()const</div>
<li><div class="fn">int<a href="#236bb5"><b>minViewY</b></a>()const</div>
<li><div class="fn">int<a href="#817e8d"><b>maxViewX</b></a>()const</div>
<li><div class="fn">int<a href="#557ad1"><b>maxViewY</b></a>()const</div>
<li><div class="fn">int<a href="#a61761"><b>viewWidth</b></a>()const</div>
<li><div class="fn">int<a href="#8301e1"><b>viewHeight</b></a>()const</div>
<li><div class="fn">void<a href="#55dcd2"><b>scroll</b></a>(intxPixels, intyPixels)</div>
<li><div class="fn">void<a href="#70d596"><b>updateScrollBars</b></a>()</div>
<li><div class="fn">void<a href="#c208d7"><b>updateTableSize</b></a>()</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
This is an abstract base class for implementing tables
<p>
A table view consists of a number of abstract cells organized in rows
and columns and a visible part called a view. The cells are identified
with a row index and a column index. The top left cell is in row 0,
column 0.
<p>The behavior of the widget can be finely tuned using
<a href="#114e3a">setTableFlags</a>(); a typical subclass will consist of little more than a
call to setTableFlags(), some table content manipulation, and an
implementation of <a href="#9ee77d">paintCell</a>(). Subclasses that need cells with
variable width or height must reimplement <a href="#5ee1fb">cellHeight</a>() and/or
<a href="#2503ca">cellWidth</a>(). Use <a href="#c208d7">updateTableSize</a>() to tell QTableView when the
width or height has changed.
<p>When you read this documentation, it is important to understand the
distinctions between the four pixel coordinate systems involved.
<p><ol>
<li> The <em>cell</em> coordinates. (0,0) is the top left corner of a cell.
This is used by functions such as paintCell().
<li> The <em>table</em> coordinates. (0,0) is the top left corner of the cell at
row 0 and column 0. These coordinates are absolute; that is, they are
independent of what part of the table is visible at the moment. This is
used by functions such as <a href="#26b6d5">setXOffset</a>() or <a href="#bc5261">maxYOffset</a>().
<li> The <em>widget</em> coordinates. (0,0) is the top left corner of the widget,
<em>including</em> the frame. This is used by functions such as <a href="#a783dc">repaint</a>().
<li> The <em>view</em> coordinates. (0,0) is the top left corner of the view, <em>excluding</em> the frame. This is the least-used coordinate system, used by
functions such as <a href="#a61761">viewWidth</a>(). </ol>
<p>It is rather unfortunate that we have to use four different
coordinate systems, but if we were to provide a flexible and
powerful base class, there wasn't any way around it.
<p>Note: The row,column indices are always given in that order,
i.e. first the vertical (row), then the horizontal (column). This is
the opposite order of all pixel operations, which take first the
horizontal (x), then the vertical (y).
<p><img src=qtablevw-m.png> <img src=qtablevw-w.png><p><b>Warning:</b> the functions <a href="#41a2f2">setNumRows</a>(), <a href="#72282a">setNumCols</a>(), <a href="#298e28">setCellHeight</a>(),
<a href="#aa3791">setCellWidth</a>(), setTableFlags() and <a href="#44983d">clearTableFlags</a>() may cause
virtual functions like cellWidth() and cellHeight() to be called,
even if <a href="#798153">autoUpdate</a>() is FALSE. This may cause errors if relevant
state variables are not initialized.<p><b>Warning:</b> Experience has shown that use of this widget tends to bring
more bugs than expected, and our analysis indicates that widget's
very flexibility is the problem. If <a href="qscrollview.html">QScrollView</a> or <a href="qlistbox.html">QListBox</a> can
easily be made to do the job you need, we recommend subclassing
those widgets rather than QTableView. In addition, QScrollView makes
it easy to have child widgets inside tables, something QTableView
doesn't support at all.
<p>See also <a href="qscrollview.html">QScrollView</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Table</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="10f0df"></a>QTableView::QTableView(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0, WFlagsf=0) <code>[protected]</code></h3>
<p>Constructs a table view. All the arguments are passed to the <a href="qframe.html">QFrame</a>
constructor.
<p>The <a href="#114e3a">table flags</a> are all cleared (set to zero).
Set <code>Tbl_autoVScrollBar</code> or <code>Tbl_autoHScrollBar</code> to get automatic scroll
bars and <code>Tbl_clipCellPainting</code> to get safe clipping.
<p>The <a href="#298e28">cell height</a> and <a href="#aa3791">cell width</a> are set to 0.
<p>Frame line shapes (QFrame::HLink and QFrame::VLine) are disallowed,
see <a href="qframe.html#558f79">QFrame::setFrameStyle</a>().
<p>Note that the <em>f</em> argument is <em>not</em> <a href="#114e3a">table
flags</a> but rather <a href="qwidget.html#49eb47">widget
flags.</a>
<h3 class="fn"><a name="8a8e63"></a>QTableView::~QTableView() <code>[protected]</code></h3>
<p>Destructs the table view.
<h3 class="fn">bool<a name="798153"></a>QTableView::autoUpdate()const <code>[protected]</code></h3>
<p>Returns TRUE if the view updates itself automatically whenever it
is changed in some way.
<p>See also <a href="#ebb520">setAutoUpdate</a>().
<h3 class="fn">int<a name="d9bfb7"></a>QTableView::cellHeight()const <code>[protected]</code></h3>
<p>Returns the row height, in pixels. Returns 0 if the rows have
variable heights.
<p>See also <a href="#298e28">setCellHeight</a>() and <a href="#2503ca">cellWidth</a>().
<h3 class="fn">int<a name="5ee1fb"></a>QTableView::cellHeight(int) <code>[virtualprotected]</code></h3>
<p>Returns the height of row <em>row,</em> in pixels.
<p>This function is virtual and must be reimplemented by subclasses that
have variable cell heights. Note that if the total table height
changes, <a href="#c208d7">updateTableSize</a>() must be called.
<p>See also <a href="#298e28">setCellHeight</a>(), <a href="#2503ca">cellWidth</a>() and <a href="#f5648d">totalHeight</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="209dc7"></a>QTableView::cellUpdateRect()const <code>[protected]</code></h3>
<p>This function should only be called from the <a href="#9ee77d">paintCell</a>() function in
subclasses. It returns the portion of a cell that actually needs to be
updated, in <em>cell</em> coordinates. This is only useful for non-trivial
paintCell().
<h3 class="fn">int<a name="b9b22b"></a>QTableView::cellWidth()const <code>[protected]</code></h3>
<p>Returns the column width, in pixels. Returns 0 if the columns have
variable widths.
<p>See also <a href="#aa3791">setCellWidth</a>() and <a href="#5ee1fb">cellHeight</a>().
<h3 class="fn">int<a name="2503ca"></a>QTableView::cellWidth(int) <code>[virtualprotected]</code></h3>
<p>Returns the width of column <em>col,</em> in pixels.
<p>This function is virtual and must be reimplemented by subclasses that
have variable cell widths. Note that if the total table width
changes, <a href="#c208d7">updateTableSize</a>() must be called.
<p>See also <a href="#aa3791">setCellWidth</a>(), <a href="#5ee1fb">cellHeight</a>(), <a href="#6889ff">totalWidth</a>() and <a href="#c208d7">updateTableSize</a>().
<h3 class="fn">void<a name="44983d"></a>QTableView::clearTableFlags(uintf=~0) <code>[protected]</code></h3>
<p>Clears the <a href="#114e3a">table flags</a> that are set
in <em>f.</em>
<p>Example (clears a single flag):
<pre> clearTableFlags( Tbl_snapToGrid );
</pre>
<p>The default argument clears all flags.
<p>See also <a href="#114e3a">setTableFlags</a>(), <a href="#b22ac0">testTableFlags</a>() and <a href="#92ddc5">tableFlags</a>().
<h3 class="fn">bool<a name="7b707d"></a>QTableView::colIsVisible(intcol)const <code>[protected]</code></h3>
<p>Returns TRUE if <em>col</em> is at least partially visible.
<p>See also <a href="#6caa7f">rowIsVisible</a>().
<h3 class="fn">bool<a name="190f64"></a>QTableView::colXPos(intcol, int*xPos)const <code>[protected]</code></h3>
<p>Computes the position in the widget of column <em>column.</em>
<p>Returns TRUE and stores the result in <em>*xPos</em> (in <em>widget</em>
coordinates) if the column is visible. Returns FALSE and does not
modify <em>*xPos</em> if <em>col</em> is invisible or invalid.
<p>See also <a href="#9a95ca">rowYPos</a>() and <a href="#d473e6">findCol</a>().
<h3 class="fn">int<a name="d473e6"></a>QTableView::findCol(intxPos)const <code>[protected]</code></h3>
<p>Returns the index of the column at position <em>xPos,</em> where <em>xPos</em> is
in <em>widget</em> coordinates. Returns -1 if <em>xPos</em> is outside the valid
range.
<p>See also <a href="#e2a9d6">findRow</a>() and <a href="#190f64">colXPos</a>().
<h3 class="fn">int<a name="e2a9d6"></a>QTableView::findRow(intyPos)const <code>[protected]</code></h3>
<p>Returns the index of the row at position <em>yPos,</em> where <em>yPos</em> is in
<em>widget</em> coordinates. Returns -1 if <em>yPos</em> is outside the valid
range.
<p>See also <a href="#d473e6">findCol</a>() and <a href="#9a95ca">rowYPos</a>().
<h3 class="fn"><a href="qscrollbar.html">QScrollBar</a>*<a name="a371df"></a>QTableView::horizontalScrollBar()const <code>[protected]</code></h3>
<p>Returns a pointer to the horizontal scroll bar, mainly so you can
<a href="qobject.html#7f8e37">connect</a>() to its signals. Note that the scroll bar works in pixel
values, use <a href="#d473e6">findCol</a>() to translate to cell numbers.
<h3 class="fn">int<a name="cb7e68"></a>QTableView::lastColVisible()const <code>[protected]</code></h3>
<p>Returns the index of the last (right) column in the view.
The index of the first column is 0.
<p>If no columns are visible it returns -1. This can happen if the
view is too narrow for the first column and Tbl_cutCellsH is set.
<p>See also <a href="#7e3b8b">lastRowVisible</a>().
<h3 class="fn">int<a name="7e3b8b"></a>QTableView::lastRowVisible()const <code>[protected]</code></h3>
<p>Returns the index of the last (bottom) row in the view.
The index of the first row is 0.
<p>If no rows are visible it returns -1. This can happen if the
view is too small for the first row and Tbl_cutCellsV is set.
<p>See also <a href="#cb7e68">lastColVisible</a>().
<h3 class="fn">int<a name="6a73cd"></a>QTableView::leftCell()const <code>[protected]</code></h3>
<p>Returns the index of the first column in the table that is visible in
the view. The index of the very leftmost column is 0.
<p>See also <a href="#67ccdf">topCell</a>() and <a href="#63123c">setLeftCell</a>().
<h3 class="fn">int<a name="32841f"></a>QTableView::maxColOffset() <code>[protected]</code></h3>
<p>Returns the index of the last column which may be at the left edge
of the view.
<p>Depending on the <a href="#114e3a">Tbl_scrollLastHCell</a> flag,
this may or may not be the last column.
<p>See also <a href="#06411c">maxXOffset</a>() and <a href="#60ab3f">maxRowOffset</a>().
<h3 class="fn">int<a name="60ab3f"></a>QTableView::maxRowOffset() <code>[protected]</code></h3>
<p>Returns the index of the last row which may be at the top edge of
the view.
<p>Depending on the <a href="#114e3a">Tbl_scrollLastVCell</a> flag,
this may or may not be the last row.
<p>See also <a href="#bc5261">maxYOffset</a>() and <a href="#32841f">maxColOffset</a>().
<h3 class="fn">int<a name="817e8d"></a>QTableView::maxViewX()const <code>[protected]</code></h3>
<p>Returns the rightmost pixel of the table view in <em>view</em>
coordinates. This excludes the frame and any scroll bar, but
includes blank pixels to the right of the visible table data.
<p>See also <a href="#557ad1">maxViewY</a>(), <a href="#a61761">viewWidth</a>() and <a href="qframe.html#f558c2">contentsRect</a>().
<h3 class="fn">int<a name="557ad1"></a>QTableView::maxViewY()const <code>[protected]</code></h3>
<p>Returns the bottom pixel of the table view in <em>view</em>
coordinates. This excludes the frame and any scroll bar, but
includes blank pixels below the visible table data.
<p>See also <a href="#817e8d">maxViewX</a>(), <a href="#8301e1">viewHeight</a>() and <a href="qframe.html#f558c2">contentsRect</a>().
<h3 class="fn">int<a name="06411c"></a>QTableView::maxXOffset() <code>[protected]</code></h3>
<p>Returns the maximum horizontal offset within the table of the
view's left edge, in <em>table</em> coordinates.
<p>This is used mainly to set the horizontal scroll bar's range.
<p>See also <a href="#32841f">maxColOffset</a>(), <a href="#bc5261">maxYOffset</a>() and <a href="#6889ff">totalWidth</a>().
<h3 class="fn">int<a name="bc5261"></a>QTableView::maxYOffset() <code>[protected]</code></h3>
<p>Returns the maximum vertical offset within the table of the
view's top edge, in <em>table</em> coordinates.
<p>This is used mainly to set the vertical scroll bar's range.
<p>See also <a href="#60ab3f">maxRowOffset</a>(), <a href="#06411c">maxXOffset</a>() and <a href="#f5648d">totalHeight</a>().
<h3 class="fn">int<a name="b673d1"></a>QTableView::minViewX()const <code>[protected]</code></h3>
<p>Returns the leftmost pixel of the table view in <em>view</em>
coordinates. This excludes the frame and any header.
<p>See also <a href="#557ad1">maxViewY</a>(), <a href="#a61761">viewWidth</a>() and <a href="qframe.html#f558c2">contentsRect</a>().
<h3 class="fn">int<a name="236bb5"></a>QTableView::minViewY()const <code>[protected]</code></h3>
<p>Returns the top pixel of the table view in <em>view</em>
coordinates. This excludes the frame and any header.
<p>See also <a href="#817e8d">maxViewX</a>(), <a href="#8301e1">viewHeight</a>() and <a href="qframe.html#f558c2">contentsRect</a>().
<h3 class="fn">int<a name="4e3659"></a>QTableView::numCols()const <code>[protected]</code></h3>
<p>Returns the number of columns in the table
<p>See also <a href="#5d9eee">numRows</a>() and <a href="#72282a">setNumCols</a>().
<h3 class="fn">int<a name="5d9eee"></a>QTableView::numRows()const <code>[protected]</code></h3>
<p>Returns the number of rows in the table.
<p>See also <a href="#4e3659">numCols</a>() and <a href="#41a2f2">setNumRows</a>().
<h3 class="fn">void<a name="9ee77d"></a>QTableView::paintCell(<a href="qpainter.html">QPainter</a>*p, introw, intcol) <code>[virtualprotected]</code></h3>
<p>This pure virtual function is called to paint the single cell at <em>(row,col)</em> using <em>p,</em> which is open when paintCell() is called and
must remain open.
<p>The coordinate system is <a href="qpainter.html#eb778c">translated</a>
such 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 transformation matrix before you
return).
<p>By default, the painter is not clipped, for maximum efficiency. For safety,
call <a href="#114e3a">setTableFlags</a>(Tbl_clipCellPainting) to enable clipping.
<p>See also <a href="#5343f7">paintEvent</a>(), <a href="qpainter.html">QPainter</a>() and <a href="#114e3a">setTableFlags</a>().
<p>Reimplemented in <a href="qmultilineedit.html#9220ed">QMultiLineEdit</a>.
<h3 class="fn">void<a name="5343f7"></a>QTableView::paintEvent(<a href="qpaintevent.html">QPaintEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Handles paint events for the table view.
<p>Calls <a href="#9ee77d">paintCell</a>() for the cells that needs to be repainted.
<p>Reimplemented from <a href="qwidget.html#e3d821">QWidget.</a>
<h3 class="fn">void<a name="a783dc"></a>QTableView::repaint(intx, inty, intw, inth, boolerase=TRUE)</h3>
<p>Repaints the table view directly by calling <a href="#5343f7">paintEvent</a>() directly,
unless updates are disabled.
<p>Erases the view area <em>(x,y,w,h)</em> if <em>erase</em> is TRUE. Parameters <em>(x,y)</em> are in <em>widget</em> coordinates.
<p>If <em>w</em> is negative, it is replaced with <code><a href="qwidget.html#2edab1">width</a>() - x</code>.
If <em>h</em> is negative, it is replaced width <code><a href="qwidget.html#e3c588">height</a>() - y</code>.
<p>Doing a repaint() usually is faster than doing an <a href="qwidget.html#f3f721">update</a>(), but
calling update() many times in a row will generate a single paint
event.
<p>At present, QTableView is the only widget that reimplements <a href="qwidget.html#7569b1">repaint()</a>. It does this because by
clearing and then repainting one cell at at time, it can make the
screen flicker less than it would otherwise.
<h3 class="fn">void<a name="49f85b"></a>QTableView::repaint(boolerase=TRUE)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Repaints the entire view.
<h3 class="fn">void<a name="58d029"></a>QTableView::repaint(const<a href="qrect.html">QRect</a>&r, boolerase=TRUE)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="cc633e"></a>QTableView::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">bool<a name="6caa7f"></a>QTableView::rowIsVisible(introw)const <code>[protected]</code></h3>
<p>Returns TRUE if <em>row</em> is at least partially visible.
<p>See also <a href="#7b707d">colIsVisible</a>().
<h3 class="fn">bool<a name="9a95ca"></a>QTableView::rowYPos(introw, int*yPos)const <code>[protected]</code></h3>
<p>Computes the position in the widget of row <em>row.</em>
<p>Returns TRUE and stores the result in <em>*yPos</em> (in <em>widget</em>
coordinates) if the row is visible. Returns FALSE and does not modify
<em>*yPos</em> if <em>row</em> is invisible or invalid.
<p>See also <a href="#190f64">colXPos</a>() and <a href="#e2a9d6">findRow</a>().
<h3 class="fn">void<a name="55dcd2"></a>QTableView::scroll(intxPixels, intyPixels) <code>[protected]</code></h3>
<p>Moves the visible area of the table rightwards by <em>xPixels</em> and
downwards by <em>yPixels</em> pixels. Both may be negative.<p><b>Warning:</b> You might find that <a href="qscrollview.html">QScrollView</a> offers a higher-level of
functionality than using QTableView and this function.
<p>This function is <em>not</em> the same as <a href="qwidget.html#d7aad8">QWidget::scroll</a>(), in particular,
the signs of <em>xPixels</em> and <em>yPixels</em> have the reverse semantics.
<p>See also <a href="#26b6d5">setXOffset</a>(), <a href="#0676b2">setYOffset</a>(), <a href="#d54803">setOffset</a>(), <a href="#d9d86b">setTopCell</a>(), <a href="#63123c">setLeftCell</a>() and setTopLeftOffset().
<h3 class="fn">void<a name="ebb520"></a>QTableView::setAutoUpdate(boolenable) <code>[virtualprotected]</code></h3>
<p>Sets the auto-update option of the table view to <em>enable.</em>
<p>If <em>enable</em> is TRUE (this is the default) then the view updates itself
automatically whenever it has changed in some way (for example when a
<a href="#114e3a">flag</a> is changed).
<p>If <em>enable</em> is FALSE, the view does NOT repaint itself, or update
its internal state variables itself when it is changed. This can be
useful to avoid flicker during large changes, and is singularly
useless otherwise: Disable auto-update, do the changes, re-enable
auto-update, and call <a href="#a783dc">repaint</a>().<p><b>Warning:</b> Do not leave the view in this state for a long time
(i.e. between events ). If, for example, the user interacts with the
view when auto-update is off, strange things can happen.
<p>Setting auto-update to TRUE does not repaint the view, you must call
repaint() to do this.
<p>See also <a href="#798153">autoUpdate</a>() and <a href="#a783dc">repaint</a>().
<h3 class="fn">void<a name="298e28"></a>QTableView::setCellHeight(intcellHeight) <code>[virtualprotected]</code></h3>
<p>Sets the height in pixels of the table cells to <em>cellHeight.</em>
<p>Setting it to zero means that the row height is variable. When set
to 0 (this is the default) QTableView calls the virtual function
<a href="#5ee1fb">cellHeight</a>() to get the height.
<p>See also <a href="#5ee1fb">cellHeight</a>(), <a href="#aa3791">setCellWidth</a>(), <a href="#f5648d">totalHeight</a>() and <a href="#5d9eee">numRows</a>().
<h3 class="fn">void<a name="aa3791"></a>QTableView::setCellWidth(intcellWidth) <code>[virtualprotected]</code></h3>
<p>Sets the width in pixels of the table cells to <em>cellWidth.</em>
<p>Setting it to zero means that the column width is variable. When
set to 0 (this is the default) QTableView calls the virtual function
<a href="#2503ca">cellWidth</a>() to get the width.
<p>See also <a href="#2503ca">cellWidth</a>(), <a href="#298e28">setCellHeight</a>(), <a href="#6889ff">totalWidth</a>() and <a href="#4e3659">numCols</a>().
<h3 class="fn">void<a name="63123c"></a>QTableView::setLeftCell(intcol) <code>[virtualprotected]</code></h3>
<p>Scrolls the table such that <em>col</em> becomes the leftmost
column. The index of the very leftmost column is 0.
<p>See also <a href="#26b6d5">setXOffset</a>(), <a href="#538aba">setTopLeftCell</a>() and <a href="#d9d86b">setTopCell</a>().
<h3 class="fn">void<a name="72282a"></a>QTableView::setNumCols(intcols) <code>[virtualprotected]</code></h3>
<p>Sets the number of columns of the table to <em>cols</em> (must be non-negative).
Does not change <a href="#6a73cd">leftCell</a>().
<p>The table repaints itself automatically if <a href="#798153">autoUpdate</a>() is set.
<p>See also <a href="#4e3659">numCols</a>(), <a href="#5d9eee">numRows</a>() and <a href="#41a2f2">setNumRows</a>().
<h3 class="fn">void<a name="41a2f2"></a>QTableView::setNumRows(introws) <code>[virtualprotected]</code></h3>
<p>Sets the number of rows of the table to <em>rows</em> (must be non-negative).
Does not change <a href="#67ccdf">topCell</a>().
<p>The table repaints itself automatically if <a href="#798153">autoUpdate</a>() is set.
<p>See also <a href="#4e3659">numCols</a>(), <a href="#72282a">setNumCols</a>() and <a href="#5d9eee">numRows</a>().
<h3 class="fn">void<a name="d54803"></a>QTableView::setOffset(intx, inty, boolupdateScrBars=TRUE) <code>[virtualprotected]</code></h3>
<p>Scrolls the table such that <em>(x,y)</em> becomes the top left pixel
in the view. Parameters <em>(x,y)</em> are in <em>table</em> coordinates.
<p>The interaction with <a href="#114e3a">Tbl_snapTo*Grid</a>
is tricky. If <em>updateScrBars</em> is TRUE, the scroll bars are
updated.
<p>See also <a href="#5eca5c">xOffset</a>(), <a href="#b27182">yOffset</a>(), <a href="#26b6d5">setXOffset</a>(), <a href="#0676b2">setYOffset</a>() and <a href="#538aba">setTopLeftCell</a>().
<h3 class="fn">void<a name="b6281e"></a>QTableView::setPalette(const<a href="qpalette.html">QPalette</a>&p) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="114e3a"></a>QTableView::setTableFlags(uintf) <code>[virtualprotected]</code></h3>
<p>Sets the table flags to <em>f.</em>
<p>If a flag setting changes the appearance of the table the table is
repainted if and only if <a href="#798153">autoUpdate</a>() is TRUE.
<p>The table flags are mostly single bits, though there are some multibit
flags for convenience. Here is a complete list:
<p><dl compact>
<dt> Tbl_vScrollBar <dd> The table has a vertical scroll bar.
<dt> Tbl_hScrollBar <dd> The table has a horizontal scroll bar.
<dt> Tbl_autoVScrollBar <dd> The table has a vertical scroll bar if
and only if the table is taller than the view.
<dt> Tbl_autoHScrollBar <dd> The table has a horizontal scroll bar if
and only if the table is wider than the view.
<dt> Tbl_autoScrollBars <dd> The union of the previous two flags.
<dt> Tbl_clipCellPainting <dd> The table uses <a href="qpainter.html#898839">QPainter::setClipRect</a>() to
make sure that <a href="#9ee77d">paintCell</a>() will not draw outside the cell
boundaries.
<dt> Tbl_cutCellsV <dd> The table will never show part of a
cell at the bottom of the table; if there is not space for all of
a cell the space is left blank.
<dt> Tbl_cutCellsH <dd> The table will never show part of a
cell at the right side of the table; if there is not space for all of
a cell the space is left blank.
<dt> Tbl_cutCells <dd> The union of the previous two flags.
<dt> Tbl_scrollLastHCell <dd> When the user scrolls horizontally,
let him/her scroll the last cell leftward until it is at the left
edge of the view. If this flag is not set, the user can only scroll
to the point where last cell is completely visible.
<dt> Tbl_scrollLastVCell <dd> When the user scrolls vertically, let
him/her scroll the last cell upward until it is at the top edge of
the view. If this flag is not set, the user can only scroll to the
point where last cell is completely visible.
<dt> Tbl_scrollLastCell <dd> The union of the previous two flags.
<dt> Tbl_smoothHScrolling <dd> The table scrolls as smoothly as
possible when the user scrolls horizontally. When this flag is not
set scrolling is done one cell at a time.
<dt> Tbl_smoothVScrolling <dd> The table scrolls as smoothly as
possible when scrolling vertically. When this flag is not set
scrolling is done one cell at a time.
<dt> Tbl_smoothScrolling <dd> The union of of previous two flags.
<dt> Tbl_snapToHGrid <dd> Except when the user is actually scrolling,
the leftmost column shown snaps to the leftmost edge of the view.
<dt> Tbl_snapToVGrid <dd> Except when the user is actually
scrolling, the top row snaps to the top edge of the view.
<dt> Tbl_snapToGrid <dd> The union of the previous two flags.
</dl>
<p>You can specify more than one flag at a time using bitwise OR.
<p>Example:
<pre> setTableFlags( Tbl_smoothScrolling | Tbl_autoScrollBars );
</pre>
<p><b>Warning:</b> The cutCells options (<code>Tbl_cutCells, Tbl_cutCellsH</code> and
Tbl_cutCellsV) may cause painting problems when scrollbars are
enabled. Do not combine cutCells and scrollbars.
<p>See also <a href="#44983d">clearTableFlags</a>(), <a href="#b22ac0">testTableFlags</a>() and <a href="#92ddc5">tableFlags</a>().
<h3 class="fn">void<a name="d9d86b"></a>QTableView::setTopCell(introw) <code>[virtualprotected]</code></h3>
<p>Scrolls the table such that <em>row</em> becomes the top row.
The index of the very first row is 0.
<p>See also <a href="#0676b2">setYOffset</a>(), <a href="#538aba">setTopLeftCell</a>() and <a href="#63123c">setLeftCell</a>().
<h3 class="fn">void<a name="538aba"></a>QTableView::setTopLeftCell(introw, intcol) <code>[virtualprotected]</code></h3>
<p>Scrolls the table such that the cell at row <em>row</em> and colum <em>col</em> becomes the top left cell in the view. The cell at the extreme
top left of the table is at position (0,0).
<p>See also <a href="#63123c">setLeftCell</a>(), <a href="#d9d86b">setTopCell</a>() and <a href="#d54803">setOffset</a>().
<h3 class="fn">void<a name="26b6d5"></a>QTableView::setXOffset(intx) <code>[virtualprotected]</code></h3>
<p>Scrolls the table such that <em>x</em> becomes the leftmost pixel in the view.
The <em>x</em> parameter is in <em>table</em> coordinates.
<p>The interaction with <a href="#114e3a">Tbl_snapToHGrid</a> is tricky.
<p>See also <a href="#5eca5c">xOffset</a>(), <a href="#0676b2">setYOffset</a>(), <a href="#d54803">setOffset</a>() and <a href="#63123c">setLeftCell</a>().
<h3 class="fn">void<a name="0676b2"></a>QTableView::setYOffset(inty) <code>[virtualprotected]</code></h3>
<p>Scrolls the table such that <em>y</em> becomes the top pixel in the view.
The <em>y</em> parameter is in <em>table</em> coordinates.
<p>The interaction with <a href="#114e3a">Tbl_snapToVGrid</a> is tricky.
<p>See also <a href="#b27182">yOffset</a>(), <a href="#26b6d5">setXOffset</a>(), <a href="#d54803">setOffset</a>() and <a href="#d9d86b">setTopCell</a>().
<h3 class="fn">void<a name="8389b8"></a>QTableView::setupPainter(<a href="qpainter.html">QPainter</a>*) <code>[virtualprotected]</code></h3>
<p>This virtual function is called before painting of table cells
is started. It can be reimplemented by subclasses that want to
to set up the painter in a special way and that do not want to
do so for each cell.
<h3 class="fn">void<a name="9789c1"></a>QTableView::show() <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#200ee5">QWidget.</a>
<h3 class="fn">uint<a name="92ddc5"></a>QTableView::tableFlags()const <code>[protected]</code></h3>
<p>Returns the union of the table flags that are currently set.
<p>See also <a href="#114e3a">setTableFlags</a>(), <a href="#44983d">clearTableFlags</a>() and <a href="#b22ac0">testTableFlags</a>().
<h3 class="fn">bool<a name="b22ac0"></a>QTableView::testTableFlags(uintf)const <code>[protected]</code></h3>
<p>Returns TRUE if any of the table flags in <em>f</em> are currently set,
otherwise FALSE.
<p>See also <a href="#114e3a">setTableFlags</a>(), <a href="#44983d">clearTableFlags</a>() and <a href="#92ddc5">tableFlags</a>().
<h3 class="fn">int<a name="67ccdf"></a>QTableView::topCell()const <code>[protected]</code></h3>
<p>Returns the index of the first row in the table that is visible in
the view. The index of the very first row is 0.
<p>See also <a href="#6a73cd">leftCell</a>() and <a href="#d9d86b">setTopCell</a>().
<h3 class="fn">int<a name="f5648d"></a>QTableView::totalHeight() <code>[virtualprotected]</code></h3>
<p>Returns the total height of the table in pixels.
<p>This function is virtual and should be reimplemented by subclasses that
have variable cell heights and a non-trivial <a href="#5ee1fb">cellHeight</a>() function, or a
large number of rows in the table.
<p>The default implementation may be slow for very tall tables.
<p>See also <a href="#5ee1fb">cellHeight</a>() and <a href="#6889ff">totalWidth</a>().
<h3 class="fn">int<a name="6889ff"></a>QTableView::totalWidth() <code>[virtualprotected]</code></h3>
<p>Returns the total width of the table in pixels.
<p>This function is virtual and should be reimplemented by subclasses that
have variable cell widths and a non-trivial <a href="#2503ca">cellWidth</a>() function, or a
large number of columns in the table.
<p>The default implementation may be slow for very wide tables.
<p>See also <a href="#2503ca">cellWidth</a>() and <a href="#f5648d">totalHeight</a>().
<h3 class="fn">void<a name="8be89f"></a>QTableView::updateCell(introw, intcol, boolerase=TRUE) <code>[protected]</code></h3>
<p>Repaints the cell at row <em>row,</em> column <em>col</em> if it is inside the view.
<p>If <em>erase</em> is TRUE, the relevant part of the view is cleared to the
background color/pixmap before the contents are repainted.
<p>See also <a href="qwidget.html#4d2aa7">isVisible</a>().
<h3 class="fn">void<a name="70d596"></a>QTableView::updateScrollBars() <code>[protected]</code></h3>
<p>Updates the scroll bars' contents and presence to match the table's
state. Generally you should not need to call this.
<p>See also <a href="#114e3a">setTableFlags</a>().
<h3 class="fn">void<a name="c208d7"></a>QTableView::updateTableSize() <code>[protected]</code></h3>
<p>Updates the scroll bars and internal state.
<p>Call this function when the table view's total size is changed;
typically because the result of <a href="#5ee1fb">cellHeight</a>() or <a href="#2503ca">cellWidth</a>() have changed.
<p>This function does not repaint the widget.
<h3 class="fn"><a href="qscrollbar.html">QScrollBar</a>*<a name="604b25"></a>QTableView::verticalScrollBar()const <code>[protected]</code></h3>
<p>Returns a pointer to the vertical scroll bar, mainly so you can
<a href="qobject.html#7f8e37">connect</a>() to its signals. Note that the scroll bar works in pixel
values, use <a href="#e2a9d6">findRow</a>() to translate to cell numbers.
<h3 class="fn">int<a name="8301e1"></a>QTableView::viewHeight()const <code>[protected]</code></h3>
<p>Returns the height of the table view, as such, in <em>view</em>
coordinates. This does not include any header, scroll bar or frame,
but does include background pixels below the table data.
<p>See also <a href="#236bb5">minViewY</a>(), <a href="#557ad1">maxViewY</a>(), <a href="#a61761">viewWidth</a>(), <a href="qframe.html#f558c2">contentsRect</a>() and <a href="#cb656a">viewRect</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="cb656a"></a>QTableView::viewRect()const <code>[protected]</code></h3>
<p>Returns the rectangle which is the actual table, excluding any
frame, in <em>widget</em> coordinates.
<h3 class="fn">int<a name="a61761"></a>QTableView::viewWidth()const <code>[protected]</code></h3>
<p>Returns the width of the table view, as such, in <em>view</em>
coordinates. This does not include any header, scroll bar or frame,
but does include background pixels to the right of the table data.
<p>See also <a href="#b673d1">minViewX</a>(), <a href="#817e8d">maxViewX</a>(), <a href="#8301e1">viewHeight</a>(), <a href="qframe.html#f558c2">contentsRect</a>() and <a href="#cb656a">viewRect</a>().
<h3 class="fn">int<a name="5eca5c"></a>QTableView::xOffset()const <code>[protected]</code></h3>
<p>Returns the x coordinate in <em>table</em> coordinates of the pixel which is
currently on the left edge of the view.
<p>See also <a href="#26b6d5">setXOffset</a>(), <a href="#b27182">yOffset</a>() and <a href="#6a73cd">leftCell</a>().
<h3 class="fn">int<a name="b27182"></a>QTableView::yOffset()const <code>[protected]</code></h3>
<p>Returns the y coordinate in <em>table</em> coordinates of the pixel which is
currently on the top edge of the view.
<p>See also <a href="#0676b2">setYOffset</a>(), <a href="#5eca5c">xOffset</a>() and <a href="#67ccdf">topCell</a>().
<h3 class="fn">void<a name="5f45f9"></a>QTableView::setBackgroundColor(const<a href="qcolor.html">QColor</a>&c) <code>[virtual]</code></h3>
<p>For internal use only.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|