1QTable(3qt)                                                        QTable(3qt)
2
3
4

NAME

6       QTable - Flexible editable table widget
7

SYNOPSIS

9       #include <qtable.h>
10
11       Inherits QScrollView.
12
13       Inherited by QDataTable.
14
15   Public Members
16       QTable ( QWidget * parent = 0, const char * name = 0 )
17       QTable ( int numRows, int numCols, QWidget * parent = 0, const char *
18           name = 0 )
19       ~QTable ()
20       QHeader * horizontalHeader () const
21       QHeader * verticalHeader () const
22       enum SelectionMode { Single, Multi, SingleRow, MultiRow, NoSelection }
23       virtual void setSelectionMode ( SelectionMode mode )
24       SelectionMode selectionMode () const
25       virtual void setItem ( int row, int col, QTableItem * item )
26       virtual void setText ( int row, int col, const QString & text )
27       virtual void setPixmap ( int row, int col, const QPixmap & pix )
28       virtual QTableItem * item ( int row, int col ) const
29       virtual QString text ( int row, int col ) const
30       virtual QPixmap pixmap ( int row, int col ) const
31       virtual void clearCell ( int row, int col )
32       virtual QRect cellGeometry ( int row, int col ) const
33       virtual int columnWidth ( int col ) const
34       virtual int rowHeight ( int row ) const
35       virtual int columnPos ( int col ) const
36       virtual int rowPos ( int row ) const
37       virtual int columnAt ( int x ) const
38       virtual int rowAt ( int y ) const
39       virtual int numRows () const
40       virtual int numCols () const
41       void updateCell ( int row, int col )
42       int currentRow () const
43       int currentColumn () const
44       void ensureCellVisible ( int row, int col )
45       bool isSelected ( int row, int col ) const
46       bool isRowSelected ( int row, bool full = FALSE ) const
47       bool isColumnSelected ( int col, bool full = FALSE ) const
48       int numSelections () const
49       QTableSelection selection ( int num ) const
50       virtual int addSelection ( const QTableSelection & s )
51       virtual void removeSelection ( const QTableSelection & s )
52       virtual void removeSelection ( int num )
53       virtual int currentSelection () const
54       void selectCells ( int start_row, int start_col, int end_row, int
55           end_col )
56       void selectRow ( int row )
57       void selectColumn ( int col )
58       bool showGrid () const
59       bool columnMovingEnabled () const
60       bool rowMovingEnabled () const
61       virtual void sortColumn ( int col, bool ascending = TRUE, bool
62           wholeRows = FALSE )
63       bool sorting () const
64       virtual void takeItem ( QTableItem * i )
65       virtual void setCellWidget ( int row, int col, QWidget * e )
66       virtual QWidget * cellWidget ( int row, int col ) const
67       virtual void clearCellWidget ( int row, int col )
68       virtual QRect cellRect ( int row, int col ) const
69       virtual void paintCell ( QPainter * p, int row, int col, const QRect &
70           cr, bool selected )
71       virtual void paintCell ( QPainter * p, int row, int col, const QRect &
72           cr, bool selected, const QColorGroup & cg )
73       virtual void paintFocus ( QPainter * p, const QRect & cr )
74       bool isReadOnly () const
75       bool isRowReadOnly ( int row ) const
76       bool isColumnReadOnly ( int col ) const
77       void repaintSelections ()
78       enum FocusStyle { FollowStyle, SpreadSheet }
79       virtual void setFocusStyle ( FocusStyle fs )
80       FocusStyle focusStyle () const
81       void updateHeaderStates ()
82
83   Public Slots
84       virtual void setNumRows ( int r )
85       virtual void setNumCols ( int r )
86       virtual void setShowGrid ( bool b )
87       virtual void hideRow ( int row )
88       virtual void hideColumn ( int col )
89       virtual void showRow ( int row )
90       virtual void showColumn ( int col )
91       bool isRowHidden ( int row ) const
92       bool isColumnHidden ( int col ) const
93       virtual void setColumnWidth ( int col, int w )
94       virtual void setRowHeight ( int row, int h )
95       virtual void adjustColumn ( int col )
96       virtual void adjustRow ( int row )
97       virtual void setColumnStretchable ( int col, bool stretch )
98       virtual void setRowStretchable ( int row, bool stretch )
99       bool isColumnStretchable ( int col ) const
100       bool isRowStretchable ( int row ) const
101       virtual void setSorting ( bool b )
102       virtual void swapRows ( int row1, int row2, bool swapHeader = FALSE )
103       virtual void swapColumns ( int col1, int col2, bool swapHeader = FALSE
104           )
105       virtual void swapCells ( int row1, int col1, int row2, int col2 )
106       virtual void setLeftMargin ( int m )
107       virtual void setTopMargin ( int m )
108       virtual void setCurrentCell ( int row, int col )
109       void clearSelection ( bool repaint = TRUE )
110       virtual void setColumnMovingEnabled ( bool b )
111       virtual void setRowMovingEnabled ( bool b )
112       virtual void setReadOnly ( bool b )
113       virtual void setRowReadOnly ( int row, bool ro )
114       virtual void setColumnReadOnly ( int col, bool ro )
115       virtual void setDragEnabled ( bool b )
116       bool dragEnabled () const
117       virtual void insertRows ( int row, int count = 1 )
118       virtual void insertColumns ( int col, int count = 1 )
119       virtual void removeRow ( int row )
120       virtual void removeRows ( const QMemArray<int> & rows )
121       virtual void removeColumn ( int col )
122       virtual void removeColumns ( const QMemArray<int> & cols )
123       virtual void editCell ( int row, int col, bool replace = FALSE )
124       void setRowLabels ( const QStringList & labels )
125       void setColumnLabels ( const QStringList & labels )
126
127   Signals
128       void currentChanged ( int row, int col )
129       void clicked ( int row, int col, int button, const QPoint & mousePos )
130       void doubleClicked ( int row, int col, int button, const QPoint &
131           mousePos )
132       void pressed ( int row, int col, int button, const QPoint & mousePos )
133       void selectionChanged ()
134       void valueChanged ( int row, int col )
135       void contextMenuRequested ( int row, int col, const QPoint & pos )
136       void dropped ( QDropEvent * e )
137
138   Properties
139       bool columnMovingEnabled - whether columns can be moved by the user
140       FocusStyle focusStyle - how the current (focus) cell is drawn
141       int numCols - the number of columns in the table
142       int numRows - the number of rows in the table
143       int numSelections - the number of selections  (read only)
144       bool readOnly - whether the table is read-only
145       bool rowMovingEnabled - whether rows can be moved by the user
146       SelectionMode selectionMode - the current selection mode
147       bool showGrid - whether the table's grid is displayed
148       bool sorting - whether a click on the header of a column sorts that
149           column
150
151   Protected Members
152       enum EditMode { NotEditing, Editing, Replacing }
153       virtual void drawContents ( QPainter * p, int cx, int cy, int cw, int
154           ch )
155       void setEditMode ( EditMode mode, int row, int col )
156       virtual void contentsDragEnterEvent ( QDragEnterEvent * e )
157       virtual void contentsDragMoveEvent ( QDragMoveEvent * e )
158       virtual void contentsDragLeaveEvent ( QDragLeaveEvent * e )
159       virtual void contentsDropEvent ( QDropEvent * e )
160       virtual QDragObject * dragObject ()
161       virtual void startDrag ()
162       virtual void paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int
163           ch )
164       virtual void activateNextCell ()
165       virtual QWidget * createEditor ( int row, int col, bool initFromCell )
166           const
167       virtual void setCellContentFromEditor ( int row, int col )
168       virtual QWidget * beginEdit ( int row, int col, bool replace )
169       virtual void endEdit ( int row, int col, bool accept, bool replace )
170       virtual void resizeData ( int len )
171       virtual void insertWidget ( int row, int col, QWidget * w )
172       int indexOf ( int row, int col ) const
173       bool isEditing () const
174       EditMode editMode () const
175       int currEditRow () const
176       int currEditCol () const
177
178   Protected Slots
179       virtual void columnWidthChanged ( int col )
180       virtual void rowHeightChanged ( int row )
181       virtual void columnIndexChanged ( int section, int fromIndex, int
182           toIndex )
183       virtual void rowIndexChanged ( int section, int fromIndex, int toIndex
184           )
185       virtual void columnClicked ( int col )
186

