Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1347

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qgridview.cpp:45 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QGridView 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: #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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>QGridView Class Reference</h1>

<p>The QGridView class provides an abstract base for fixed-size
grids.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qgridview-h.html">qgridview.h</a>&gt;</tt>
<p>Inherits <a href="qscrollview.html">QScrollView</a>.
<p><a href="qgridview-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QGridView"><b>QGridView</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</div></li>
<li><div class=fn><a href="#~QGridView"><b>~QGridView</b></a> ()</div></li>
<li><div class=fn>int <a href="#numRows"><b>numRows</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setNumRows"><b>setNumRows</b></a> ( int )</div></li>
<li><div class=fn>int <a href="#numCols"><b>numCols</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setNumCols"><b>setNumCols</b></a> ( int )</div></li>
<li><div class=fn>int <a href="#cellWidth"><b>cellWidth</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setCellWidth"><b>setCellWidth</b></a> ( int )</div></li>
<li><div class=fn>int <a href="#cellHeight"><b>cellHeight</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setCellHeight"><b>setCellHeight</b></a> ( int )</div></li>
<li><div class=fn>QRect <a href="#cellRect"><b>cellRect</b></a> () const</div></li>
<li><div class=fn>QRect <a href="#cellGeometry"><b>cellGeometry</b></a> ( int&nbsp;row, int&nbsp;column )</div></li>
<li><div class=fn>QSize <a href="#gridSize"><b>gridSize</b></a> () const</div></li>
<li><div class=fn>int <a href="#rowAt"><b>rowAt</b></a> ( int&nbsp;y ) const</div></li>
<li><div class=fn>int <a href="#columnAt"><b>columnAt</b></a> ( int&nbsp;x ) const</div></li>
<li><div class=fn>void <a href="#repaintCell"><b>repaintCell</b></a> ( int&nbsp;row, int&nbsp;column, bool&nbsp;erase = TRUE )</div></li>
<li><div class=fn>void <a href="#updateCell"><b>updateCell</b></a> ( int&nbsp;row, int&nbsp;column )</div></li>
<li><div class=fn>void <a href="#ensureCellVisible"><b>ensureCellVisible</b></a> ( int&nbsp;row, int&nbsp;column )</div></li>
</ul>
<h2>Properties</h2>
<ul>
<li><div class=fn>int <a href="#cellHeight-prop"><b>cellHeight</b></a>&nbsp;- the height of a grid row</div></li>
<li><div class=fn>int <a href="#cellWidth-prop"><b>cellWidth</b></a>&nbsp;- the width of a grid column</div></li>
<li><div class=fn>int <a href="#numCols-prop"><b>numCols</b></a>&nbsp;- the number of columns in the grid</div></li>
<li><div class=fn>int <a href="#numRows-prop"><b>numRows</b></a>&nbsp;- the number of rows in the grid</div></li>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;row, int&nbsp;col ) = 0</div></li>
<li><div class=fn>virtual void <a href="#paintEmptyArea"><b>paintEmptyArea</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;cx, int&nbsp;cy, int&nbsp;cw, int&nbsp;ch )</div></li>
<li><div class=fn>virtual void <a href="#dimensionChange"><b>dimensionChange</b></a> ( int&nbsp;oldNumRows, int&nbsp;oldNumCols )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QGridView 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 content 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, 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> QGridView is a very simple abstract class based on <a href="qscrollview.html">QScrollView</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 in different sizes, use a <a href="qtable.html">QTable</a> instead. If you need a
simple list of items, use a <a href="qlistbox.html">QListBox</a>. If you need to present
hierachical data use a <a href="qlistview.html">QListView</a>, and if you need random objects at
random positions, consider using either a <a href="qiconview.html">QIconView</a> or a <a href="qcanvas.html">QCanvas</a>.
<p> <p>See also <a href="abstractwidgets.html">Abstract Widget Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QGridView"></a>QGridView::QGridView ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
</h3>
Constructs a grid view.
<p> The <em>parent</em>, <em>name</em> and widget flag, <em>f</em>, arguments are passed to the
<a href="qscrollview.html">QScrollView</a> constructor.

<h3 class=fn><a name="~QGridView"></a>QGridView::~QGridView ()
</h3>
Destroys the grid view.

