Q3Table Class

The Q3Table class provides a flexible editable table widget. 更多...

头: #include <Q3Table>
继承: Q3ScrollView
继承者: Q3DataTable

公共类型

enum FocusStyle { FollowStyle, SpreadSheet }
enum SelectionMode { NoSelection, Single, Multi, SingleRow, MultiRow }

特性

公共函数

Q3Table (QWidget * parent = 0, const char * name = 0)
Q3Table (int numRows , int numCols , QWidget * parent = 0, const char * name = 0)
~Q3Table ()
virtual int addSelection (const Q3TableSelection & s )
virtual QRect cellGeometry (int row , int col ) const
virtual QRect cellRect (int row , int col ) const
virtual QWidget * cellWidget (int row , int col ) const
virtual void clearCell (int row , int col )
virtual void clearCellWidget (int row , int col )
virtual int columnAt (int x ) const
bool columnMovingEnabled () const
virtual int columnPos (int col ) const
virtual int columnWidth (int col ) const
int currentColumn () const
int currentRow () const
virtual int currentSelection () const
bool dragEnabled () const
void ensureCellVisible (int row , int col )
FocusStyle focusStyle () const
Q3Header * horizontalHeader () const
bool isColumnHidden (int col ) const
bool isColumnReadOnly (int col ) const
bool isColumnSelected (int col , bool full = false) const
bool isColumnStretchable (int col ) const
bool isReadOnly () const
bool isRowHidden (int row ) const
bool isRowReadOnly (int row ) const
bool isRowSelected (int row , bool full = false) const
bool isRowStretchable (int row ) const
bool isSelected (int row , int col ) const
virtual Q3TableItem * item (int row , int col ) const
virtual int numCols () const
virtual int numRows () const
int numSelections () const
virtual void paintCell (QPainter * p , int row , int col , const QRect & cr , bool selected , const QColorGroup & cg )
virtual void paintCell (QPainter * p , int row , int col , const QRect & cr , bool selected )
virtual void paintFocus (QPainter * p , const QRect & cr )
virtual QPixmap pixmap (int row , int col ) const
virtual void removeSelection (const Q3TableSelection & s )
virtual void removeSelection (int num )
void repaintSelections ()
virtual int rowAt (int y ) const
virtual int rowHeight (int row ) const
bool rowMovingEnabled () const
virtual int rowPos (int row ) const
void selectCells (int start_row , int start_col , int end_row , int end_col )
virtual void selectColumn (int col )
virtual void selectRow (int row )
Q3TableSelection selection (int num ) const
SelectionMode selectionMode () const
virtual void setCellWidget (int row , int col , QWidget * e )
virtual void setFocusStyle (FocusStyle fs )
virtual void setItem (int row , int col , Q3TableItem * item )
virtual void setPixmap (int row , int col , const QPixmap & pix )
virtual void setSelectionMode (SelectionMode mode )
virtual void setText (int row , int col , const QString & text )
bool showGrid () const
virtual void sortColumn (int col , bool ascending = true, bool wholeRows = false)
bool sorting () const
virtual void takeItem (Q3TableItem * i )
virtual QString text (int row , int col ) const
void updateCell (int row , int col )
void updateHeaderStates ()
Q3Header * verticalHeader () const

重实现公共函数

virtual bool eventFilter (QObject * o , QEvent * e )
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query ) const
virtual QSize sizeHint () const

公共槽

virtual void adjustColumn (int col )
virtual void adjustRow (int row )
void clearSelection (bool repaint = true)
virtual void editCell (int row , int col , bool replace = false)
virtual void hideColumn (int col )
virtual void hideRow (int row )
virtual void insertColumns (int col , int count = 1)
virtual void insertRows (int row , int count = 1)
virtual void removeColumn (int col )
virtual void removeColumns (const Q3MemArray<int> & cols )
virtual void removeRow (int row )
virtual void removeRows (const Q3MemArray<int> & rows )
void setColumnLabels (const QStringList & labels )
virtual void setColumnMovingEnabled (bool b )
virtual void setColumnReadOnly (int col , bool ro )
virtual void setColumnStretchable (int col , bool stretch )
virtual void setColumnWidth (int col , int w )
virtual void setCurrentCell (int row , int col )
virtual void setDragEnabled (bool b )
virtual void setLeftMargin (int m )
virtual void setNumCols (int r )
virtual void setNumRows (int r )
virtual void setReadOnly (bool b )
virtual void setRowHeight (int row , int h )
void setRowLabels (const QStringList & labels )
virtual void setRowMovingEnabled (bool b )
virtual void setRowReadOnly (int row , bool ro )
virtual void setRowStretchable (int row , bool stretch )
virtual void setShowGrid (bool b )
virtual void setSorting (bool b )
virtual void setTopMargin (int m )
virtual void showColumn (int col )
virtual void showRow (int row )
virtual void swapCells (int row1 , int col1 , int row2 , int col2 )
virtual void swapColumns (int col1 , int col2 , bool swapHeader = false)
virtual void swapRows (int row1 , int row2 , bool swapHeader = false)

信号

void clicked (int row , int col , int button , const QPoint & mousePos )
void contextMenuRequested (int row , int col , const QPoint & pos )
void currentChanged (int row , int col )
void doubleClicked (int row , int col , int button , const QPoint & mousePos )
void dropped (QDropEvent * e )
void pressed (int row , int col , int button , const QPoint & mousePos )
void selectionChanged ()
void valueChanged (int row , int col )

保护类型

enum EditMode { NotEditing, Editing, Replacing }

保护函数

virtual void activateNextCell ()
virtual QWidget * beginEdit (int row , int col , bool replace )
virtual QWidget * createEditor (int row , int col , bool initFromCell ) const
int currEditCol () const
int currEditRow () const
virtual Q3DragObject * dragObject ()
EditMode editMode () const
virtual void endEdit (int row , int col , bool accept , bool replace )
int indexOf (int row , int col ) const
virtual void insertWidget (int row , int col , QWidget * w )
bool isEditing () const
virtual void paintEmptyArea (QPainter * p , int cx , int cy , int cw , int ch )
virtual void resizeData (int len )
virtual void setCellContentFromEditor (int row , int col )
void setEditMode (EditMode mode , int row , int col )
virtual void startDrag ()

