⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtable.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.PPAfter that clearCellWidget() is called to get rid of the editor widget..PPSee also setCellContentFromEditor() and beginEdit()..SH "void QTable::ensureCellVisible ( int row, int col )"Scrolls the table until the cell \fIrow, col\fR becomes visible..SH "bool QTable::eventFilter ( QObject * o, QEvent * e ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "void QTable::focusInEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTable::focusOutEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTable::hideColumn ( int col ) \fC[virtual slot]\fR"Hides the column \fIcol.\fR.PPSee also showCol()..SH "void QTable::hideRow ( int row ) \fC[virtual slot]\fR"Hides the row \fIrow.\fR.PPSee also showRow()..SH "QHeader * QTable::horizontalHeader () const"Returns the top QHeader of the table..SH "int QTable::indexOf ( int row, int col ) const \fC[protected]\fR"Maps 2D table to 1D array index..SH "void QTable::insertWidget ( int row, int col, QWidget * w ) \fC[virtual protected]\fR"Inserts the widget \fIw\fR into the internal datastructure. See the documentation of setCellWidget() for further details..SH "bool QTable::isColumnSelected ( int col, bool full = FALSE ) const"Returns TRUE if column \fIcol\fR is selected, and FALSE otherwise..PPIf \fIfull\fR is TRUE, the entire column must be selected for this function to return TRUE. If \fIfull\fR is FALSE, at least one cell in \fIcol\fR must be selected..SH "bool QTable::isColumnStretchable ( int col ) const \fC[slot]\fR"Returns wheather the column \fIcol\fR is stretchable or not..PPSee also setColumnStretchable()..SH "bool QTable::isRowSelected ( int row, bool full = FALSE ) const"Returns TRUE if \fIrow\fR is selected, and FALSE otherwise..PPIf \fIfull\fR is TRUE, the entire row must be selected for this function to return TRUE. If \fIfull\fR is FALSE, at least one cell in \fIrow\fR must be selected..SH "bool QTable::isRowStretchable ( int row ) const \fC[slot]\fR"Returns wheather the row \fIrow\fR is stretchable or not..PPSee also setRowStretchable()..SH "bool QTable::isSelected ( int row, int col ) const"Checks whether the cell at position \fIrow, col\fR is selected..SH "QTableItem * QTable::item ( int row, int col ) const \fC[virtual]\fR"Returns the QTableItem representing the contents of the cell \fIrow, col.\fR If \fIrow\fR or \fIcol\fR are out of range or no content has been set for this cell so far, item() returns 0..SH "void QTable::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QTable::numCols () const"Returns the number of columns of the table..SH "int QTable::numRows () const"Returns the number of rows of the table..SH "int QTable::numSelections () const"Returns the number of selections..SH "void QTable::paintCell ( QPainter * p, int row, int col, const QRect & cr, bool selected ) \fC[virtual]\fR"Paints the cell at the position \fIrow, col\fR on the painter \fIp.\fR The painter has already been translated to the cell's origin. \fIcr\fR describes the cell coordinates in the content coordinate system...PPIf you want to draw custom cell content you have to reimplement paintCell() to do the custom drawing, or else subclass QTableItem and reimplement QTableItem::paint()..PPIf you want to change the alignment of your items then you will need to reimplement paintCell()..PPReimplementing this function is probably better e.g. for data you retrieve from a database and draw at once, while using QTableItem::paint() is probably better e.g. if you wish these data to be stored in a data structure in the table..SH "void QTable::paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int ch ) \fC[virtual protected]\fR"This function fills the rectangular \fIcx, cy, cw, ch\fR with the background color. paintEmptyArea() is invoked by drawContents() to erase or fill unused areas..SH "void QTable::paintFocus ( QPainter * p, const QRect & cr ) \fC[virtual]\fR"Draws the focus rectangle of the current cell (see currentRow(), currentColumn()). The painter \fIp\fR is already translated to the cell's origin, while \fIcr\fR specifies the cell's geometry in contents coordinates..SH "QPixmap QTable::pixmap ( int row, int col ) const \fC[virtual]\fR"Returns the pixmap set for the cell \fIrow, col,\fR or a null-pixmap if the cell contains no pixmap..SH "void QTable::pressed ( int row, int col, int button, const QPoint & mousePos ) \fC[signal]\fR"This signal is emitted whenever the mousebutton \fIbutton\fR is pressed above the cell located in \fIrow\fR and \fIcol.\fR The actual mouse position is passed as \fImousePos.\fR.SH "void QTable::removeSelection ( const QTableSelection & s ) \fC[virtual]\fR"Removes the selection matching the values of \fIs\fR from the table..SH "void QTable::removeSelection ( int num ) \fC[virtual]\fR"Removes selection number \fInum.\fR.SH "void QTable::resizeData ( int len ) \fC[virtual protected]\fR"This is called when QTable's internal array needs to be resized..PPIf you don't use QTableItems you should reimplement this as an empty method, thus no memory is wasted. In addition, you will have to reimplement item(), setItem(), and clearCell() as empty functions in a different way..PPAs soon as you enable sorting or allow the user to change rows or columns (see setRowMovingEnabled(), setColumnMovingEnabled()), you are strongly advised to reimplement swapColumns(), swapRows(), and swapCells() to work with your data..SH "void QTable::resizeEvent ( QResizeEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QTable::rowAt ( int pos ) const \fC[virtual]\fR"Returns the row which is at \fIpos. pos\fR has to be given in contents coordinates..SH "int QTable::rowHeight ( int row ) const \fC[virtual]\fR"Returns the height of the row \fIrow.\fR.SH "void QTable::rowHeightChanged ( int row ) \fC[virtual protected slot]\fR"Call this function whenever the height of row \fIrow\fR has changed in order to rearrange its contents..SH "void QTable::rowIndexChanged ( int, int, int ) \fC[virtual protected slot]\fR"This function is called if the order of the rows has been changed. If you want to change the order programmatically, call swapRows() or swapColumns()..SH "bool QTable::rowMovingEnabled () const"Returns whether rows can be moved by the user..SH "int QTable::rowPos ( int row ) const \fC[virtual]\fR"Returns the y-position of the row \fIrow\fR in contents coordinates..SH "QTableSelection QTable::selection ( int num ) const"Returns selection number \fInum,\fR or an empty QTableSelection if \fInum\fR is out of range (see QTableSelection::isNull())..SH "void QTable::selectionChanged () \fC[signal]\fR"Whenever a selection changes, this signal is emitted..SH "QTable::SelectionMode QTable::selectionMode() const"Reveals the current selection mode..SH "void QTable::setCellContentFromEditor ( int row, int col ) \fC[virtual protected]\fR"This function is called to set the contents of the cell \fIrow, col\fR from the editor of this cell to this cell. If there existed already a QTableItem for this cell, this is removed first (see clearCell())..PPIf you want to create e.g different QTableItems depending on the contents of the editor, you might reimplement this function. Also if you want to work without QTableItems, you will reimplement this function to set the data which the user entered to your datastructure..PPSee also QTableItem::setContentFromEditor()..SH "void QTable::setCellWidget ( int row, int col, QWidget * e ) \fC[virtual]\fR"Sets the widget \fIe\fR to the cell \fIrow, col\fR and does all the placement and further stuff and takes care about correctly placing are resizing it when the cell geometry changes..PPBy default widgets are inserted into a vector with numRows() * numCols() elements. In very big tables you probably want to store the widgets in a datastructure which needs less memory (like a hash-table). To make this possible this functions calls insertWidget() to add the widget to the internal datastructure. So if you want to use your own datastructure, reimplement insertWidget(), cellWidget() and clearCellWidget()..SH "void QTable::setColumnMovingEnabled ( bool b ) \fC[virtual slot]\fR"If \fIb\fR is set to TRUE, columns can be moved by the user..SH "void QTable::setColumnStretchable ( int col, bool stretch ) \fC[virtual slot]\fR"Sets the column \fIcol\fR to stretchable if \fIstretch\fR is TRUE, else to non-stretchable. So, if the table widgets gets wider than its contents, stretchable columns are stretched so that the contents fits exactly into to widget..SH "void QTable::setColumnWidth ( int col, int w ) \fC[virtual slot]\fR"Resizes the column to \fIw\fR pixel wide..SH "void QTable::setCurrentCell ( int row, int col ) \fC[virtual slot]\fR"Moves the focus to the cell at position \fIrow, col.\fR.PPSee also currentRow() and currentColumn()..SH "void QTable::setItem ( int row, int col, QTableItem * item ) \fC[virtual]\fR"Sets the content for the cell \fIrow, col.\fR If cell item already exists in that position, the old one is deleted..PPsetItem() also repaints the cell..SH "void QTable::setLeftMargin ( int m ) \fC[virtual slot]\fR"Sets the left margin to \fIm\fR pixels..PPTo get rid of the left header entirely, use the following code:.PP.nf.br  setLeftMargin( 0 );.br  verticalHeader()->hide();.fi.SH "void QTable::setNumCols ( int c ) \fC[virtual slot]\fR"Sets the number of columns to \fIc.\fR.SH "void QTable::setNumRows ( int r ) \fC[virtual slot]\fR"Sets the number of rows to \fIr.\fR.SH "void QTable::setPixmap ( int row, int col, const QPixmap & pix ) \fC[virtual]\fR"Sets the pixmap in cell \fIrow, col\fR to \fIpix.\fR If no QTableItem belongs to the cell yet, an item is created..SH "void QTable::setRowHeight ( int row, int h ) \fC[virtual slot]\fR"Resizes the row to be \fIh\fR pixel height..SH "void QTable::setRowMovingEnabled ( bool b ) \fC[virtual slot]\fR"If \fIb\fR is set to TRUE, rows can be moved by the user..SH "void QTable::setRowStretchable ( int row, bool stretch ) \fC[virtual slot]\fR"Sets the row \fIrow\fR to stretchable if \fIstretch\fR is TRUE, else to non-stretchable. So, if the table widgets gets higher than its contents, stretchable rows are stretched so that the contents fits exactly into to widget..SH "void QTable::setSelectionMode ( SelectionMode mode )"Sets the table's selection mode to \fImode.\fR By default multi-range selections (\fCMulti)\fR are allowed..SH "void QTable::setShowGrid ( bool b ) \fC[virtual slot]\fR"If \fIb\fR is TRUE, the table grid is shown, otherwise not. The default is TRUE..SH "void QTable::setSorting ( bool b ) \fC[virtual slot]\fR"If \fIb\fR is set to TRUE, clicking on the header of a column sorts this column..PPSee also sortColumn()..SH "void QTable::setText ( int row, int col, const QString & text ) \fC[virtual]\fR"Sets the text in cell \fIrow, col\fR to \fItext.\fR If no QTableItem belongs to the cell yet, an item is created..SH "void QTable::setTopMargin ( int m ) \fC[virtual slot]\fR"Sets the top margin to \fIm\fR pixels..PPTo get rid of the top header entirely, use the following code:.PP.nf.br  setTopMargin( 0 );.br  topHeader()->hide();.fi.SH "void QTable::showColumn ( int col ) \fC[virtual slot]\fR"Shows the column \fIcol.\fR.PPSee also hideColumn()..SH "void QTable::showEvent ( QShowEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "bool QTable::showGrid () const"Returns whether the table grid shows up or not..SH "void QTable::showRow ( int row ) \fC[virtual slot]\fR"Shows the row \fIrow.\fR.PPSee also hideRow()..SH "QSize QTable::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QTable::sortColumn ( int col, bool ascending = TRUE, bool wholeRows = FALSE ) \fC[virtual]\fR"Sorts the column \fIcol\fR in ascending order if \fIascending\fR is TRUE, else in descending order. If \fIwholeRows\fR is TRUE, for changing data of the cells swapRows() is called, else swapCells() is called..PPSee also swapRows()..SH "bool QTable::sorting () const"Returns wheather clicking on a column header sorts the column..PPSee also setSorting()..SH "void QTable::swapCells ( int row1, int col1, int row2, int col2 ) \fC[virtual slot]\fR"Swaps the content of the cells \fIrow1, col1\fR and \fIrow2, col2.\fR This function is used for sorting cells..SH "void QTable::swapColumns ( int col1, int col2 ) \fC[virtual slot]\fR"Exchanges \fIcol1\fR with \fIcol2\fR and vice versa. This is useful for sorting, and it allows the user to rearrange the columns in a different order. If you don't use QTableItems you will probably reimplement this function..SH "void QTable::swapRows ( int row1, int row2 ) \fC[virtual slot]\fR"Swaps data of \fIrow1\fR and \fIrow2.\fR This is used by sorting mechanisms or when the user changes the order of the rows. If you don't use QTableItems you might wish to reimplement this function..SH "void QTable::takeItem ( QTableItem * i ) \fC[virtual]\fR"Takes the item \fIi\fR out of the table. This functions doesn't delete it..SH "QString QTable::text ( int row, int col ) const \fC[virtual]\fR"Returns the text in cell \fIrow, col,\fR or an empty string if the relevant item does not exist or includes no text..SH "void QTable::updateCell ( int row, int col )"Repaints the cell at position \fIrow, col.\fR.SH "void QTable::valueChanged ( int row, int col ) \fC[signal]\fR"This signal is emitted if the user edited the cell row, \fIcol.\fR.SH "QHeader * QTable::verticalHeader () const"Returns the outer left QHeader..SH "SEE ALSO".BR http://doc.trolltech.com/qtable.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtable.3qt) and the Qtversion (2.3.2).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -