1QGridView(3qt)                                                  QGridView(3qt)
2
3
4

NAME

6       QGridView - Abstract base for fixed-size grids
7

SYNOPSIS

9       #include <qgridview.h>
10
11       Inherits QScrollView.
12
13   Public Members
14       QGridView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
15       ~QGridView ()
16       int numRows () const
17       virtual void setNumRows ( int )
18       int numCols () const
19       virtual void setNumCols ( int )
20       int cellWidth () const
21       virtual void setCellWidth ( int )
22       int cellHeight () const
23       virtual void setCellHeight ( int )
24       QRect cellRect () const
25       QRect cellGeometry ( int row, int column )
26       QSize gridSize () const
27       int rowAt ( int y ) const
28       int columnAt ( int x ) const
29       void repaintCell ( int row, int column, bool erase = TRUE )
30       void updateCell ( int row, int column )
31       void ensureCellVisible ( int row, int column )
32
33   Properties
34       int cellHeight - the height of a grid row
35       int cellWidth - the width of a grid column
36       int numCols - the number of columns in the grid
37       int numRows - the number of rows in the grid
38
39   Protected Members
40       virtual void paintCell ( QPainter * p, int row, int col ) = 0
41       virtual void paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int
42           ch )
43       virtual void dimensionChange ( int oldNumRows, int oldNumCols )
44

DESCRIPTION

46       The QGridView class provides an abstract base for fixed-size grids.
47
48       A grid view consists of a number of abstract cells organized in rows
49       and columns. The cells have a fixed size and are identified with a row
50       index and a column index. The top-left cell is in row 0, column 0. The
51       bottom-right cell is in row numRows()-1, column numCols()-1.
52
53       You can define numRows, numCols, cellWidth and cellHeight. Reimplement
54       the pure virtual function paintCell() to draw the contents of a cell.
55
56       With ensureCellVisible(), you can ensure a certain cell is visible.
57       With rowAt() and columnAt() you can find a cell based on the given x-
58       and y-coordinates.
59
60       If you need to monitor changes to the grid's dimensions (i.e. when
61       numRows or numCols is changed), reimplement the dimensionChange()
62       change handler.
63
64       Note: the row and column indices are always given in the order, row
65       (vertical offset) then column (horizontal offset). This order is the
66       opposite of all pixel operations, which are given in the order x
67       (horizontal offset), y (vertical offset).
68
69       QGridView is a very simple abstract class based on QScrollView. It is
70       designed to simplify the task of drawing many cells of the same size in
71       a potentially scrollable canvas. If you need rows and columns with
72       different sizes, use a QTable instead. If you need a simple list of
73       items, use a QListBox. If you need to present hierachical data use a
74       QListView, and if you need random objects at random positions, consider
75       using either a QIconView or a QCanvas.
76
77       See also Abstract Widget Classes.
78

MEMBER FUNCTION DOCUMENTATION

QGridView::QGridView ( QWidget * parent = 0, const char * name = 0, WFlags f =

81       0 )
82       Constructs a grid view.
83
84       The parent, name and widget flag, f, arguments are passed to the
85       QScrollView constructor.
86

QGridView::~QGridView ()

88       Destroys the grid view.
89

QRect QGridView::cellGeometry ( int row, int column )

91       Returns the geometry of cell (row, column) in the content coordinate
92       system.
93
94       See also cellRect().
95

int QGridView::cellHeight () const

97       Returns the height of a grid row. See the "cellHeight" property for
98       details.
99

QRect QGridView::cellRect () const

101       Returns the geometry of a cell in a cell's coordinate system. This is a
102       convenience function useful in paintCell(). It is equivalent to QRect(
103       0, 0, cellWidth(), cellHeight() ).
104
105       See also cellGeometry().
106

int QGridView::cellWidth () const

108       Returns the width of a grid column. See the "cellWidth" property for
109       details.
110

int QGridView::columnAt ( int x ) const

112       Returns the number of the column at position x. x must be given in
113       content coordinates.
114
115       See also rowAt().
116

void QGridView::dimensionChange ( int oldNumRows, int oldNumCols ) [virtual

118       protected]
119       This change handler is called whenever any of the grid's dimensions
120       change. oldNumRows and oldNumCols contain the old dimensions, numRows()
121       and numCols() contain the new dimensions.
122