<h3 class=fn><a href="qrect.html">QRect</a> <a name="cellGeometry"></a>QGridView::cellGeometry ( int&nbsp;row, int&nbsp;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>QGridView::cellHeight () const
</h3><p>Returns the height of a grid row.
See the <a href="qgridview.html#cellHeight-prop">"cellHeight"</a> property for details.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="cellRect"></a>QGridView::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="qrect.html">QRect</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>QGridView::cellWidth () const
</h3><p>Returns the width of a grid column.
See the <a href="qgridview.html#cellWidth-prop">"cellWidth"</a> property for details.
<h3 class=fn>int <a name="columnAt"></a>QGridView::columnAt ( int&nbsp;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>QGridView::dimensionChange ( int&nbsp;oldNumRows, int&nbsp;oldNumCols )<tt> [virtual protected]</tt>
</h3> 
<p> This change handler is called whenever any of the grid's dimensions
changes. <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>QGridView::ensureCellVisible ( int&nbsp;row, int&nbsp;column )
</h3>
Ensure cell (<em>row</em>, <em>column</em>) is visible, scrolling the grid view
if necessary.

<h3 class=fn><a href="qsize.html">QSize</a> <a name="gridSize"></a>QGridView::gridSize () const
</h3>
<p> Returns the size of the grid in pixels.
<p> 
<h3 class=fn>int <a name="numCols"></a>QGridView::numCols () const
</h3><p>Returns the number of columns in the grid.
See the <a href="qgridview.html#numCols-prop">"numCols"</a> property for details.
<h3 class=fn>int <a name="numRows"></a>QGridView::numRows () const
</h3><p>Returns the number of rows in the grid.
See the <a href="qgridview.html#numRows-prop">"numRows"</a> property for details.
<h3 class=fn>void <a name="paintCell"></a>QGridView::paintCell ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;row, int&nbsp;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="qpainter.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 transformation matrix 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-&gt;setClipRect( <a href="#cellRect">cellRect</a>(), QPainter::CoordPainter );
    //... your drawing code
    p-&gt;setClipping( FALSE );

 </pre>
 
<p> 
<h3 class=fn>void <a name="paintEmptyArea"></a>QGridView::paintEmptyArea ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;cx, int&nbsp;cy, int&nbsp;cw, int&nbsp;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="qscrollview.html#drawContents">drawContents</a>() to erase
or fill unused areas.

<h3 class=fn>void <a name="repaintCell"></a>QGridView::repaintCell ( int&nbsp;row, int&nbsp;column, bool&nbsp;erase = TRUE )
</h3>  Repaints cell (<em>row</em>, <em>column</em>).
<p> If <em>erase</em> is TRUE, Qt 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="qwidget.html#repaint">QWidget::repaint</a>().

<h3 class=fn>int <a name="rowAt"></a>QGridView::rowAt ( int&nbsp;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>QGridView::setCellHeight ( int )<tt> [virtual]</tt>
</h3><p>Sets the height of a grid row.
See the <a href="qgridview.html#cellHeight-prop">"cellHeight"</a> property for details.
<h3 class=fn>void <a name="setCellWidth"></a>QGridView::setCellWidth ( int )<tt> [virtual]</tt>
</h3><p>Sets the width of a grid column.
See the <a href="qgridview.html#cellWidth-prop">"cellWidth"</a> property for details.
<h3 class=fn>void <a name="setNumCols"></a>QGridView::setNumCols ( int )<tt> [virtual]</tt>
</h3><p>Sets the number of columns in the grid.
See the <a href="qgridview.html#numCols-prop">"numCols"</a> property for details.
<h3 class=fn>void <a name="setNumRows"></a>QGridView::setNumRows ( int )<tt> [virtual]</tt>
</h3><p>Sets the number of rows in the grid.
See the <a href="qgridview.html#numRows-prop">"numRows"</a> property for details.
<h3 class=fn>void <a name="updateCell"></a>QGridView::updateCell ( int&nbsp;row, int&nbsp;column )
</h3>  Updates cell (<em>row</em>, <em>column</em>).
<p> <p>See also <a href="qwidget.html#update">QWidget::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">Qt toolkit</a>.
Copyright &copy; 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 &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>