DESCRIPTION

188       The QTable class provides a flexible editable table widget.
189
190       QTable is easy to use, although it does have a large API because of the
191       comprehensive functionality that it provides. QTable includes functions
192       for manipulating headers, rows and columns, cells and selections.
193       QTable also provides in-place editing and drag and drop, as well as a
194       useful set of signals. QTable efficiently supports very large tables,
195       for example, tables one million by one million cells are perfectly
196       possible. QTable is economical with memory, using none for unused
197       cells.
198
199           QTable *table = new QTable( 100, 250, this );
200           table->setPixmap( 3, 2, pix );
201           table->setText( 3, 2, "A pixmap" );
202
203       The first line constructs the table specifying its size in rows and
204       columns. We then insert a pixmap and some text into the same cell, with
205       the pixmap appearing to the left of the text. QTable cells can be
206       populated with QTableItems, QComboTableItems or by QCheckTableItems. By
207       default a vertical header appears at the left of the table showing row
208       numbers and a horizontal header appears at the top of the table showing
209       column numbers. (The numbers displayed start at 1, although row and
210       column numbers within QTable begin at 0.)
211
212       If you want to use mouse tracking call setMouseTracking( TRUE ) on the
213       viewport; (see QScrollView).
214
215       <center>
216                                   [Image Omitted]
217
218       </center>
219

Headers

221       QTable supports a header column, e.g. to display row numbers, and a
222       header row, e.g to display column titles. To set row or column labels
223       use QHeader::setLabel() on the pointers returned by verticalHeader()
224       and horizontalHeader() respectively. The vertical header is displayed
225       within the table's left margin whose width is set with setLeftMargin().
226       The horizontal header is displayed within the table's top margin whose
227       height is set with setTopMargin(). The table's grid can be switched off
228       with setShowGrid(). If you want to hide a horizontal header call
229       hide(), and call setTopMargin( 0 ) so that the area the header would
230       have occupied is reduced to zero size.
231
232       Header labels are indexed via their section numbers. Note that the
233       default behavior of QHeader regarding section numbers is overriden for
234       QTable. See the explanation below in the Rows and Columns section in
235       the discussion of moving columns and rows.
236

Rows and Columns

