You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
262 lines
14 KiB
262 lines
14 KiB
13 years ago
|
<!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>
|
||
13 years ago
|
<p><tt>#include <<a href="qgridview-h.html">ntqgridview.h</a>></tt>
|
||
|
<p>Inherits <a href="ntqscrollview.html">TQScrollView</a>.
|
||
13 years ago
|
<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).
|
||
13 years ago
|
<p> TQGridView is a very simple abstract class based on <a href="ntqscrollview.html">TQScrollView</a>. It
|
||
13 years ago
|
is designed to simplify the task of drawing many cells of the same
|
||
|
size in a potentially scrollable canvas. If you need rows and
|
||
13 years ago
|
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="ntqiconview.html">TQIconView</a> or a
|
||
|
<a href="ntqcanvas.html">TQCanvas</a>.
|
||
13 years ago
|
<p>See also <a href="abstractwidgets.html">Abstract Widget Classes</a>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
13 years ago
|
<h3 class=fn><a name="TQGridView"></a>TQGridView::TQGridView ( <a href="ntqwidget.html">TQWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a grid view.
|
||
13 years ago
|
<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.
|
||
13 years ago
|
|
||
|
<h3 class=fn><a name="~TQGridView"></a>TQGridView::~TQGridView ()
|
||
|
</h3>
|
||
|
Destroys the grid view.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="cellGeometry"></a>TQGridView::cellGeometry ( int row, int column )
|
||
13 years ago
|
</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.
|
||
13 years ago
|
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
|
||
13 years ago
|
</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
|
||
13 years ago
|
to <a href="ntqrect.html">TQRect</a>( 0, 0, <a href="#cellWidth">cellWidth</a>(), <a href="#cellHeight">cellHeight</a>() ).
|
||
13 years ago
|
<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.
|
||
13 years ago
|
See the <a href="ntqgridview.html#cellWidth-prop">"cellWidth"</a> property for details.
|
||
13 years ago
|
<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.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqsize.html">TQSize</a> <a name="gridSize"></a>TQGridView::gridSize () const
|
||
13 years ago
|
</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.
|
||
13 years ago
|
See the <a href="ntqgridview.html#numCols-prop">"numCols"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>int <a name="numRows"></a>TQGridView::numRows () const
|
||
|
</h3><p>Returns the number of rows in the grid.
|
||
13 years ago
|
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>
|
||
13 years ago
|
</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.
|
||
13 years ago
|
<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
|
||
13 years ago
|
to be painted, i.e. <em>cell</em> coordinates. Do not scale or shear
|
||
13 years ago
|
the coordinate system (or if you do, restore the <a href="ntqwmatrix.html#TransformationMode">transformation matrix</a> before you return).
|
||
13 years ago
|
<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>
|
||
|
|
||
|
|
||
13 years ago
|
<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>
|
||
13 years ago
|
</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>.
|
||
13 years ago
|
<p> <a href="#paintEmptyArea">paintEmptyArea</a>() is invoked by <a href="ntqscrollview.html#drawContents">drawContents</a>() to erase or fill
|
||
13 years ago
|
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.
|
||
13 years ago
|
<p> <p>See also <a href="ntqwidget.html#repaint">TQWidget::repaint</a>().
|
||
13 years ago
|
|
||
|
<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.
|
||
13 years ago
|
See the <a href="ntqgridview.html#cellHeight-prop">"cellHeight"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setCellWidth"></a>TQGridView::setCellWidth ( int )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets the width of a grid column.
|
||
13 years ago
|
See the <a href="ntqgridview.html#cellWidth-prop">"cellWidth"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setNumCols"></a>TQGridView::setNumCols ( int )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets the number of columns in the grid.
|
||
13 years ago
|
See the <a href="ntqgridview.html#numCols-prop">"numCols"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setNumRows"></a>TQGridView::setNumRows ( int )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets the number of rows in the grid.
|
||
13 years ago
|
See the <a href="ntqgridview.html#numRows-prop">"numRows"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="updateCell"></a>TQGridView::updateCell ( int row, int column )
|
||
|
</h3>
|
||
|
Updates cell (<em>row</em>, <em>column</em>).
|
||
13 years ago
|
<p> <p>See also <a href="ntqwidget.html#update">TQWidget::update</a>().
|
||
13 years ago
|
|
||
|
<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>
|