重实现保护函数

virtual void contentsContextMenuEvent (QContextMenuEvent * e )
virtual void contentsDragEnterEvent (QDragEnterEvent * e )
virtual void contentsDragLeaveEvent (QDragLeaveEvent * e )
virtual void contentsDragMoveEvent (QDragMoveEvent * e )
virtual void contentsDropEvent (QDropEvent * e )
virtual void contentsMouseDoubleClickEvent (QMouseEvent * e )
virtual void contentsMouseMoveEvent (QMouseEvent * e )
virtual void contentsMousePressEvent (QMouseEvent * e )
virtual void contentsMouseReleaseEvent (QMouseEvent * e )
virtual void drawContents (QPainter * p , int cx , int cy , int cw , int ch )
virtual void focusInEvent (QFocusEvent *)
virtual void focusOutEvent (QFocusEvent * e )
virtual void keyPressEvent (QKeyEvent * e )
virtual void paintEvent (QPaintEvent * e )
virtual void showEvent (QShowEvent * e )
virtual void viewportResizeEvent (QResizeEvent * e )

保护槽

virtual void columnClicked (int col )
virtual void columnIndexChanged (int section , int fromIndex , int toIndex )
virtual void columnWidthChanged (int col )
virtual void rowHeightChanged (int row )
virtual void rowIndexChanged (int section , int fromIndex , int toIndex )

额外继承成员

详细描述

The Q3Table class provides a flexible editable table widget.

Q3Table is easy to use, although it does have a large API because of the comprehensive functionality that it provides. Q3Table includes functions for manipulating headers , rows and columns , cells and selections . Q3Table also provides in-place editing and drag and drop, as well as a useful set of signals . Q3Table efficiently supports very large tables, for example, tables one million by one million cells are perfectly possible. Q3Table is economical with memory, using none for unused cells.

Q3Table *table = new Q3Table(100, 250, this);
table->setPixmap(3, 2, pix);
table->setText(3, 2, "A pixmap");
					

The first line constructs the table specifying its size in rows and columns. We then insert a pixmap and some text into the same cell , with the pixmap appearing to the left of the text. Q3Table cells can be populated with Q3TableItem s, Q3ComboTableItem s or by Q3CheckTableItem s. By default a vertical header appears at the left of the table showing row numbers and a horizontal header appears at the top of the table showing column numbers. (The numbers displayed start at 1, although row and column numbers within Q3Table begin at 0.)

If you want to use mouse tracking call setMouseTracking (true) on the viewport .

Table Items

Q3Table supports a header column, e.g. to display row numbers, and a header row, e.g to display column titles. To set row or column labels use Q3Header::setLabel () on the pointers returned by verticalHeader () 和 horizontalHeader () respectively. The vertical header is displayed within the table's left margin whose width is set with setLeftMargin (). The horizontal header is displayed within the table's top margin whose height is set with setTopMargin (). The table's grid can be switched off with setShowGrid (). If you want to hide a horizontal header call hide (), and call setTopMargin (0) so that the area the header would have occupied is reduced to zero size.

Header labels are indexed via their section numbers. Note that the default behavior of Q3Header regarding section numbers is overridden for Q3Table . See the explanation below in the Rows and Columns section in the discussion of moving columns and rows.

Rows and Columns

Row and column sizes are set with setRowHeight () 和 setColumnWidth (). If you want a row high enough to show the tallest item in its entirety, use adjustRow (). Similarly, to make a column wide enough to show the widest item use adjustColumn (). If you want the row height and column width to adjust automatically as the height and width of the table changes use setRowStretchable () 和 setColumnStretchable ().

行和列可以被隐藏和展示采用 hideRow (), hideColumn (), showRow () 和 showColumn (). New rows and columns are inserted using insertRows () 和 insertColumns (). Additional rows and columns are added at the bottom (rows) or right (columns) if you set setNumRows () 或 setNumCols () to be larger than numRows () 或 numCols (). Existing rows and columns are removed with removeRow () 和 removeColumn (). Multiple rows and columns can be removed with removeRows () 和 removeColumns ().

Rows and columns can be set to be movable using rowMovingEnabled () 和 columnMovingEnabled (). The user can drag them to reorder them holding down the Ctrl key and dragging the mouse. For performance reasons, the default behavior of Q3Header section numbers is overridden by Q3Table . Currently in Q3Table , when a row or column is dragged and reordered, the section number is also changed to its new position. Therefore, there is no difference between the section and the index fields in Q3Header Q3Table Q3Header classes do not provide a mechanism for indexing independently of the user interface ordering.

The table can be sorted using sortColumn (). Users can sort a column by clicking its header if setSorting () is set to true. Rows can be swapped with swapRows (), columns with swapColumns () and cells with swapCells ().