238       Row and column sizes are set with setRowHeight() and setColumnWidth().
239       If you want a row high enough to show the tallest item in its entirety,
240       use adjustRow(). Similarly, to make a column wide enough to show the
241       widest item use adjustColumn(). If you want the row height and column
242       width to adjust automatically as the height and width of the table
243       changes use setRowStretchable() and setColumnStretchable().
244
245       Rows and columns can be hidden and shown with hideRow(), hideColumn(),
246       showRow() and showColumn(). New rows and columns are inserted using
247       insertRows() and insertColumns(). Additional rows and columns are added
248       at the bottom (rows) or right (columns) if you set setNumRows() or
249       setNumCols() to be larger than numRows() or numCols(). Existing rows
250       and columns are removed with removeRow() and removeColumn(). Multiple
251       rows and columns can be removed with removeRows() and removeColumns().
252
253       Rows and columns can be set to be moveable using rowMovingEnabled() and
254       columnMovingEnabled(). The user can drag them to reorder them holding
255       down the Ctrl key and dragging the mouse. For performance reasons, the
256       default behavior of QHeader section numbers is overridden by QTable.
257       Currently in QTable, when a row or column is dragged and reordered, the
258       section number is also changed to its new position. Therefore, there is
259       no difference between the section and the index fields in QHeader. The
260       QTable QHeader classes do not provide a mechanism for indexing
261       independently of the user interface ordering.
262
263       The table can be sorted using sortColumn(). Users can sort a column by
264       clicking its header if setSorting() is set to TRUE. Rows can be swapped
265       with swapRows(), columns with swapColumns() and cells with swapCells().
266
267       For editable tables (see setReadOnly()) you can set the read-only
268       property of individual rows and columns with setRowReadOnly() and
269       setColumnReadOnly(). (Whether a cell is editable or read-only depends
270       on these settings and the cell's QTableItem::EditType.)
271
272       The row and column which have the focus are returned by currentRow()
273       and currentColumn() respectively.
274
275       Although many QTable functions operate in terms of rows and columns the
276       indexOf() function returns a single integer identifying a particular
277       cell.
278

Cells

280       All of a QTable's cells are empty when the table is constructed.
281
282       There are two approaches to populating the table's cells. The first and
283       simplest approach is to use QTableItems or QTableItem subclasses. The
284       second approach doesn't use QTableItems at all which is useful for very
285       large sparse tables but requires you to reimplement a number of
286       functions. We'll look at each approach in turn.
287
288       To put a string in a cell use setText(). This function will create a
289       new QTableItem for the cell if one doesn't already exist, and displays
290       the text in it. By default the table item's widget will be a QLineEdit.
291       A pixmap may be put in a cell with setPixmap(), which also creates a
292       table item if required. A cell may contain both a pixmap and text; the
293       pixmap is displayed to the left of the text. Another approach is to
294       construct a QTableItem or QTableItem subclass, set its properties, then
295       insert it into a cell with setItem().
296
297       If you want cells which contain comboboxes use the QComboTableItem
298       class. Similarly if you require cells containing checkboxes use the
299       QCheckTableItem class. These table items look and behave just like the
300       combobox or checkbox widgets but consume far less memory.
301
302               for ( int j = 0; j < numRows; ++j )
303                   table.setItem( j, 1, new QCheckTableItem( &table, "Check me" ) );
304       In the example above we create a column of QCheckTableItems and insert
305       them into the table using setItem().
306
307       QTable takes ownership of its QTableItems and will delete them when the
308       table itself is destroyed. You can take ownership of a table item using
309       takeItem() which you use to move a cell's contents from one cell to
310       another, either within the same table, or from one table to another.
311       (See also, swapCells()).
312
313       In-place editing of the text in QTableItems, and the values in
314       QComboTableItems and QCheckTableItems works automatically. Cells may be
315       editable or read-only, see QTableItem::EditType. If you want fine
316       control over editing see beginEdit() and endEdit().
317
318       The contents of a cell can be retrieved as a QTableItem using item(),
319       or as a string with text() or as a pixmap (if there is one) with
320       pixmap(). A cell's bounding rectangle is given by cellGeometry(). Use
321       updateCell() to repaint a cell, for example to clear away a cell's
322       visual representation after it has been deleted with clearCell(). The
323       table can be forced to scroll to show a particular cell with
324       ensureCellVisible(). The isSelected() function indicates if a cell is
325       selected.
326
327       It is possible to use your own widget as a cell's widget using
328       setCellWidget(), but subclassing QTableItem might be a simpler
329       approach. The cell's widget (if there is one) can be removed with
330       clearCellWidget().
331
332       <h4> Large tables </h4>
333
334       For large, sparse, tables using QTableItems or other widgets is
335       inefficient. The solution is to draw the cell as it should appear and
336       to create and destroy cell editors on demand.
337
338       This approach requires that you reimplement various functions.
339       Reimplement paintCell() to display your data, and createEditor() and
340       setCellContentFromEditor() to support in-place editing. It is very
341       important to reimplement resizeData() to have no functionality, to
342       prevent QTable from attempting to create a huge array. You will also
343       need to reimplement item(), setItem(), takeItem(), clearCell(), and
344       insertWidget(), cellWidget() and clearCellWidget(). In almost every
345       circumstance (for sorting, removing and inserting columns and rows,
346       etc.), you also need to reimplement swapRows(), swapCells() and
347       swapColumns(), including header handling.
348
349       If you represent active cells with a dictionary of QTableItems and
350       QWidgets, i.e. only store references to cells that are actually used,
351       many of the functions can be implemented with a single line of code.
352       (See the table/bigtable/main.cpp example.)
353
354       For more information on cells see the QTableItem documenation.
355

Selections

357       QTable's support single selection, multi-selection (multiple cells) or
358       no selection. The selection mode is set with setSelectionMode(). Use
359       isSelected() to determine if a particular cell is selected, and
360       isRowSelected() and isColumnSelected() to see if a row or column is
361       selected.
362
363       QTable's support many simultaneous selections. You can programmatically
364       select cells with addSelection(). The number of selections is given by
365       numSelections(). The current selection is returned by
366       currentSelection(). You can remove a selection with removeSelection()
367       and remove all selections with clearSelection(). Selections are
368       QTableSelection objects.
369
370       To easily add a new selection use selectCells(), selectRow() or
371       selectColumn().
372
373       Alternatively, use addSelection() to add new selections using
374       QTableSelection objects. The advantage of using QTableSelection objects
375       is that you can call QTableSelection::expandTo() to resize the
376       selection and can query and compare them.
377
378       The number of selections is given by numSelections(). The current
379       selection is returned by currentSelection(). You can remove a selection
380       with removeSelection() and remove all selections with clearSelection().
381

Signals

383       When the user clicks a cell the currentChanged() signal is emitted. You
384       can also connect to the lower level clicked(), doubleClicked() and
385       pressed() signals. If the user changes the selection the
386       selectionChanged() signal is emitted; similarly if the user changes a
387       cell's value the valueChanged() signal is emitted. If the user right-
388       clicks (or presses the appropriate platform-specific key sequence) the
389       contextMenuRequested() signal is emitted. If the user drops a drag and
390       drop object the dropped() signal is emitted with the drop event.
391
392       See also Advanced Widgets.
393
394   Member Type Documentation

QTable::EditMode

396       QTable::NotEditing - No cell is currently being edited.
397
398       QTable::Editing - A cell is currently being edited. The editor was
399       initialised with the cell's contents.
400
401       QTable::Replacing - A cell is currently being edited. The editor was
402       not initialised with the cell's contents.
403

QTable::FocusStyle

405       Specifies how the current cell (focus cell) is drawn.
406
407       QTable::FollowStyle - The current cell is drawn according to the
408       current style and the cell's background is also drawn selected, if the
409       current cell is within a selection
410
411       QTable::SpreadSheet - The current cell is drawn as in a spreadsheet.
412       This means, it is signified by a black rectangle around the cell, and
413       the background of the current cell is always drawn with the widget's
414       base color - even when selected.
415

QTable::SelectionMode

417       QTable::NoSelection - No cell can be selected by the user.
418
419       QTable::Single - The user may only select a single range of cells.
420
421       QTable::Multi - The user may select multiple ranges of cells.
422
423       QTable::SingleRow - The user may select one row at once.
424
425       QTable::MultiRow - The user may select multiple rows.
426

MEMBER FUNCTION DOCUMENTATION

QTable::QTable ( QWidget * parent = 0, const char * name = 0 )

429       Creates an empty table object called name as a child of parent.
430
431       Call setNumRows() and setNumCols() to set the table size before
432       populating the table if you're using QTableItems.
433
434       See also QWidget::clearWFlags() and Qt::WidgetFlags.
435

QTable::QTable ( int numRows, int numCols, QWidget * parent = 0, const char *

437       name = 0 )
438       Constructs an empty table called name with numRows rows and numCols
439       columns. The table is a child of parent.
440
441       If you're using QTableItems to populate the table's cells, you can
442       create QTableItem, QComboTableItem and QCheckTableItem items and insert
443       them into the table using setItem(). (See the notes on large tables for
444       an alternative to using QTableItems.)
445
446       See also QWidget::clearWFlags() and Qt::WidgetFlags.
447

QTable::~QTable ()

449       Releases all the resources used by the QTable object, including all
450       QTableItems and their widgets.
451

void QTable::activateNextCell () [virtual protected]

453       This function is called to activate the next cell if in-place editing
454       was finished by pressing the Enter key.
455
456       The default behaviour is to move from top to bottom, i.e. move to the
457       cell beneath the cell being edited. Reimplement this function if you
458       want different behaviour, e.g. moving from left to right.
459

int QTable::addSelection ( const QTableSelection & s ) [virtual]

461       Adds a selection described by s to the table and returns its number or
462       -1 if the selection is invalid.
463
464       Remember to call QTableSelection::init() and
465       QTableSelection::expandTo() to make the selection valid (see also
466       QTableSelection::isActive(), or use the
467       QTableSelection(int,int,int,int) constructor).
468
469       See also numSelections, removeSelection(), and clearSelection().
470

void QTable::adjustColumn ( int col ) [virtual slot]

472       Resizes column col so that the column width is wide enough to display
473       the widest item the column contains.
474
475       See also adjustRow().
476
477       Example: regexptester/regexptester.cpp.
478
479       Reimplemented in QDataTable.
480

void QTable::adjustRow ( int row ) [virtual slot]

482       Resizes row row so that the row height is tall enough to display the
483       tallest item the row contains.
484
485       See also adjustColumn().
486

QWidget * QTable::beginEdit ( int row, int col, bool replace ) [virtual

488       protected]
489       This function is called to start in-place editing of the cell at row,
490       col. Editing is achieved by creating an editor (createEditor() is
491       called) and setting the cell's editor with setCellWidget() to the newly
492       created editor. (After editing is complete endEdit() will be called to
493       replace the cell's content with the editor's content.) If replace is
494       TRUE the editor will start empty; otherwise it will be initialized with
495       the cell's content (if any), i.e. the user will be modifying the
496       original cell content.
497
498       See also endEdit().
499

QRect QTable::cellGeometry ( int row, int col ) const [virtual]

501       Returns the bounding rectangle of the cell at row, col in content
502       coordinates.
503

QRect QTable::cellRect ( int row, int col ) const [virtual]

505       Returns the geometry of cell row, col in the cell's coordinate system.
506       This is a convenience function useful in paintCell(). It is equivalent
507       to QRect( QPoint(0,0), cellGeometry( row, col).size() );
508
509       See also cellGeometry().
510
511       Example: chart/setdataform.cpp.
512

QWidget * QTable::cellWidget ( int row, int col ) const [virtual]

514       Returns the widget that has been set for the cell at row, col, or 0 if
515       no widget has been set.
516
517       If you don't use QTableItems you may need to reimplement this function:
518       see the notes on large tables.
519
520       See also clearCellWidget() and setCellWidget().
521
522       Example: chart/setdataform.cpp.
523

void QTable::clearCell ( int row, int col ) [virtual]

525       Removes the QTableItem at row, col.
526
527       If you don't use QTableItems you may need to reimplement this function:
528       see the notes on large tables.
529

void QTable::clearCellWidget ( int row, int col ) [virtual]

531       Removes the widget (if there is one) set for the cell at row, col.
532
533       If you don't use QTableItems you may need to reimplement this function:
534       see the notes on large tables.
535
536       This function deletes the widget at row, col. Note that the widget is
537       not deleted immediately; instead QObject::deleteLater() is called on
538       the widget to avoid problems with timing issues.
539
540       See also cellWidget() and setCellWidget().
541

void QTable::clearSelection ( bool repaint = TRUE ) [slot]

543       Clears all selections and repaints the appropriate regions if repaint
544       is TRUE.
545
546       See also removeSelection().
547

void QTable::clicked ( int row, int col, int button, const QPoint & mousePos )

549       [signal]
550       This signal is emitted when mouse button button is clicked. The cell
551       where the event took place is at row, col, and the mouse's position is
552       in mousePos.
553
554       See also Qt::ButtonState.
555
556       Example: chart/setdataform.cpp.
557

int QTable::columnAt ( int x ) const [virtual]

559       Returns the number of the column at position x. x must be given in
560       content coordinates.
561
562       See also columnPos() and rowAt().
563

void QTable::columnClicked ( int col ) [virtual protected slot]

565       This function is called when the column col has been clicked. The
566       default implementation sorts this column if sorting() is TRUE.
567

void QTable::columnIndexChanged ( int section, int fromIndex, int toIndex )

569       [virtual protected slot]
570       This function is called when column order is to be changed, i.e. when
571       the user moved the column header section from fromIndex to toIndex.
572
573       If you want to change the column order programmatically, call
574       swapRows() or swapColumns();
575
576       See also QHeader::indexChange() and rowIndexChanged().
577

bool QTable::columnMovingEnabled () const

579       Returns TRUE if columns can be moved by the user; otherwise returns
580       FALSE. See the "columnMovingEnabled" property for details.
581

int QTable::columnPos ( int col ) const [virtual]

583       Returns the x-coordinate of the column col in content coordinates.
584
585       See also columnAt() and rowPos().
586

int QTable::columnWidth ( int col ) const [virtual]

588       Returns the width of column col.
589
590       See also setColumnWidth() and rowHeight().
591

void QTable::columnWidthChanged ( int col ) [virtual protected slot]

593       This function should be called whenever the column width of col has
594       been changed. It updates the geometry of any affected columns and
595       repaints the table to reflect the changes it has made.
596

void QTable::contentsDragEnterEvent ( QDragEnterEvent * e ) [virtual

598       protected]
599       This event handler is called whenever a QTable object receives a
600       QDragEnterEvent e, i.e. when the user pressed the mouse button to drag
601       something.
602
603       The focus is moved to the cell where the QDragEnterEvent occurred.
604
605       Reimplemented from QScrollView.
606

void QTable::contentsDragLeaveEvent ( QDragLeaveEvent * e ) [virtual

608       protected]
609       This event handler is called when a drag activity leaves this QTable
610       object with event e.
611
612       Reimplemented from QScrollView.
613

void QTable::contentsDragMoveEvent ( QDragMoveEvent * e ) [virtual protected]

615       This event handler is called whenever a QTable object receives a
616       QDragMoveEvent e, i.e. when the user actually drags the mouse.
617
618       The focus is moved to the cell where the QDragMoveEvent occurred.
619
620       Reimplemented from QScrollView.
621

void QTable::contentsDropEvent ( QDropEvent * e ) [virtual protected]

623       This event handler is called when the user ends a drag and drop by
624       dropping something onto this QTable and thus triggers the drop event,
625       e.
626
627       Reimplemented from QScrollView.
628

void QTable::contextMenuRequested ( int row, int col, const QPoint & pos )

630       [signal]
631       This signal is emitted when the user invokes a context menu with the
632       right mouse button (or with a system-specific keypress). The cell where
633       the event took place is at row, col. pos is the position where the
634       context menu will appear in the global coordinate system. This signal
635       is always emitted, even if the contents of the cell are disabled.
636

QWidget * QTable::createEditor ( int row, int col, bool initFromCell ) const

638       [virtual protected]
639       This function returns the widget which should be used as an editor for
640       the contents of the cell at row, col.
641
642       If initFromCell is TRUE, the editor is used to edit the current
643       contents of the cell (so the editor widget should be initialized with
644       this content). If initFromCell is FALSE, the content of the cell is
645       replaced with the new content which the user entered into the widget
646       created by this function.
647
648       The default functionality is as follows: if initFromCell is TRUE or the
649       cell has a QTableItem and the table item's QTableItem::isReplaceable()
650       is FALSE then the cell is asked to create an appropriate editor (using
651       QTableItem::createEditor()). Otherwise a QLineEdit is used as the
652       editor.
653
654       If you want to create your own editor for certain cells, implement a
655       custom QTableItem subclass and reimplement QTableItem::createEditor().
656
657       If you are not using QTableItems and you don't want to use a QLineEdit
658       as the default editor, subclass QTable and reimplement this function
659       with code like this:
660
661           QTableItem *i = item( row, col );
662           if ( initFromCell || ( i && !i->isReplaceable() ) )
663               // If we had a QTableItem ask the base class to create the editor
664               return QTable::createEditor( row, col, initFromCell );
665           else
666               return ...(create your own editor)
667       Ownership of the editor widget is transferred to the caller.
668
669       If you reimplement this function return 0 for read-only cells. You will
670       need to reimplement setCellContentFromEditor() to retrieve the data the
671       user entered.
672
673       See also QTableItem::createEditor().
674

int QTable::currEditCol () const [protected]

676       Returns the current edited column
677

int QTable::currEditRow () const [protected]

679       Returns the current edited row
680

void QTable::currentChanged ( int row, int col ) [signal]

682       This signal is emitted when the current cell has changed to row, col.
683
684       Example: chart/setdataform.cpp.
685

int QTable::currentColumn () const

687       Returns the current column.
688
689       See also currentRow().
690
691       Example: chart/setdataform.cpp.
692

int QTable::currentRow () const

694       Returns the current row.
695
696       See also currentColumn().
697
698       Example: chart/setdataform.cpp.
699

int QTable::currentSelection () const [virtual]

701       Returns the number of the current selection or -1 if there is no
702       current selection.
703
704       See also numSelections.
705

void QTable::doubleClicked ( int row, int col, int button, const QPoint &

707       mousePos ) [signal]
708       This signal is emitted when mouse button button is double-clicked. The
709       cell where the event took place is at row, col, and the mouse's
710       position is in mousePos.
711
712       See also Qt::ButtonState.
713

bool QTable::dragEnabled () const [slot]

715       If this function returns TRUE, the table supports dragging.
716
717       See also setDragEnabled().
718

QDragObject * QTable::dragObject () [virtual protected]

720       If the user presses the mouse on a selected cell, starts moving (i.e.
721       dragging), and dragEnabled() is TRUE, this function is called to obtain
722       a drag object. A drag using this object begins immediately unless
723       dragObject() returns 0.
724
725       By default this function returns 0. You might reimplement it and create
726       a QDragObject depending on the selected items.
727
728       See also dropped().
729

void QTable::drawContents ( QPainter * p, int cx, int cy, int cw, int ch )

731       [virtual protected]
732       Draws the table contents on the painter p. This function is optimized
733       so that it only draws the cells inside the cw pixels wide and ch pixels
734       high clipping rectangle at position cx, cy.
735
736       Additionally, drawContents() highlights the current cell.
737
738       Reimplemented from QScrollView.
739

void QTable::dropped ( QDropEvent * e ) [signal]

741       This signal is emitted when a drop event occurred on the table.
742
743       e contains information about the drop.
744

void QTable::editCell ( int row, int col, bool replace = FALSE ) [virtual

746       slot]
747       Starts editing the cell at row, col.
748
749       If replace is TRUE the content of this cell will be replaced by the
750       content of the editor when editing is finished, i.e. the user will be
751       entering new data; otherwise the current content of the cell (if any)
752       will be modified in the editor.
753
754       See also beginEdit().
755

EditMode QTable::editMode () const [protected]

757       Returns the current edit mode
758
759       See also QTable::EditMode.
760

void QTable::endEdit ( int row, int col, bool accept, bool replace ) [virtual

762       protected]
763       This function is called when in-place editing of the cell at row, col
764       is requested to stop.
765
766       If the cell is not being edited or accept is FALSE the function returns
767       and the cell's contents are left unchanged.
768
769       If accept is TRUE the content of the editor must be transferred to the
770       relevant cell. If replace is TRUE the current content of this cell
771       should be replaced by the content of the editor (this means removing
772       the current QTableItem of the cell and creating a new one for the
773       cell). Otherwise (if possible) the content of the editor should just be
774       set to the existing QTableItem of this cell.
775
776       setCellContentFromEditor() is called to replace the contents of the
777       cell with the contents of the cell's editor.
778
779       Finally clearCellWidget() is called to remove the editor widget.
780
781       See also setCellContentFromEditor() and beginEdit().
782

void QTable::ensureCellVisible ( int row, int col )

784       Scrolls the table until the cell at row, col becomes visible.
785

FocusStyle QTable::focusStyle () const

787       Returns how the current (focus) cell is drawn. See the "focusStyle"
788       property for details.
789

void QTable::hideColumn ( int col ) [virtual slot]

791       Hides column col.
792
793       See also showColumn() and hideRow().
794

void QTable::hideRow ( int row ) [virtual slot]

796       Hides row row.
797
798       See also showRow() and hideColumn().
799

QHeader * QTable::horizontalHeader () const

801       Returns the table's top QHeader.
802
803       This header contains the column labels.
804
805       To modify a column label use QHeader::setLabel(), e.g.
806
807               horizontalHeader()->setLabel( 0, tr( "File" ) );
808
809       See also verticalHeader(), setTopMargin(), and QHeader.
810
811       Examples:
812

int QTable::indexOf ( int row, int col ) const [protected]

814       Returns a single integer which identifies a particular row and col by
815       mapping the 2D table to a 1D array.
816
817       This is useful, for example, if you have a sparse table and want to use
818       a QIntDict to map integers to the cells that are used.
819

void QTable::insertColumns ( int col, int count = 1 ) [virtual slot]

821       Inserts count empty columns at column col. Also clears the
822       selection(s).
823
824       See also insertRows() and removeColumn().
825

void QTable::insertRows ( int row, int count = 1 ) [virtual slot]

827       Inserts count empty rows at row row. Also clears the selection(s).
828
829       See also insertColumns() and removeRow().
830

void QTable::insertWidget ( int row, int col, QWidget * w ) [virtual

832       protected]
833       Inserts widget w at row, col into the internal data structure. See the
834       documentation of setCellWidget() for further details.
835
836       If you don't use QTableItems you may need to reimplement this function:
837       see the notes on large tables.
838

bool QTable::isColumnHidden ( int col ) const [slot]

840       Returns TRUE if column col is hidden; otherwise returns FALSE.
841
842       See also hideColumn() and isRowHidden().
843

bool QTable::isColumnReadOnly ( int col ) const

845       Returns TRUE if column col is read-only; otherwise returns FALSE.
846
847       Whether a cell in this column is editable or read-only depends on the
848       cell's EditType, and this setting: see QTableItem::EditType.
849
850       See also setColumnReadOnly() and isRowReadOnly().
851

bool QTable::isColumnSelected ( int col, bool full = FALSE ) const

853       Returns TRUE if column col is selected; otherwise returns FALSE.
854
855       If full is FALSE (the default), 'column is selected' means that at
856       least one cell in the column is selected. If full is TRUE, then 'column
857       is selected' means every cell in the column is selected.
858
859       See also isRowSelected() and isSelected().
860

bool QTable::isColumnStretchable ( int col ) const [slot]

862       Returns TRUE if column col is stretchable; otherwise returns FALSE.
863
864       See also setColumnStretchable() and isRowStretchable().
865

bool QTable::isEditing () const [protected]

867       Returns TRUE if the EditMode is Editing or Replacing; otherwise (i.e.
868       the EditMode is NotEditing) returns FALSE.
869
870       See also QTable::EditMode.
871

bool QTable::isReadOnly () const

873       Returns TRUE if the table is read-only; otherwise returns FALSE. See
874       the "readOnly" property for details.
875

bool QTable::isRowHidden ( int row ) const [slot]

877       Returns TRUE if row row is hidden; otherwise returns FALSE.
878
879       See also hideRow() and isColumnHidden().
880

bool QTable::isRowReadOnly ( int row ) const

882       Returns TRUE if row row is read-only; otherwise returns FALSE.
883
884       Whether a cell in this row is editable or read-only depends on the
885       cell's EditType, and this setting: see QTableItem::EditType.
886
887       See also setRowReadOnly() and isColumnReadOnly().
888

bool QTable::isRowSelected ( int row, bool full = FALSE ) const

890       Returns TRUE if row row is selected; otherwise returns FALSE.
891
892       If full is FALSE (the default), 'row is selected' means that at least
893       one cell in the row is selected. If full is TRUE, then 'row is
894       selected' means every cell in the row is selected.
895
896       See also isColumnSelected() and isSelected().
897

bool QTable::isRowStretchable ( int row ) const [slot]

899       Returns TRUE if row row is stretchable; otherwise returns FALSE.
900
901       See also setRowStretchable() and isColumnStretchable().
902

bool QTable::isSelected ( int row, int col ) const

904       Returns TRUE if the cell at row, col is selected; otherwise returns
905       FALSE.
906
907       See also isRowSelected() and isColumnSelected().
908

QTableItem * QTable::item ( int row, int col ) const [virtual]

910       Returns the QTableItem representing the contents of the cell at row,
911       col.
912
913       If row or col are out of range or no content has been set for this
914       cell, item() returns 0.
915
916       If you don't use QTableItems you may need to reimplement this function:
917       see the notes on large tables.
918
919       See also setItem().
920
921       Example: regexptester/regexptester.cpp.
922

int QTable::numCols () const [virtual]

924       Returns the number of columns in the table. See the "numCols" property
925       for details.
926
927       Reimplemented in QDataTable.
928

int QTable::numRows () const [virtual]

930       Returns the number of rows in the table. See the "numRows" property for
931       details.
932
933       Reimplemented in QDataTable.
934

int QTable::numSelections () const

936       Returns the number of selections. See the "numSelections" property for
937       details.
938

void QTable::paintCell ( QPainter * p, int row, int col, const QRect & cr,

940       bool selected, const QColorGroup & cg ) [virtual]
941       Paints the cell at row, col on the painter p. The painter has already
942       been translated to the cell's origin. cr describes the cell coordinates
943       in the content coordinate system.
944
945       If selected is TRUE the cell is highlighted.
946
947       cg is the colorgroup which should be used to draw the cell content.
948
949       If you want to draw custom cell content, for example right-aligned
950       text, you must either reimplement paintCell(), or subclass QTableItem
951       and reimplement QTableItem::paint() to do the custom drawing.
952
953       If you're using a QTableItem subclass, for example, to store a data
954       structure, then reimplementing QTableItem::paint() may be the best
955       approach. For data you want to draw immediately, e.g. data retrieved
956       from a database, it is probably best to reimplement paintCell(). Note
957       that if you reimplement paintCell(), i.e. don't use QTableItems, you
958       must reimplement other functions: see the notes on large tables.
959
960       Note that the painter is not clipped by default in order to get maximum
961       efficiency. If you want clipping, use code like this:
962
963           p->setClipRect( cellRect(row, col), QPainter::CoordPainter );
964           //... your drawing code
965           p->setClipping( FALSE );
966

void QTable::paintCell ( QPainter * p, int row, int col, const QRect & cr,

968       bool selected ) [virtual]
969       This is an overloaded member function, provided for convenience. It
970       behaves essentially like the above function.
971
972       Use the other paintCell() function. This function is only included for
973       backwards compatibilty.
974

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

976       [virtual protected]
977       This function fills the cw pixels wide and ch pixels high rectangle
978       starting at position cx, cy with the background color using the painter
979       p.
980
981       paintEmptyArea() is invoked by drawContents() to erase or fill unused
982       areas.
983

void QTable::paintFocus ( QPainter * p, const QRect & cr ) [virtual]

985       Draws the focus rectangle of the current cell (see currentRow(),
986       currentColumn()).
987
988       The painter p is already translated to the cell's origin, while cr
989       specifies the cell's geometry in content coordinates.
990

QPixmap QTable::pixmap ( int row, int col ) const [virtual]

992       Returns the pixmap set for the cell at row, col, or a null-pixmap if
993       the cell contains no pixmap.
994
995       See also setPixmap().
996
997       Example: chart/setdataform.cpp.
998

void QTable::pressed ( int row, int col, int button, const QPoint & mousePos )

1000       [signal]
1001       This signal is emitted when mouse button button is pressed. The cell
1002       where the event took place is at row, col, and the mouse's position is
1003       in mousePos.
1004
1005       See also Qt::ButtonState.
1006

void QTable::removeColumn ( int col ) [virtual slot]

1008       Removes column col, and deletes all its cells including any table items
1009       and widgets the cells may contain. Also clears the selection(s).
1010
1011       See also removeColumns(), hideColumn(), insertColumns(), and
1012       removeRow().
1013

void QTable::removeColumns ( const QMemArray<int> & cols ) [virtual slot]

1015       Removes the columns listed in the array cols, and deletes all their
1016       cells including any table items and widgets the cells may contain.
1017
1018       The array passed in must only contain valid columns (in the range from
1019       0 to numCols() - 1) with no duplicates, and must be sorted in ascending
1020       order. Also clears the selection(s).
1021
1022       See also removeColumn(), insertColumns(), and removeRows().
1023

void QTable::removeRow ( int row ) [virtual slot]

1025       Removes row row, and deletes all its cells including any table items
1026       and widgets the cells may contain. Also clears the selection(s).
1027
1028       See also hideRow(), insertRows(), removeColumn(), and removeRows().
1029

void QTable::removeRows ( const QMemArray<int> & rows ) [virtual slot]

1031       Removes the rows listed in the array rows, and deletes all their cells
1032       including any table items and widgets the cells may contain.
1033
1034       The array passed in must only contain valid rows (in the range from 0
1035       to numRows() - 1) with no duplicates, and must be sorted in ascending
1036       order. Also clears the selection(s).
1037
1038       See also removeRow(), insertRows(), and removeColumns().
1039

void QTable::removeSelection ( const QTableSelection & s ) [virtual]

1041       If the table has a selection, s, this selection is removed from the
1042       table.
1043
1044       See also addSelection() and numSelections.
1045

void QTable::removeSelection ( int num ) [virtual]

1047       This is an overloaded member function, provided for convenience. It
1048       behaves essentially like the above function.
1049
1050       Removes selection number num from the table.
1051
1052       See also numSelections, addSelection(), and clearSelection().
1053

void QTable::repaintSelections ()

1055       Repaints all selections
1056

void QTable::resizeData ( int len ) [virtual protected]

1058       This is called when QTable's internal array needs to be resized to len
1059       elements.
1060
1061       If you don't use QTableItems you should reimplement this as an empty
1062       method to avoid wasting memory. See the notes on large tables for
1063       further details.
1064

int QTable::rowAt ( int y ) const [virtual]

1066       Returns the number of the row at position y. y must be given in content
1067       coordinates.
1068
1069       See also rowPos() and columnAt().
1070

int QTable::rowHeight ( int row ) const [virtual]

1072       Returns the height of row row.
1073
1074       See also setRowHeight() and columnWidth().
1075
1076       Example: table/small-table-demo/main.cpp.
1077

void QTable::rowHeightChanged ( int row ) [virtual protected slot]

1079       This function should be called whenever the row height of row has been
1080       changed. It updates the geometry of any affected rows and repaints the
1081       table to reflect the changes it has made.
1082

void QTable::rowIndexChanged ( int section, int fromIndex, int toIndex )

1084       [virtual protected slot]
1085       This function is called when the order of the rows is to be changed,
1086       i.e. the user moved the row header section section from fromIndex to
1087       toIndex.
1088
1089       If you want to change the order programmatically, call swapRows() or
1090       swapColumns();
1091
1092       See also QHeader::indexChange() and columnIndexChanged().
1093

bool QTable::rowMovingEnabled () const

1095       Returns TRUE if rows can be moved by the user; otherwise returns FALSE.
1096       See the "rowMovingEnabled" property for details.
1097

int QTable::rowPos ( int row ) const [virtual]

1099       Returns the y-coordinate of the row row in content coordinates.
1100
1101       See also rowAt() and columnPos().
1102

void QTable::selectCells ( int start_row, int start_col, int end_row, int

1104       end_col )
1105       Selects the range starting at start_row and start_col and ending at
1106       end_row and end_col.
1107
1108       See also QTableSelection.
1109

void QTable::selectColumn ( int col )

1111       Selects the column col.
1112
1113       See also QTableSelection.
1114

void QTable::selectRow ( int row )

1116       Selects the row row.
1117
1118       See also QTableSelection.
1119

QTableSelection QTable::selection ( int num ) const

1121       Returns selection number num, or an inactive QTableSelection if num is
1122       out of range (see QTableSelection::isActive()).
1123

void QTable::selectionChanged () [signal]

1125       This signal is emitted whenever a selection changes.
1126
1127       See also QTableSelection.
1128

SelectionMode QTable::selectionMode () const

1130       Returns the current selection mode. See the "selectionMode" property
1131       for details.
1132

void QTable::setCellContentFromEditor ( int row, int col ) [virtual protected]

1134
1135       This function is called to replace the contents of the cell at row, col
1136       with the contents of the cell's editor.
1137
1138       If there already exists a QTableItem for the cell, it calls
1139       QTableItem::setContentFromEditor() on this QTableItem.
1140
1141       If, for example, you want to create different QTableItems depending on
1142       the contents of the editor, you might reimplement this function.
1143
1144       If you want to work without QTableItems, you will need to reimplement
1145       this function to save the data the user entered into your data
1146       structure. (See the notes on large tables.)
1147
1148       See also QTableItem::setContentFromEditor() and createEditor().
1149

void QTable::setCellWidget ( int row, int col, QWidget * e ) [virtual]

1151       Sets the widget e to the cell at row, col and takes care of placing and
1152       resizing the widget when the cell geometry changes.
1153
1154       By default widgets are inserted into a vector with numRows() *
1155       numCols() elements. In very large tables you will probably want to
1156       store the widgets in a data structure that consumes less memory (see
1157       the notes on large tables). To support the use of your own data
1158       structure this function calls insertWidget() to add the widget to the
1159       internal data structure. To use your own data structure reimplement
1160       insertWidget(), cellWidget() and clearCellWidget().
1161
1162       Cell widgets are created dynamically with the new operator. The cell
1163       widgets are destroyed automatically once the table is destroyed; the
1164       table takes ownership of the widget when using setCellWidget.
1165
1166       Example: chart/setdataform.cpp.
1167

void QTable::setColumnLabels ( const QStringList & labels ) [slot]

1169       Sets the section labels of the horizontalHeader() to labels
1170

void QTable::setColumnMovingEnabled ( bool b ) [virtual slot]

1172       Sets whether columns can be moved by the user to b. See the
1173       "columnMovingEnabled" property for details.
1174

void QTable::setColumnReadOnly ( int col, bool ro ) [virtual slot]

1176       If ro is TRUE, column col is set to be read-only; otherwise the column
1177       is set to be editable.
1178
1179       Whether a cell in this column is editable or read-only depends on the
1180       cell's EditType, and this setting: see QTableItem::EditType.
1181
1182       See also isColumnReadOnly(), setRowReadOnly(), and readOnly.
1183
1184       Example: chart/setdataform.cpp.
1185

void QTable::setColumnStretchable ( int col, bool stretch ) [virtual slot]

1187       If stretch is TRUE, column col is set to be stretchable; otherwise
1188       column col is set to be unstretchable.
1189
1190       If the table widget's width decreases or increases stretchable columns
1191       will grow narrower or wider to fit the space available as completely as
1192       possible. The user cannot manually resize stretchable columns.
1193
1194       See also isColumnStretchable(), setRowStretchable(), and
1195       adjustColumn().
1196

void QTable::setColumnWidth ( int col, int w ) [virtual slot]

1198       Resizes column col to be w pixels wide.
1199
1200       See also columnWidth() and setRowHeight().
1201
1202       Example: chart/setdataform.cpp.
1203
1204       Reimplemented in QDataTable.
1205

void QTable::setCurrentCell ( int row, int col ) [virtual slot]

1207       Moves the focus to the cell at row, col.
1208
1209       See also currentRow() and currentColumn().
1210

void QTable::setDragEnabled ( bool b ) [virtual slot]

1212       If b is TRUE, the table starts a drag (see dragObject()) when the user
1213       presses and moves the mouse on a selected cell.
1214

void QTable::setEditMode ( EditMode mode, int row, int col ) [protected]

1216       Sets the current edit mode to mode, the current edit row to row and the
1217       current edit column to col.
1218
1219       See also EditMode.
1220

void QTable::setFocusStyle ( FocusStyle fs ) [virtual]

1222       Sets how the current (focus) cell is drawn to fs. See the "focusStyle"
1223       property for details.
1224

void QTable::setItem ( int row, int col, QTableItem * item ) [virtual]

1226       Inserts the table item item into the table at row row, column col, and
1227       repaints the cell. If a table item already exists in this cell it is
1228       deleted and replaced with item. The table takes ownership of the table
1229       item.
1230
1231       If you don't use QTableItems you may need to reimplement this function:
1232       see the notes on large tables.
1233
1234       See also item() and takeItem().
1235
1236       Examples:
1237

void QTable::setLeftMargin ( int m ) [virtual slot]

1239       Sets the left margin to be m pixels wide.
1240
1241       The verticalHeader(), which displays row labels, occupies this margin.
1242
1243       In an Arabic or Hebrew localization, the verticalHeader() will appear
1244       on the right side of the table, and this call will set the right
1245       margin.
1246
1247       See also leftMargin(), setTopMargin(), and verticalHeader().
1248
1249       Example: regexptester/regexptester.cpp.
1250

void QTable::setNumCols ( int r ) [virtual slot]

1252       Sets the number of columns in the table to r. See the "numCols"
1253       property for details.
1254

void QTable::setNumRows ( int r ) [virtual slot]

1256       Sets the number of rows in the table to r. See the "numRows" property
1257       for details.
1258

void QTable::setPixmap ( int row, int col, const QPixmap & pix ) [virtual]

1260       Sets the pixmap in the cell at row, col to pix.
1261
1262       If the cell does not contain a table item a QTableItem is created with
1263       an EditType of OnTyping, otherwise the existing table item's pixmap (if
1264       any) is replaced with pix.
1265
1266       Note that QComboTableItems and QCheckTableItems don't show pixmaps.
1267
1268       See also pixmap(), setText(), setItem(), and QTableItem::setPixmap().
1269
1270       Examples:
1271

