.BI "QRect \fBcellGeometry\fR ( int row, int column )"
.br
.ti -1c
.BI "QSize \fBgridSize\fR () const"
.br
.ti -1c
.BI "int \fBrowAt\fR ( int y ) const"
.br
.ti -1c
.BI "int \fBcolumnAt\fR ( int x ) const"
.br
.ti -1c
.BI "void \fBrepaintCell\fR ( int row, int column, bool erase = TRUE )"
.br
.ti -1c
.BI "void \fBupdateCell\fR ( int row, int column )"
.br
.ti -1c
.BI "void \fBensureCellVisible\fR ( int row, int column )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "int \fBcellHeight\fR - the height of a grid row"
.br
.ti -1c
.BI "int \fBcellWidth\fR - the width of a grid column"
.br
.ti -1c
.BI "int \fBnumCols\fR - the number of columns in the grid"
.br
.ti -1c
.BI "int \fBnumRows\fR - the number of rows in the grid"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual void \fBpaintCell\fR ( QPainter * p, int row, int col ) = 0"
.br
.ti -1c
.BI "virtual void \fBpaintEmptyArea\fR ( QPainter * p, int cx, int cy, int cw, int ch )"
.br
.ti -1c
.BI "virtual void \fBdimensionChange\fR ( int oldNumRows, int oldNumCols )"
.br
.in -1c
.SH DESCRIPTION
The QGridView class provides an abstract base for fixed-size grids.
.PP
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 numRows()-1, column numCols()-1.
.PP
You can define numRows, numCols, cellWidth and cellHeight. Reimplement the pure virtual function paintCell() to draw the contents of a cell.
.PP
With ensureCellVisible(), you can ensure a certain cell is visible. With rowAt() and columnAt() you can find a cell based on the given x- and y-coordinates.
.PP
If you need to monitor changes to the grid's dimensions (i.e. when numRows or numCols is changed), reimplement the dimensionChange() change handler.
.PP
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).
QGridView is a very simple abstract class based on QScrollView. 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 QTable instead. If you need a simple list of items, use a QListBox. If you need to present hierachical data use a QListView, and if you need random objects at random positions, consider using either a TQIconView or a TQCanvas.
The \fIparent\fR, \fIname\fR and widget flag, \fIf\fR, arguments are passed to the QScrollView constructor.
.SH "QGridView::~QGridView ()"
Destroys the grid view.
.SH "QRect QGridView::cellGeometry ( int row, int column )"
Returns the geometry of cell (\fIrow\fR, \fIcolumn\fR) in the content coordinate system.
.PP
See also cellRect().
.SH "int QGridView::cellHeight () const"
Returns the height of a grid row. See the "cellHeight" property for details.
.SH "QRect QGridView::cellRect () const"
Returns the geometry of a cell in a cell's coordinate system. This is a convenience function useful in paintCell(). It is equivalent to QRect( 0, 0, cellWidth(), cellHeight() ).
.PP
See also cellGeometry().
.SH "int QGridView::cellWidth () const"
Returns the width of a grid column. See the "cellWidth" property for details.
.SH "int QGridView::columnAt ( int x ) const"
Returns the number of the column at position \fIx\fR. \fIx\fR must be given in content coordinates.
.PP
See also rowAt().
.SH "void QGridView::dimensionChange ( int oldNumRows, int oldNumCols )\fC [virtual protected]\fR"
This change handler is called whenever any of the grid's dimensions change. \fIoldNumRows\fR and \fIoldNumCols\fR contain the old dimensions, numRows() and numCols() contain the new dimensions.
.SH "void QGridView::ensureCellVisible ( int row, int column )"
Ensures cell (\fIrow\fR, \fIcolumn\fR) is visible, scrolling the grid view if necessary.
.SH "QSize QGridView::gridSize () const"
Returns the size of the grid in pixels.
.SH "int QGridView::numCols () const"
Returns the number of columns in the grid. See the "numCols" property for details.
.SH "int QGridView::numRows () const"
Returns the number of rows in the grid. See the "numRows" property for details.
.SH "void QGridView::paintCell ( QPainter * p, int row, int col )\fC [pure virtual protected]\fR"
This pure virtual function is called to paint the single cell at (\fIrow\fR, \fIcol\fR) using painter \fIp\fR. The painter must be open when paintCell() is called and must remain open.
.PP
The coordinate system is translated so that the origin is at the top-left corner of the cell to be painted, i.e. \fIcell\fR coordinates. Do not scale or shear the coordinate system (or if you do, restore the transformation matrix before you return).
.PP
The painter is not clipped by default in order to get maximum efficiency. If you want clipping, use
.SH "void QGridView::paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int ch )\fC [virtual protected]\fR"
This function fills the \fIcw\fR pixels wide and \fIch\fR pixels high rectangle starting at position (\fIcx\fR, \fIcy\fR) with the background color using the painter \fIp\fR.
.PP
paintEmptyArea() is invoked by drawContents() to erase or fill unused areas.
.SH "void QGridView::repaintCell ( int row, int column, bool erase = TRUE )"