For editable tables (see setReadOnly ()) you can set the read-only property of individual rows and columns with setRowReadOnly () 和 setColumnReadOnly (). (Whether a cell is editable or read-only depends on these settings and the cell's Q3TableItem .

The row and column which have the focus are returned by currentRow () 和 currentColumn () 分别。

Although many Q3Table functions operate in terms of rows and columns the indexOf () function returns a single integer identifying a particular cell.

Cells

All of a Q3Table 's cells are empty when the table is constructed.

There are two approaches to populating the table's cells. The first and simplest approach is to use Q3TableItems or Q3TableItem subclasses. The second approach doesn't use Q3TableItems at all which is useful for very large sparse tables but requires you to reimplement a number of functions. We'll look at each approach in turn.

To put a string in a cell use setText (). This function will create a new Q3TableItem for the cell if one doesn't already exist, and displays the text in it. By default the table item's widget will be a QLineEdit . A pixmap may be put in a cell with setPixmap (), which also creates a table item if required. A cell may contain both a pixmap and text; the pixmap is displayed to the left of the text. Another approach is to construct a Q3TableItem or Q3TableItem subclass, set its properties, then insert it into a cell with setItem ().

If you want cells which contain comboboxes use the Q3ComboTableItem class. Similarly if you require cells containing checkboxes use the Q3CheckTableItem class. These table items look and behave just like the combobox or checkbox widgets but consume far less memory.

Q3Table takes ownership of its Q3TableItems and will delete them when the table itself is destroyed. You can take ownership of a table item using takeItem () which you use to move a cell's contents from one cell to another, either within the same table, or from one table to another. (See also, swapCells ()).

In-place editing of the text in Q3TableItems, and the values in Q3ComboTableItems and Q3CheckTableItems works automatically. Cells may be editable or read-only, see Q3TableItem::EditType . If you want fine control over editing see beginEdit () 和 endEdit ().

The contents of a cell can be retrieved as a Q3TableItem 使用 item (), or as a string with text () or as a pixmap (if there is one) with pixmap (). A cell's bounding rectangle is given by cellGeometry ()。使用 updateCell () to repaint a cell, for example to clear away a cell's visual representation after it has been deleted with clearCell (). The table can be forced to scroll to show a particular cell with ensureCellVisible ()。 isSelected () function indicates if a cell is selected.

It is possible to use your own widget as a cell's widget using setCellWidget (), but subclassing Q3TableItem might be a simpler approach. The cell's widget (if there is one) can be removed with clearCellWidget ().

Large tables

For large, sparse, tables using Q3TableItems or other widgets is inefficient. The solution is to draw the cell as it should appear and to create and destroy cell editors on demand.

This approach requires that you reimplement various functions. Reimplement paintCell () to display your data, and createEditor () 和 setCellContentFromEditor () to support in-place editing. It is very important to reimplement resizeData () to have no functionality, to prevent Q3Table from attempting to create a huge array. You will also need to reimplement item (), setItem (), takeItem (), clearCell (),和 insertWidget (), cellWidget () 和 clearCellWidget (). In almost every circumstance (for sorting, removing and inserting columns and rows, etc.), you also need to reimplement swapRows (), swapCells () 和 swapColumns (), including header handling.

If you represent active cells with a dictionary of Q3TableItems and QWidgets, i.e. only store references to cells that are actually used, many of the functions can be implemented with a single line of code.

For more information on cells see the Q3TableItem documenation.

选择

Q3Table 's support single selection, multi-selection (multiple cells) or no selection. The selection mode is set with setSelectionMode ()。使用 isSelected () to determine if a particular cell is selected, and isRowSelected () 和 isColumnSelected () to see if a row or column is selected.

Q3Table 's support many simultaneous selections. You can programmatically select cells with addSelection (). The number of selections is given by numSelections (). The current selection is returned by currentSelection (). You can remove a selection with removeSelection () and remove all selections with clearSelection (). Selections are Q3TableSelection 对象。

To easily add a new selection use selectCells (), selectRow () 或 selectColumn ().

Alternatively, use addSelection () to add new selections using Q3TableSelection objects. The advantage of using Q3TableSelection objects is that you can call Q3TableSelection::expandTo () to resize the selection and can query and compare them.

The number of selections is given by numSelections (). The current selection is returned by currentSelection (). You can remove a selection with removeSelection () and remove all selections with clearSelection ().

信号

When the user clicks a cell the currentChanged () signal is emitted. You can also connect to the lower level clicked (), doubleClicked () 和 pressed () signals. If the user changes the selection the selectionChanged () signal is emitted; similarly if the user changes a cell's value the valueChanged () signal is emitted. If the user right-clicks (or presses the appropriate platform-specific key sequence) the contextMenuRequested () signal is emitted. If the user drops a drag and drop object the dropped () signal is emitted with the drop event.

成员类型文档编制

enum Q3Table:: EditMode

常量 描述
Q3Table::NotEditing 0 No cell is currently being edited.
Q3Table::Editing 1 A cell is currently being edited. The editor was initialised with the cell's contents.
Q3Table::Replacing 2 A cell is currently being edited. The editor was not initialised with the cell's contents.

enum Q3Table:: FocusStyle

Specifies how the current cell (focus cell) is drawn.

常量 描述
Q3Table::FollowStyle 0 The current cell is drawn according to the current style and the cell's background is also drawn selected, if the current cell is within a selection
Q3Table::SpreadSheet 1 The current cell is drawn as in a spreadsheet. This means, it is signified by a black rectangle around the cell, and the background of the current cell is always drawn with the widget's base color - even when selected.

enum Q3Table:: SelectionMode

常量 描述
Q3Table::NoSelection 4 No cell can be selected by the user.
Q3Table::Single 0 The user may only select a single range of cells.
Q3Table::Multi 1 The user may select multiple ranges of cells.
Q3Table::SingleRow 2 The user may select one row at once.
Q3Table::MultiRow 3 The user may select multiple rows.

特性文档编制

columnMovingEnabled : bool

This property holds whether columns can be moved by the user.

The default is false. Columns are moved by dragging whilst holding down the Ctrl key.

访问函数:

bool columnMovingEnabled () const
virtual void setColumnMovingEnabled (bool b )

另请参阅 rowMovingEnabled .

focusStyle : FocusStyle

This property holds how the current (focus) cell is drawn.

The default style is SpreadSheet .

访问函数:

FocusStyle focusStyle () const
virtual void setFocusStyle (FocusStyle fs )

另请参阅 Q3Table::FocusStyle .

numCols : int

This property holds the number of columns in the table.

访问函数:

virtual int numCols () const
virtual void setNumCols (int r )

另请参阅 numRows .

numRows : int

This property holds the number of rows in the table.

访问函数:

virtual int numRows () const
virtual void setNumRows (int r )

另请参阅 numCols .

numSelections : const int

This property holds the number of selections.

访问函数:

int numSelections () const

另请参阅 currentSelection ().

readOnly : bool

This property holds whether the table is read-only.

Whether a cell in the table is editable or read-only depends on the cell's EditType , and this setting.

访问函数:

bool isReadOnly () const
virtual void setReadOnly (bool b )

另请参阅 QWidget::enabled , setColumnReadOnly (),和 setRowReadOnly ().

rowMovingEnabled : bool

This property holds whether rows can be moved by the user.

The default is false. Rows are moved by dragging whilst holding down the Ctrl key.

访问函数:

bool rowMovingEnabled () const
virtual void setRowMovingEnabled (bool b )

另请参阅 columnMovingEnabled .

selectionMode : SelectionMode

This property holds the current selection mode.

默认模式为 Multi which allows the user to select multiple ranges of cells.

访问函数:

SelectionMode selectionMode () const
virtual void setSelectionMode (SelectionMode mode )

showGrid : bool

This property holds whether the table's grid is displayed.

The grid is shown by default.

访问函数:

bool showGrid () const
virtual void setShowGrid (bool b )

sorting : bool

This property holds whether a click on the header of a column sorts that column.

访问函数:

bool sorting () const
virtual void setSorting (bool b )

另请参阅 sortColumn ().

成员函数文档编制

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

Creates an empty table object called name 作为子级对于 parent .

调用 setNumRows () 和 setNumCols () to set the table size before populating the table if you're using Q3TableItems.

Q3Table:: Q3Table ( int numRows , int numCols , QWidget * parent = 0, const char * name = 0)

Constructs an empty table called name with numRows rows and numCols columns. The table is a child of parent .

若正使用 Q3TableItem s to populate the table's cells, you can create Q3TableItem , Q3ComboTableItem and Q3CheckTableItem items and insert them into the table using setItem (). (See the notes on large tables for an alternative to using Q3TableItems.)

Q3Table:: ~Q3Table ()

Releases all the resources used by the Q3Table object, including all Q3TableItem s and their widgets.

[virtual protected] void Q3Table:: activateNextCell ()

This function is called to activate the next cell if in-place editing was finished by pressing the Enter key.

The default behaviour is to move from top to bottom, i.e. move to the cell beneath the cell being edited. Reimplement this function if you want different behaviour, e.g. moving from left to right.

[虚拟] int Q3Table:: addSelection (const Q3TableSelection & s )

Adds a selection described by s to the table and returns its number or -1 if the selection is invalid.

Remember to call Q3TableSelection::init () 和 Q3TableSelection::expandTo () to make the selection valid (see also Q3TableSelection::isActive (), or use the Q3TableSelection (int,int,int,int) constructor).

另请参阅 numSelections (), removeSelection (),和 clearSelection ().

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

Resizes column col so that the column width is wide enough to display the widest item the column contains.

另请参阅 adjustRow ().

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

Resizes row row so that the row height is tall enough to display the tallest item the row contains.

另请参阅 adjustColumn ().

[virtual protected] QWidget * Q3Table:: beginEdit ( int row , int col , bool replace )

This function is called to start in-place editing of the cell at row , col . Editing is achieved by creating an editor ( createEditor () is called) and setting the cell's editor with setCellWidget () to the newly created editor. (After editing is complete endEdit () will be called to replace the cell's content with the editor's content.) If replace is true the editor will start empty; otherwise it will be initialized with the cell's content (if any), i.e. the user will be modifying the original cell content.

另请参阅 endEdit ().

[虚拟] QRect Q3Table:: cellGeometry ( int row , int col ) const

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

[虚拟] QRect Q3Table:: cellRect ( int row , int col ) const

Returns the geometry of cell row , col in the cell's coordinate system. This is a convenience function useful in paintCell (). It is equivalent to QRect ( QPoint (0,0), cellGeometry ( row, col). size ());

另请参阅 cellGeometry ().

[虚拟] QWidget * Q3Table:: cellWidget ( int row , int col ) const

Returns the widget that has been set for the cell at row , col , or 0 if no widget has been set.

If you don't use Q3TableItem s you may need to reimplement this function: see the notes on large tables.

另请参阅 clearCellWidget () 和 setCellWidget ().

[虚拟] void Q3Table:: clearCell ( int row , int col )

移除 Q3TableItem at row , col .

If you don't use Q3TableItem s you may need to reimplement this function: see the notes on large tables.

[虚拟] void Q3Table:: clearCellWidget ( int row , int col )

Removes the widget (if there is one) set for the cell at row , col .

If you don't use Q3TableItem s you may need to reimplement this function: see the notes on large tables.

This function deletes the widget at row , col . Note that the widget is not deleted immediately; instead QObject::deleteLater () is called on the widget to avoid problems with timing issues.

另请参阅 cellWidget () 和 setCellWidget ().

[slot] void Q3Table:: clearSelection ( bool repaint = true)

Clears all selections and repaints the appropriate regions if repaint 为 true。

另请参阅 removeSelection ().

[signal] void Q3Table:: clicked ( int row , int col , int button , const QPoint & mousePos )

This signal is emitted when mouse button button is clicked. The cell where the event took place is at row , col , and the mouse's position is in mousePos .

另请参阅 Qt::MouseButton .

[虚拟] int Q3Table:: columnAt ( int x ) const

Returns the number of the column at position x . x must be given in content coordinates.

另请参阅 columnPos () 和 rowAt ().

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

This function is called when the column col has been clicked. The default implementation sorts this column if sorting () 为 true。

[virtual protected slot] void Q3Table:: columnIndexChanged ( int section , int fromIndex , int toIndex )

This function is called when column order is to be changed, i.e. when the user moved the column header section from fromIndex to toIndex .

If you want to change the column order programmatically, call swapRows () 或 swapColumns ();

另请参阅 Q3Header::indexChange () 和 rowIndexChanged ().

[虚拟] int Q3Table:: columnPos ( int col ) const

Returns the x-coordinate of the column col in content coordinates.

另请参阅 columnAt () 和 rowPos ().

[虚拟] int Q3Table:: columnWidth ( int col ) const

Returns the width of column col .

另请参阅 setColumnWidth () 和 rowHeight ().

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

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

[virtual protected] void Q3Table:: contentsContextMenuEvent ( QContextMenuEvent * e )

重实现自 Q3ScrollView::contentsContextMenuEvent ().

[virtual protected] void Q3Table:: contentsDragEnterEvent ( QDragEnterEvent * e )

重实现自 Q3ScrollView::contentsDragEnterEvent ().

This event handler is called whenever a Q3Table object receives a QDragEnterEvent e , i.e. when the user pressed the mouse button to drag something.

The focus is moved to the cell where the QDragEnterEvent 出现。

[virtual protected] void Q3Table:: contentsDragLeaveEvent ( QDragLeaveEvent * e )

重实现自 Q3ScrollView::contentsDragLeaveEvent ().

This event handler is called when a drag activity leaves this Q3Table object with event e .

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

重实现自 Q3ScrollView::contentsDragMoveEvent ().

This event handler is called whenever a Q3Table object receives a QDragMoveEvent e , i.e. when the user actually drags the mouse.

The focus is moved to the cell where the QDragMoveEvent 出现。

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

重实现自 Q3ScrollView::contentsDropEvent ().

This event handler is called when the user ends a drag and drop by dropping something onto this Q3Table and thus triggers the drop event, e .

[virtual protected] void Q3Table:: contentsMouseDoubleClickEvent ( QMouseEvent * e )

重实现自 Q3ScrollView::contentsMouseDoubleClickEvent ().

[virtual protected] void Q3Table:: contentsMouseMoveEvent ( QMouseEvent * e )

重实现自 Q3ScrollView::contentsMouseMoveEvent ().

[virtual protected] void Q3Table:: contentsMousePressEvent ( QMouseEvent * e )

重实现自 Q3ScrollView::contentsMousePressEvent ().

[virtual protected] void Q3Table:: contentsMouseReleaseEvent ( QMouseEvent * e )

重实现自 Q3ScrollView::contentsMouseReleaseEvent ().

[signal] void Q3Table:: contextMenuRequested ( int row , int col , const QPoint & pos )

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

[virtual protected] QWidget * Q3Table:: createEditor ( int row , int col , bool initFromCell ) const

This function returns the widget which should be used as an editor for the contents of the cell at row , col .

initFromCell is true, the editor is used to edit the current contents of the cell (so the editor widget should be initialized with this content). If initFromCell is false, the content of the cell is replaced with the new content which the user entered into the widget created by this function.

The default functionality is as follows: if initFromCell is true or the cell has a Q3TableItem and the table item's Q3TableItem::isReplaceable () is false then the cell is asked to create an appropriate editor (using Q3TableItem::createEditor ()). Otherwise a QLineEdit is used as the editor.

If you want to create your own editor for certain cells, implement a custom Q3TableItem subclass and reimplement Q3TableItem::createEditor ().

If you are not using Q3TableItem s and you don't want to use a QLineEdit as the default editor, subclass Q3Table and reimplement this function with code like this:

Q3TableItem *i = item(row, col);
if (initFromCell || (i && !i->isReplaceable()))
    // If we had a Q3TableItem ask the base class to create the editor
    return Q3Table::createEditor(row, col, initFromCell);
else
    return ...(create your own editor)
					

Ownership of the editor widget is transferred to the caller.

If you reimplement this function return 0 for read-only cells. You will need to reimplement setCellContentFromEditor () to retrieve the data the user entered.

另请参阅 Q3TableItem::createEditor ().

[protected] int Q3Table:: currEditCol () const

Returns the current edited column

[protected] int Q3Table:: currEditRow () const

Returns the current edited row

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

This signal is emitted when the current cell has changed to row , col .

int Q3Table:: currentColumn () const

Returns the current column.

另请参阅 currentRow ().

int Q3Table:: currentRow () const

返回当前行。

另请参阅 currentColumn ().

[虚拟] int Q3Table:: currentSelection () const

Returns the number of the current selection or -1 if there is no current selection.

另请参阅 numSelections ().

[signal] void Q3Table:: doubleClicked ( int row , int col , int button , const QPoint & mousePos )

This signal is emitted when mouse button button is double-clicked. The cell where the event took place is at row , col , and the mouse's position is in mousePos .

另请参阅 Qt::MouseButton .

bool Q3Table:: dragEnabled () const

If this function returns true, the table supports dragging.

另请参阅 setDragEnabled ().

[virtual protected] Q3DragObject * Q3Table:: dragObject ()

If the user presses the mouse on a selected cell, starts moving (i.e. dragging), and dragEnabled () is true, this function is called to obtain a drag object. A drag using this object begins immediately unless dragObject() returns 0.

By default this function returns 0. You might reimplement it and create a Q3DragObject depending on the selected items.

另请参阅 dropped ().

[virtual protected] void Q3Table:: drawContents ( QPainter * p , int cx , int cy , int cw , int ch )

重实现自 Q3ScrollView::drawContents ().

Draws the table contents on the painter p . This function is optimized so that it only draws the cells inside the cw pixels wide and ch pixels high clipping rectangle at position cx , cy .

Additionally, drawContents() highlights the current cell.

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

This signal is emitted when a drop event occurred on the table.

e contains information about the drop.

[virtual slot] void Q3Table:: editCell ( int row , int col , bool replace = false)

Starts editing the cell at row , col .

replace is true the content of this cell will be replaced by the content of the editor when editing is finished, i.e. the user will be entering new data; otherwise the current content of the cell (if any) will be modified in the editor.

另请参阅 beginEdit ().

[protected] EditMode Q3Table:: editMode () const

Returns the current edit mode

另请参阅 setEditMode () 和 Q3Table::EditMode .

[virtual protected] void Q3Table:: endEdit ( int row , int col , bool accept , bool replace )

This function is called when in-place editing of the cell at row , col is requested to stop.

If the cell is not being edited or accept is false the function returns and the cell's contents are left unchanged.

accept is true the content of the editor must be transferred to the relevant cell. If replace is true the current content of this cell should be replaced by the content of the editor (this means removing the current Q3TableItem of the cell and creating a new one for the cell). Otherwise (if possible) the content of the editor should just be set to the existing Q3TableItem of this cell.

setCellContentFromEditor () is called to replace the contents of the cell with the contents of the cell's editor.

Finally clearCellWidget () is called to remove the editor widget.

另请参阅 setCellContentFromEditor () 和 beginEdit ().

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

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

[虚拟] bool Q3Table:: eventFilter ( QObject * o , QEvent * e )

重实现自 QObject::eventFilter ().

[virtual protected] void Q3Table:: focusInEvent ( QFocusEvent *)

重实现自 QWidget::focusInEvent ().

[virtual protected] void Q3Table:: focusOutEvent ( QFocusEvent * e )

重实现自 QWidget::focusOutEvent ().

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

Hides column col .

另请参阅 showColumn () 和 hideRow ().

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

Hides row row .

另请参阅 showRow () 和 hideColumn ().

Q3Header * Q3Table:: horizontalHeader () const

Returns the table's top Q3Header .

This header contains the column labels.

To modify a column label use Q3Header::setLabel ().

另请参阅 verticalHeader (), setTopMargin (),和 Q3Header .

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

Returns a single integer which identifies a particular row and col by mapping the 2D table to a 1D array.

This is useful, for example, if you have a sparse table and want to use a Q3IntDict to map integers to the cells that are used.

[虚拟] QVariant Q3Table:: inputMethodQuery ( Qt::InputMethodQuery query ) const

重实现自 QWidget::inputMethodQuery ().

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

插入 count empty columns at column col . Also clears the selection(s).

另请参阅 insertRows () 和 removeColumn ().

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

插入 count empty rows at row row . Also clears the selection(s).

另请参阅 insertColumns () 和 removeRow ().

[virtual protected] void Q3Table:: insertWidget ( int row , int col , QWidget * w )

Inserts widget w at row , col into the internal data structure. See the documentation of setCellWidget () for further details.

If you don't use Q3TableItem s you may need to reimplement this function: see the notes on large tables.

bool Q3Table:: isColumnHidden ( int col ) const

Returns true if column col is hidden; otherwise returns false.

另请参阅 hideColumn () 和 isRowHidden ().

bool Q3Table:: isColumnReadOnly ( int col ) const

Returns true if column col is read-only; otherwise returns false.

Whether a cell in this column is editable or read-only depends on the cell's EditType, and this setting.

另请参阅 setColumnReadOnly () 和 isRowReadOnly ().

bool Q3Table:: isColumnSelected ( int col , bool full = false) const

Returns true if column col is selected; otherwise returns false.

full is false (the default), 'column is selected' means that at least one cell in the column is selected. If full is true, then 'column is selected' means every cell in the column is selected.

另请参阅 isRowSelected () 和 isSelected ().

bool Q3Table:: isColumnStretchable ( int col ) const

Returns true if column col is stretchable; otherwise returns false.

另请参阅 setColumnStretchable () 和 isRowStretchable ().

[protected] bool Q3Table:: isEditing () const

返回 true 若 EditMode is Editing or Replacing ; otherwise (i.e. the EditMode is NotEditing ) returns false.

另请参阅 Q3Table::EditMode .

bool Q3Table:: isRowHidden ( int row ) const

Returns true if row row is hidden; otherwise returns false.

另请参阅 hideRow () 和 isColumnHidden ().

bool Q3Table:: isRowReadOnly ( int row ) const

Returns true if row row is read-only; otherwise returns false.

Whether a cell in this row is editable or read-only depends on the cell's EditType , and this setting.

另请参阅 setRowReadOnly () 和 isColumnReadOnly ().

bool Q3Table:: isRowSelected ( int row , bool full = false) const

Returns true if row row is selected; otherwise returns false.

full is false (the default), 'row is selected' means that at least one cell in the row is selected. If full is true, then 'row is selected' means every cell in the row is selected.

另请参阅 isColumnSelected () 和 isSelected ().

bool Q3Table:: isRowStretchable ( int row ) const

Returns true if row row is stretchable; otherwise returns false.

另请参阅 setRowStretchable () 和 isColumnStretchable ().

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

Returns true if the cell at row , col is selected; otherwise returns false.

另请参阅 isRowSelected () 和 isColumnSelected ().

[虚拟] Q3TableItem * Q3Table:: item ( int row , int col ) const

返回 Q3TableItem representing the contents of the cell at row , col .

row or col are out of range or no content has been set for this cell, item() returns 0.

If you don't use Q3TableItem s you may need to reimplement this function: see the notes on large tables.

另请参阅 setItem ().

[virtual protected] void Q3Table:: keyPressEvent ( QKeyEvent * e )

重实现自 QWidget::keyPressEvent ().

[虚拟] void Q3Table:: paintCell ( QPainter * p , int row , int col , const QRect & cr , bool selected , const QColorGroup & cg )

Paints the cell at row , col on the painter p . The painter has already been translated to the cell's origin. cr describes the cell coordinates in the content coordinate system.

selected is true the cell is highlighted.

cg is the colorgroup which should be used to draw the cell content.

If you want to draw custom cell content, for example right-aligned text, you must either reimplement paintCell(), or subclass Q3TableItem 并重实现 Q3TableItem::paint () to do the custom drawing.

If you're using a Q3TableItem subclass, for example, to store a data structure, then reimplementing Q3TableItem::paint () may be the best approach. For data you want to draw immediately, e.g. data retrieved from a database, it is probably best to reimplement paintCell(). Note that if you reimplement paintCell(), i.e. don't use Q3TableItem s, you must reimplement other functions: see the notes on large tables.

Note that the painter is not clipped by default in order to get maximum efficiency. If you want clipping, use code like this:

p->setClipRect(cellRect(row, col), QPainter::CoordPainter);
//... your drawing code
p->setClipping(false);
					

[虚拟] void Q3Table:: paintCell ( QPainter * p , int row , int col , const QRect & cr , bool selected )

这是重载函数。

Use the other paintCell () function. This function is only included for backwards compatibility.

[virtual protected] void Q3Table:: paintEmptyArea ( QPainter * p , int cx , int cy , int cw , int ch )

This function fills the cw pixels wide and ch pixels high rectangle starting at position cx , cy with the background color using the painter p .

paintEmptyArea() is invoked by drawContents () to erase or fill unused areas.

[virtual protected] void Q3Table:: paintEvent ( QPaintEvent * e )

重实现自 QWidget::paintEvent ().

[虚拟] void Q3Table:: paintFocus ( QPainter * p , const QRect & cr )

Draws the focus rectangle of the current cell (see currentRow (), currentColumn ()).

The painter p is already translated to the cell's origin, while cr specifies the cell's geometry in content coordinates.

[虚拟] QPixmap Q3Table:: pixmap ( int row , int col ) const

Returns the pixmap set for the cell at row , col , or a null-pixmap if the cell contains no pixmap.

另请参阅 setPixmap ().

[signal] void Q3Table:: pressed ( int row , int col , int button , const QPoint & mousePos )

This signal is emitted when mouse button button is pressed. The cell where the event took place is at row , col , and the mouse's position is in mousePos .

另请参阅 Qt::MouseButton .

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

Removes column col , and deletes all its cells including any table items and widgets the cells may contain. Also clears the selection(s).

另请参阅 removeColumns (), hideColumn (), insertColumns (),和 removeRow ().

[virtual slot] void Q3Table:: removeColumns (const Q3MemArray < int > & cols )

Removes the columns listed in the array cols , and deletes all their cells including any table items and widgets the cells may contain.

The array passed in must only contain valid columns (in the range from 0 to numCols () - 1) with no duplicates, and must be sorted in ascending order. Also clears the selection(s).

另请参阅 removeColumn (), insertColumns (),和 removeRows ().

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

Removes row row , and deletes all its cells including any table items and widgets the cells may contain. Also clears the selection(s).

另请参阅 hideRow (), insertRows (), removeColumn (),和 removeRows ().

[virtual slot] void Q3Table:: removeRows (const Q3MemArray < int > & rows )

Removes the rows listed in the array rows , and deletes all their cells including any table items and widgets the cells may contain.

The array passed in must only contain valid rows (in the range from 0 to numRows () - 1) with no duplicates, and must be sorted in ascending order. Also clears the selection(s).

另请参阅 removeRow (), insertRows (),和 removeColumns ().

[虚拟] void Q3Table:: removeSelection (const Q3TableSelection & s )

If the table has a selection, s , this selection is removed from the table.

另请参阅 addSelection () 和 numSelections ().

[虚拟] void Q3Table:: removeSelection ( int num )

这是重载函数。

Removes selection number num from the table.

另请参阅 numSelections (), addSelection (),和 clearSelection ().

void Q3Table:: repaintSelections ()

Repaints all selections

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

This is called when Q3Table 's internal array needs to be resized to len 元素。

If you don't use Q3TableItems you should reimplement this as an empty method to avoid wasting memory. See the notes on large tables for further details.

[虚拟] int Q3Table:: rowAt ( int y ) const

Returns the number of the row at position y . y must be given in content coordinates.

另请参阅 rowPos () 和 columnAt ().

[虚拟] int Q3Table:: rowHeight ( int row ) const

Returns the height of row row .

另请参阅 setRowHeight () 和 columnWidth ().

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

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

[virtual protected slot] void Q3Table:: rowIndexChanged ( int section , int fromIndex , int toIndex )

This function is called when the order of the rows is to be changed, i.e. the user moved the row header section section from fromIndex to toIndex .

If you want to change the order programmatically, call swapRows () 或 swapColumns ();

另请参阅 Q3Header::indexChange () 和 columnIndexChanged ().

[虚拟] int Q3Table:: rowPos ( int row ) const

Returns the y-coordinate of the row row in content coordinates.

另请参阅 rowAt () 和 columnPos ().

void Q3Table:: selectCells ( int start_row , int start_col , int end_row , int end_col )

Selects the range starting at start_row and start_col and ending at end_row and end_col .

另请参阅 Q3TableSelection .

[虚拟] void Q3Table:: selectColumn ( int col )

Selects the column col .

另请参阅 Q3TableSelection .

[虚拟] void Q3Table:: selectRow ( int row )

Selects the row row .

另请参阅 Q3TableSelection .

Q3TableSelection Q3Table:: selection ( int num ) const

Returns selection number num , or an inactive Q3TableSelection if num is out of range (see Q3TableSelection::isActive ()).

[signal] void Q3Table:: selectionChanged ()

This signal is emitted whenever a selection changes.

另请参阅 Q3TableSelection .

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

This function is called to replace the contents of the cell at row , col with the contents of the cell's editor.

If there already exists a Q3TableItem for the cell, it calls Q3TableItem::setContentFromEditor () on this Q3TableItem .

If, for example, you want to create different Q3TableItem s depending on the contents of the editor, you might reimplement this function.

If you want to work without Q3TableItem s, you will need to reimplement this function to save the data the user entered into your data structure. (See the notes on large tables.)

另请参阅 Q3TableItem::setContentFromEditor () 和 createEditor ().

[虚拟] void Q3Table:: setCellWidget ( int row , int col , QWidget * e )

Sets the widget e to the cell at row , col and takes care of placing and resizing the widget when the cell geometry changes.

By default widgets are inserted into a vector with numRows () * numCols () elements. In very large tables you will probably want to store the widgets in a data structure that consumes less memory (see the notes on large tables). To support the use of your own data structure this function calls insertWidget () to add the widget to the internal data structure. To use your own data structure reimplement insertWidget (), cellWidget () 和 clearCellWidget ().

Cell widgets are created dynamically with the new operator. The cell widgets are destroyed automatically once the table is destroyed; the table takes ownership of the widget when using setCellWidget.

另请参阅 cellWidget ().

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

Sets the section labels of the horizontalHeader () 到 labels

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

ro is true, column col is set to be read-only; otherwise the column is set to be editable.

Whether a cell in this column is editable or read-only depends on the cell's EditType, and this setting.

另请参阅 isColumnReadOnly (), setRowReadOnly (),和 setReadOnly ().

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

stretch is true, column col is set to be stretchable; otherwise column col is set to be unstretchable.

If the table widget's width decreases or increases stretchable columns will grow narrower or wider to fit the space available as completely as possible. The user cannot manually resize stretchable columns.

另请参阅 isColumnStretchable (), setRowStretchable (),和 adjustColumn ().

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

Resizes column col w pixels wide.

另请参阅 columnWidth () 和 setRowHeight ().

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

Moves the focus to the cell at row , col .

另请参阅 currentRow () 和 currentColumn ().

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

b is true, the table starts a drag (see dragObject ()) when the user presses and moves the mouse on a selected cell.

另请参阅 dragEnabled ().

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

Sets the current edit mode to mode , the current edit row to row and the current edit column to col .

另请参阅 editMode () 和 EditMode .

[虚拟] void Q3Table:: setItem ( int row , int col , Q3TableItem * item )

Inserts the table item item into the table at row row , column col , and repaints the cell. If a table item already exists in this cell it is deleted and replaced with item . The table takes ownership of the table item.

If you don't use Q3TableItem s you may need to reimplement this function: see the notes on large tables.

另请参阅 item () 和 takeItem ().

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

Sets the left margin to be m pixels wide.

The verticalHeader (), which displays row labels, occupies this margin.

In an Arabic or Hebrew localization, the verticalHeader () will appear on the right side of the table, and this call will set the right margin.

另请参阅 leftMargin (), setTopMargin (),和 verticalHeader ().

[虚拟] void Q3Table:: setPixmap ( int row , int col , const QPixmap & pix )

Sets the pixmap in the cell at row , col to pix .

If the cell does not contain a table item a Q3TableItem is created with an EditType of OnTyping , otherwise the existing table item's pixmap (if any) is replaced with pix .

注意, Q3ComboTableItem s and Q3CheckTableItem s don't show pixmaps.

另请参阅 pixmap (), setText (), setItem (),和 Q3TableItem::setPixmap ().

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

Resizes row row h pixels high.

另请参阅 rowHeight () 和 setColumnWidth ().

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

Sets the section labels of the verticalHeader () 到 labels

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

ro is true, row row is set to be read-only; otherwise the row is set to be editable.

Whether a cell in this row is editable or read-only depends on the cell's EditType, and this setting.

另请参阅 isRowReadOnly (), setColumnReadOnly (),和 setReadOnly ().

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

stretch is true, row row is set to be stretchable; otherwise row row is set to be unstretchable.

If the table widget's height decreases or increases stretchable rows will grow shorter or taller to fit the space available as completely as possible. The user cannot manually resize stretchable rows.

另请参阅 isRowStretchable () 和 setColumnStretchable ().

[虚拟] void Q3Table:: setText ( int row , int col , const QString & text )

Sets the text in the cell at row , col to text .

If the cell does not contain a table item a Q3TableItem is created with an EditType of OnTyping , otherwise the existing table item's text (if any) is replaced with text .

另请参阅 text (), setPixmap (), setItem (),和 Q3TableItem::setText ().

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

Sets the top margin to be m pixels high.

The horizontalHeader (), which displays column labels, occupies this margin.

另请参阅 topMargin () 和 setLeftMargin ().

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

Shows column col .

另请参阅 hideColumn () 和 showRow ().

[virtual protected] void Q3Table:: showEvent ( QShowEvent * e )

重实现自 QWidget::showEvent ().

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

Shows row row .

另请参阅 hideRow () 和 showColumn ().

[虚拟] QSize Q3Table:: sizeHint () const

重实现自 QWidget::sizeHint ().

[虚拟] void Q3Table:: sortColumn ( int col , bool ascending = true, bool wholeRows = false)

Sorts column col 。若 ascending is true the sort is in ascending order, otherwise the sort is in descending order.

wholeRows is true, entire rows are sorted using swapRows (); otherwise only cells in the column are sorted using swapCells ().

Note that if you are not using Q3TableItems you will need to reimplement swapRows () 和 swapCells (). (See the notes on large tables.)

另请参阅 swapRows ().

[virtual protected] void Q3Table:: startDrag ()

Starts a drag.

Usually you don't need to call or reimplement this function yourself.

另请参阅 dragObject ().

[virtual slot] void Q3Table:: swapCells ( int row1 , int col1 , int row2 , int col2 )

Swaps the contents of the cell at row1 , col1 with the contents of the cell at row2 , col2 .

This function is also called when the table is sorted.

If you don't use Q3TableItem s and want your users to be able to swap cells, you will need to reimplement this function. (See the notes on large tables.)

另请参阅 swapColumns () 和 swapRows ().

[virtual slot] void Q3Table:: swapColumns ( int col1 , int col2 , bool swapHeader = false)

Swaps the data in col1 with col2 .

This function is used to swap the positions of two columns. It is called when the user changes the order of columns (see setColumnMovingEnabled (), and when columns are sorted.

If you don't use Q3TableItem s and want your users to be able to swap columns you will need to reimplement this function. (See the notes on large tables.)

swapHeader is true, the columns' header contents is also swapped.

另请参阅 swapCells ().

[virtual slot] void Q3Table:: swapRows ( int row1 , int row2 , bool swapHeader = false)

Swaps the data in row1 and row2 .

This function is used to swap the positions of two rows. It is called when the user changes the order of rows (see setRowMovingEnabled ()), and when rows are sorted.

If you don't use Q3TableItem s and want your users to be able to swap rows, e.g. for sorting, you will need to reimplement this function. (See the notes on large tables.)

swapHeader is true, the rows' header contents is also swapped.

This function will not update the Q3Table , you will have to do this manually, e.g. by calling updateContents ().

另请参阅 swapColumns () 和 swapCells ().

[虚拟] void Q3Table:: takeItem ( Q3TableItem * i )

Takes the table item i out of the table. This function does not delete the table item. You must either delete the table item yourself or put it into a table (using setItem ()) which will then take ownership of it.

Use this function if you want to move an item from one cell in a table to another, or to move an item from one table to another, reinserting the item with setItem ().

If you want to exchange two cells use swapCells ().

[虚拟] QString Q3Table:: text ( int row , int col ) const

Returns the text in the cell at row , col , or an empty string if the relevant item does not exist or has no text.

另请参阅 setText () 和 setPixmap ().

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

Repaints the cell at row , col .

void Q3Table:: updateHeaderStates ()

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

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

This signal is emitted when the user changed the value in the cell at row , col .

Q3Header * Q3Table:: verticalHeader () const

Returns the table's vertical Q3Header .

This header contains the row labels.

另请参阅 horizontalHeader (), setLeftMargin (),和 Q3Header .

[virtual protected] void Q3Table:: viewportResizeEvent ( QResizeEvent * e )

重实现自 Q3ScrollView::viewportResizeEvent ().