void QTable::setReadOnly ( bool b ) [virtual slot]

1273       Sets whether the table is read-only to b. See the "readOnly" property
1274       for details.
1275

void QTable::setRowHeight ( int row, int h ) [virtual slot]

1277       Resizes row row to be h pixels high.
1278
1279       See also rowHeight() and setColumnWidth().
1280

void QTable::setRowLabels ( const QStringList & labels ) [slot]

1282       Sets the section labels of the verticalHeader() to labels
1283

void QTable::setRowMovingEnabled ( bool b ) [virtual slot]

1285       Sets whether rows can be moved by the user to b. See the
1286       "rowMovingEnabled" property for details.
1287

void QTable::setRowReadOnly ( int row, bool ro ) [virtual slot]

1289       If ro is TRUE, row row is set to be read-only; otherwise the row is set
1290       to be editable.
1291
1292       Whether a cell in this row is editable or read-only depends on the
1293       cell's EditType, and this setting: see QTableItem::EditType.
1294
1295       See also isRowReadOnly(), setColumnReadOnly(), and readOnly.
1296

void QTable::setRowStretchable ( int row, bool stretch ) [virtual slot]

1298       If stretch is TRUE, row row is set to be stretchable; otherwise row row
1299       is set to be unstretchable.
1300
1301       If the table widget's height decreases or increases stretchable rows
1302       will grow shorter or taller to fit the space available as completely as
1303       possible. The user cannot manually resize stretchable rows.
1304
1305       See also isRowStretchable() and setColumnStretchable().
1306