void QGridView::ensureCellVisible ( int row, int column )

124       Ensures cell (row, column) is visible, scrolling the grid view if
125       necessary.
126

QSize QGridView::gridSize () const

128       Returns the size of the grid in pixels.
129

int QGridView::numCols () const

131       Returns the number of columns in the grid. See the "numCols" property
132       for details.
133

int QGridView::numRows () const

135       Returns the number of rows in the grid. See the "numRows" property for
136       details.
137

void QGridView::paintCell ( QPainter * p, int row, int col ) [pure virtual

139       protected]
140       This pure virtual function is called to paint the single cell at (row,
141       col) using painter p. The painter must be open when paintCell() is
142       called and must remain open.
143
144       The coordinate system is translated so that the origin is at the top-
145       left corner of the cell to be painted, i.e. cell coordinates. Do not
146       scale or shear the coordinate system (or if you do, restore the
147       transformation matrix before you return).
148
149       The painter is not clipped by default in order to get maximum
150       efficiency. If you want clipping, use
151
152           p->setClipRect( cellRect(), QPainter::CoordPainter );
153           //... your drawing code
154           p->setClipping( FALSE );
155

void QGridView::paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int ch

157       ) [virtual protected]
158       This function fills the cw pixels wide and ch pixels high rectangle
159       starting at position (cx, cy) with the background color using the
160       painter p.
161
162       paintEmptyArea() is invoked by drawContents() to erase or fill unused
163       areas.
164

void QGridView::repaintCell ( int row, int column, bool erase = TRUE )

166       Repaints cell (row, column).
167
168       If erase is TRUE, Qt erases the area of the cell before the paintCell()
169       call; otherwise no erasing takes place.
170
171       See also QWidget::repaint().
172

int QGridView::rowAt ( int y ) const

174       Returns the number of the row at position y. y must be given in content
175       coordinates.
176
177       See also columnAt().
178

void QGridView::setCellHeight ( int ) [virtual]

180       Sets the height of a grid row. See the "cellHeight" property for
181       details.
182

void QGridView::setCellWidth ( int ) [virtual]

184       Sets the width of a grid column. See the "cellWidth" property for
185       details.
186

void QGridView::setNumCols ( int ) [virtual]

188       Sets the number of columns in the grid. See the "numCols" property for
189       details.
190

void QGridView::setNumRows ( int ) [virtual]

192       Sets the number of rows in the grid. See the "numRows" property for
193       details.
194

void QGridView::updateCell ( int row, int column )

196       Updates cell (row, column).
197
198       See also QWidget::update().
199
200   Property Documentation

int cellHeight

202       This property holds the height of a grid row.
203
204       All rows in a grid view have the same height.
205
206       See also cellWidth.
207
208       Set this property's value with setCellHeight() and get this property's
209       value with cellHeight().
210

int cellWidth

212       This property holds the width of a grid column.
213
214       All columns in a grid view have the same width.
215
216       See also cellHeight.
217
218       Set this property's value with setCellWidth() and get this property's
219       value with cellWidth().
220

int numCols

222       This property holds the number of columns in the grid.
223
224       Set this property's value with setNumCols() and get this property's
225       value with numCols().
226
227       See also numRows.
228

int numRows

230       This property holds the number of rows in the grid.
231
232       Set this property's value with setNumRows() and get this property's
233       value with numRows().
234
235       See also numCols.
236
237

SEE ALSO

239       http://doc.trolltech.com/qgridview.html
240       http://www.trolltech.com/faq/tech.html
241
243       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
244       license file included in the distribution for a complete license
245       statement.
246

AUTHOR

248       Generated automatically from the source code.
249

BUGS

251       If you find a bug in Qt, please report it as described in
252       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
253       help you. Thank you.
254
255       The definitive Qt documentation is provided in HTML format; it is
256       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
257       web browser. This man page is provided as a convenience for those users
258       who prefer man pages, although this format is not officially supported
259       by Trolltech.
260
261       If you find errors in this manual page, please report them to qt-
262       bugs@trolltech.com.  Please include the name of the manual page
263       (qgridview.3qt) and the Qt version (3.3.8).
264
265
266
267Trolltech AS                    2 February 2007                 QGridView(3qt)
Impressum