void QTable::setSelectionMode ( SelectionMode mode ) [virtual]

1308       Sets the current selection mode to mode. See the "selectionMode"
1309       property for details.
1310

void QTable::setShowGrid ( bool b ) [virtual slot]

1312       Sets whether the table's grid is displayed to b. See the "showGrid"
1313       property for details.
1314

void QTable::setSorting ( bool b ) [virtual slot]

1316       Sets whether a click on the header of a column sorts that column to b.
1317       See the "sorting" property for details.
1318

void QTable::setText ( int row, int col, const QString & text ) [virtual]

1320       Sets the text in the cell at row, col to text.
1321
1322       If the cell does not contain a table item a QTableItem is created with
1323       an EditType of OnTyping, otherwise the existing table item's text (if
1324       any) is replaced with text.
1325
1326       See also text(), setPixmap(), setItem(), and QTableItem::setText().
1327
1328       Examples:
1329

void QTable::setTopMargin ( int m ) [virtual slot]

1331       Sets the top margin to be m pixels high.
1332
1333       The horizontalHeader(), which displays column labels, occupies this
1334       margin.
1335
1336       See also topMargin() and setLeftMargin().
1337
1338       Example: regexptester/regexptester.cpp.
1339

void QTable::showColumn ( int col ) [virtual slot]

1341       Shows column col.
1342
1343       See also hideColumn() and showRow().
1344

bool QTable::showGrid () const

1346       Returns TRUE if the table's grid is displayed; otherwise returns FALSE.
1347       See the "showGrid" property for details.
1348

void QTable::showRow ( int row ) [virtual slot]

1350       Shows row row.
1351
1352       See also hideRow() and showColumn().
1353

void QTable::sortColumn ( int col, bool ascending = TRUE, bool wholeRows =

1355       FALSE ) [virtual]
1356       Sorts column col. If ascending is TRUE the sort is in ascending order,
1357       otherwise the sort is in descending order.
1358
1359       If wholeRows is TRUE, entire rows are sorted using swapRows();
1360       otherwise only cells in the column are sorted using swapCells().
1361
1362       Note that if you are not using QTableItems you will need to reimplement
1363       swapRows() and swapCells(). (See the notes on large tables.)
1364
1365       See also swapRows().
1366
1367       Example: table/statistics/statistics.cpp.
1368
1369       Reimplemented in QDataTable.
1370

bool QTable::sorting () const

1372       Returns TRUE if a click on the header of a column sorts that column;
1373       otherwise returns FALSE. See the "sorting" property for details.
1374

void QTable::startDrag () [virtual protected]

1376       Starts a drag.
1377
1378       Usually you don't need to call or reimplement this function yourself.
1379
1380       See also dragObject().
1381

void QTable::swapCells ( int row1, int col1, int row2, int col2 ) [virtual

1383       slot]
1384       Swaps the contents of the cell at row1, col1 with the contents of the
1385       cell at row2, col2.
1386
1387       This function is also called when the table is sorted.
1388
1389       If you don't use QTableItems and want your users to be able to swap
1390       cells, you will need to reimplement this function. (See the notes on
1391       large tables.)
1392
1393       See also swapColumns() and swapRows().
1394

void QTable::swapColumns ( int col1, int col2, bool swapHeader = FALSE )

1396       [virtual slot]
1397       Swaps the data in col1 with col2.
1398
1399       This function is used to swap the positions of two columns. It is
1400       called when the user changes the order of columns (see
1401       setColumnMovingEnabled(), and when columns are sorted.
1402
1403       If you don't use QTableItems and want your users to be able to swap
1404       columns you will need to reimplement this function. (See the notes on
1405       large tables.)
1406
1407       If swapHeader is TRUE, the columns' header contents is also swapped.
1408
1409       See also swapCells().
1410

void QTable::swapRows ( int row1, int row2, bool swapHeader = FALSE ) [virtual

1412       slot]
1413       Swaps the data in row1 and row2.
1414
1415       This function is used to swap the positions of two rows. It is called
1416       when the user changes the order of rows (see setRowMovingEnabled()),
1417       and when rows are sorted.
1418
1419       If you don't use QTableItems and want your users to be able to swap
1420       rows, e.g. for sorting, you will need to reimplement this function.
1421       (See the notes on large tables.)
1422
1423       If swapHeader is TRUE, the rows' header contents is also swapped.
1424
1425       This function will not update the QTable, you will have to do this
1426       manually, e.g. by calling updateContents().
1427
1428       See also swapColumns() and swapCells().
1429

void QTable::takeItem ( QTableItem * i ) [virtual]

1431       Takes the table item i out of the table. This function does not delete
1432       the table item. You must either delete the table item yourself or put
1433       it into a table (using setItem()) which will then take ownership of it.
1434
1435       Use this function if you want to move an item from one cell in a table
1436       to another, or to move an item from one table to another, reinserting
1437       the item with setItem().
1438
1439       If you want to exchange two cells use swapCells().
1440

QString QTable::text ( int row, int col ) const [virtual]

1442       Returns the text in the cell at row, col, or QString::null if the
1443       relevant item does not exist or has no text.
1444
1445       See also setText() and setPixmap().
1446
1447       Example: chart/setdataform.cpp.
1448
1449       Reimplemented in QDataTable.
1450

void QTable::updateCell ( int row, int col )

1452       Repaints the cell at row, col.
1453

void QTable::updateHeaderStates ()

1455       This functions updates all the header states to be in sync with the
1456       current selections. This should be called after programatically
1457       changing, adding or removing selections, so that the headers are
1458       updated.
1459

void QTable::valueChanged ( int row, int col ) [signal]

1461       This signal is emitted when the user changed the value in the cell at
1462       row, col.
1463
1464       Example: chart/setdataform.cpp.
1465

QHeader * QTable::verticalHeader () const

1467       Returns the table's vertical QHeader.
1468
1469       This header contains the row labels.
1470
1471       See also horizontalHeader(), setLeftMargin(), and QHeader.
1472
1473       Examples:
1474
1475   Property Documentation

bool columnMovingEnabled

1477       This property holds whether columns can be moved by the user.
1478
1479       The default is FALSE. Columns are moved by dragging whilst holding down
1480       the Ctrl key.
1481
1482       Warning: If QTable is used to move header sections as a result of user
1483       interaction, the mapping between header indexes and section exposed by
1484       QHeader will not reflect the order of the headers in the table; i.e.,
1485       QTable does not call QHeader::moveSection() to move sections but
1486       handles move operations internally.
1487
1488       See also rowMovingEnabled.
1489
1490       Set this property's value with setColumnMovingEnabled() and get this
1491       property's value with columnMovingEnabled().
1492

FocusStyle focusStyle

1494       This property holds how the current (focus) cell is drawn.
1495
1496       The default style is SpreadSheet.
1497
1498       See also QTable::FocusStyle.
1499
1500       Set this property's value with setFocusStyle() and get this property's
1501       value with focusStyle().
1502

int numCols

1504       This property holds the number of columns in the table.
1505
1506       Set this property's value with setNumCols() and get this property's
1507       value with numCols().
1508
1509       See also numRows.
1510

int numRows

1512       This property holds the number of rows in the table.
1513
1514       Set this property's value with setNumRows() and get this property's
1515       value with numRows().
1516
1517       See also numCols.
1518

int numSelections

1520       This property holds the number of selections.
1521
1522       Get this property's value with numSelections().
1523
1524       See also currentSelection().
1525

bool readOnly

1527       This property holds whether the table is read-only.
1528
1529       Whether a cell in the table is editable or read-only depends on the
1530       cell's EditType, and this setting: see QTableItem::EditType.
1531
1532       See also QWidget::enabled, setColumnReadOnly(), and setRowReadOnly().
1533
1534       Set this property's value with setReadOnly() and get this property's
1535       value with isReadOnly().
1536

bool rowMovingEnabled

1538       This property holds whether rows can be moved by the user.
1539
1540       The default is FALSE. Rows are moved by dragging whilst holding down
1541       the Ctrl key.
1542
1543       Warning: If QTable is used to move header sections as a result of user
1544       interaction, the mapping between header indexes and section exposed by
1545       QHeader will not reflect the order of the headers in the table; i.e.,
1546       QTable does not call QHeader::moveSection() to move sections but
1547       handles move operations internally.
1548
1549       See also columnMovingEnabled.
1550
1551       Set this property's value with setRowMovingEnabled() and get this
1552       property's value with rowMovingEnabled().
1553

SelectionMode selectionMode

1555       This property holds the current selection mode.
1556
1557       The default mode is Multi which allows the user to select multiple
1558       ranges of cells.
1559
1560       See also SelectionMode and selectionMode.
1561
1562       Set this property's value with setSelectionMode() and get this
1563       property's value with selectionMode().
1564

bool showGrid

1566       This property holds whether the table's grid is displayed.
1567
1568       The grid is shown by default.
1569
1570       Set this property's value with setShowGrid() and get this property's
1571       value with showGrid().
1572

bool sorting

1574       This property holds whether a click on the header of a column sorts
1575       that column.
1576
1577       Set this property's value with setSorting() and get this property's
1578       value with sorting().
1579
1580       See also sortColumn().
1581
1582

SEE ALSO

1584       http://doc.trolltech.com/qtable.html
1585       http://www.trolltech.com/faq/tech.html
1586
1588       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
1589       license file included in the distribution for a complete license
1590       statement.
1591

AUTHOR

1593       Generated automatically from the source code.
1594

BUGS

1596       If you find a bug in Qt, please report it as described in
1597       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
1598       help you. Thank you.
1599
1600       The definitive Qt documentation is provided in HTML format; it is
1601       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
1602       web browser. This man page is provided as a convenience for those users
1603       who prefer man pages, although this format is not officially supported
1604       by Trolltech.
1605
1606       If you find errors in this manual page, please report them to qt-
1607       bugs@trolltech.com.  Please include the name of the manual page
1608       (qtable.3qt) and the Qt version (3.3.8).
1609
1610
1611
1612Trolltech AS                    2 February 2007                    QTable(3qt)
Impressum