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

📄 qtable.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 5 页
字号:
Scrolls the table until the cell at \fIrow\fR, \fIcol\fR becomes visible..SH "FocusStyle QTable::focusStyle () const"Returns how the current (focus) cell is drawn. See the "focusStyle" property for details..SH "void QTable::hideColumn ( int col )\fC [virtual slot]\fR"Hides column \fIcol\fR..PPSee also showColumn() and hideRow()..SH "void QTable::hideRow ( int row )\fC [virtual slot]\fR"Hides row \fIrow\fR..PPSee also showRow() and hideColumn()..SH "QHeader * QTable::horizontalHeader () const"Returns the table's top QHeader..PPThis header contains the column labels..PPTo modify a column label use QHeader::setLabel(), e.g..PP.nf.br        horizontalHeader()->setLabel( 0, tr( "File" ) );.fi.PPSee also verticalHeader(), setTopMargin(), and QHeader..PPExamples:.)l chart/setdataform.cpp and table/small-table-demo/main.cpp..SH "int QTable::indexOf ( int row, int col ) const\fC [protected]\fR"Returns a single integer which identifies a particular \fIrow\fR and \fIcol\fR by mapping the 2D table to a 1D array..PPThis is useful, for example, if you have a sparse table and want to use a QIntDict to map integers to the cells that are used..SH "void QTable::insertColumns ( int col, int count = 1 )\fC [virtual slot]\fR"Inserts \fIcount\fR empty columns at column \fIcol\fR. Also clears the selection(s)..PPSee also insertRows() and removeColumn()..SH "void QTable::insertRows ( int row, int count = 1 )\fC [virtual slot]\fR"Inserts \fIcount\fR empty rows at row \fIrow\fR. Also clears the selection(s)..PPSee also insertColumns() and removeRow()..SH "void QTable::insertWidget ( int row, int col, QWidget * w )\fC [virtual protected]\fR"Inserts widget \fIw\fR at \fIrow\fR, \fIcol\fR into the internal data structure. See the documentation of setCellWidget() for further details..PPIf you don't use QTableItems you may need to reimplement this function: see the notes on large tables..SH "bool QTable::isColumnReadOnly ( int col ) const"Returns TRUE if column \fIcol\fR is read-only; otherwise returns FALSE..PPWhether a cell in this column is editable or read-only depends on the cell's EditType, and this setting: see QTableItem::EditType..PPSee also setColumnReadOnly() and isRowReadOnly()..SH "bool QTable::isColumnSelected ( int col, bool full = FALSE ) const"Returns TRUE if column \fIcol\fR is selected; otherwise returns FALSE..PPIf \fIfull\fR is FALSE (the default), 'column is selected' means that at least one cell in the column is selected. If \fIfull\fR is TRUE, then 'column is selected' means every cell in the column is selected..PPSee also isRowSelected() and isSelected()..SH "bool QTable::isColumnStretchable ( int col ) const\fC [slot]\fR"Returns TRUE if column \fIcol\fR is stretchable; otherwise returns FALSE..PPSee also setColumnStretchable() and isRowStretchable()..SH "bool QTable::isEditing () const\fC [protected]\fR"Returns TRUE if the EditMode is Editing or Replacing; otherwise (i.e. the EditMode is NotEditing) returns FALSE..PPSee also QTable::EditMode..SH "bool QTable::isReadOnly () const"Returns TRUE if the table is read-only; otherwise returns FALSE. See the "readOnly" property for details..SH "bool QTable::isRowReadOnly ( int row ) const"Returns TRUE if row \fIrow\fR is read-only; otherwise returns FALSE..PPWhether a cell in this row is editable or read-only depends on the cell's EditType, and this setting: see QTableItem::EditType..PPSee also setRowReadOnly() and isColumnReadOnly()..SH "bool QTable::isRowSelected ( int row, bool full = FALSE ) const"Returns TRUE if row \fIrow\fR is selected; otherwise returns FALSE..PPIf \fIfull\fR is FALSE (the default), 'row is selected' means that at least one cell in the row is selected. If \fIfull\fR is TRUE, then 'row is selected' means every cell in the row is selected..PPSee also isColumnSelected() and isSelected()..SH "bool QTable::isRowStretchable ( int row ) const\fC [slot]\fR"Returns TRUE if row \fIrow\fR is stretchable; otherwise returns FALSE..PPSee also setRowStretchable() and isColumnStretchable()..SH "bool QTable::isSelected ( int row, int col ) const"Returns TRUE if the cell at \fIrow\fR, \fIcol\fR is selected; otherwise returns FALSE..PPSee also isRowSelected() and isColumnSelected()..SH "QTableItem * QTable::item ( int row, int col ) const\fC [virtual]\fR"Returns the QTableItem representing the contents of the cell at \fIrow\fR, \fIcol\fR..PPIf \fIrow\fR or \fIcol\fR are out of range or no content has been set for this cell, item() returns 0..PPIf you don't use QTableItems you may need to reimplement this function: see the notes on large tables..PPSee also setItem()..SH "int QTable::numCols () const\fC [virtual]\fR"Returns the number of columns in the table. See the "numCols" property for details..PPReimplemented in QDataTable..SH "int QTable::numRows () const\fC [virtual]\fR"Returns the number of rows in the table. See the "numRows" property for details..PPReimplemented in QDataTable..SH "int QTable::numSelections () const"Returns the number of selections. See the "numSelections" property for details..SH "void QTable::paintCell ( QPainter * p, int row, int col, const QRect & cr, bool selected, const QColorGroup & cg )\fC [virtual]\fR"Paints the cell at \fIrow\fR, \fIcol\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 \fIselected\fR is TRUE the cell is highlighted..PP\fIcg\fR is the colorgroup which should be used to draw the cell content..PPIf you want to draw custom cell content, for example right-aligned text, you must either reimplement paintCell(), or subclass QTableItem and reimplement QTableItem::paint() to do the custom drawing..PPIf you're using a QTableItem subclass, for example, to store a data structure, then reimplementing QTableItem::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 QTableItems, you must reimplement other functions: see the notes on large tables..PPNote that the painter is not clipped by default in order to get maximum efficiency. If you want clipping, use code like this:.PP.nf.br    p->setClipRect( cellRect(row, col), QPainter::CoordPainter );.br    //... your drawing code.br    p->setClipping( FALSE );.br.fi.SH "void QTable::paintCell ( QPainter * p, int row, int col, const QRect & cr, bool selected )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPUse the other paintCell() function. This function is only included for backwards compatibilty..SH "void QTable::paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int ch )\fC [virtual protected]\fR"This function fills the \fIcw\fR pixels wide and \fIch\fR pixels high rectangle starting at position \fIcx\fR, \fIcy\fR with the background color using the painter \fIp\fR..PPpaintEmptyArea() 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())..PPThe painter \fIp\fR is already translated to the cell's origin, while \fIcr\fR specifies the cell's geometry in content coordinates..SH "QPixmap QTable::pixmap ( int row, int col ) const\fC [virtual]\fR"Returns the pixmap set for the cell at \fIrow\fR, \fIcol\fR, or a null-pixmap if the cell contains no pixmap..PPSee also setPixmap()..PPExample: chart/setdataform.cpp..SH "void QTable::pressed ( int row, int col, int button, const QPoint & mousePos )\fC [signal]\fR"This signal is emitted when mouse button \fIbutton\fR is pressed. The cell where the event took place is at \fIrow\fR, \fIcol\fR, and the mouse's position is in \fImousePos\fR..SH "void QTable::removeColumn ( int col )\fC [virtual slot]\fR"Removes column \fIcol\fR, and deletes all its cells including any table items and widgets the cells may contain. Also clears the selection(s)..PPSee also removeColumns(), hideColumn(), insertColumns(), and removeRow()..SH "void QTable::removeColumns ( const QMemArray<int> & cols )\fC [virtual slot]\fR"Removes the columns listed in the array \fIcols\fR, and deletes all their cells including any table items and widgets the cells may contain..PPThe 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)..PPSee also removeColumn(), insertColumns(), and removeRows()..SH "void QTable::removeRow ( int row )\fC [virtual slot]\fR"Removes row \fIrow\fR, and deletes all its cells including any table items and widgets the cells may contain. Also clears the selection(s)..PPSee also hideRow(), insertRows(), removeColumn(), and removeRows()..SH "void QTable::removeRows ( const QMemArray<int> & rows )\fC [virtual slot]\fR"Removes the rows listed in the array \fIrows\fR, and deletes all their cells including any table items and widgets the cells may contain..PPThe 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)..PPSee also removeRow(), insertRows(), and removeColumns()..SH "void QTable::removeSelection ( const QTableSelection & s )\fC [virtual]\fR"If the table has a selection, \fIs\fR, this selection is removed from the table..PPSee also addSelection() and numSelections..SH "void QTable::removeSelection ( int num )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPRemoves selection number \fInum\fR from the table..PPSee also numSelections, addSelection(), and clearSelection()..SH "void QTable::repaintSelections ()"Repaints all selections.SH "void QTable::resizeData ( int len )\fC [virtual protected]\fR"This is called when QTable's internal array needs to be resized to \fIlen\fR elements..PPIf you don't use QTableItems you should reimplement this as an empty method to avoid wasting memory. See the notes on large tables for further details..SH "int QTable::rowAt ( int y ) const\fC [virtual]\fR"Returns the number of the row at position \fIy\fR. \fIy\fR must be given in content coordinates..PPSee also rowPos() and columnAt()..SH "int QTable::rowHeight ( int row ) const\fC [virtual]\fR"Returns the height of row \fIrow\fR..PPSee also setRowHeight() and columnWidth()..PPExample: table/small-table-demo/main.cpp..SH "void QTable::rowHeightChanged ( int row )\fC [virtual protected slot]\fR"This function should be called whenever the row height of \fIrow\fR has been changed. It updates the geometry of any affected rows and repaints the table to reflect the changes it has made..SH "void QTable::rowIndexChanged ( int section, int fromIndex, int toIndex )\fC [virtual protected slot]\fR"This function is called when the order of the rows is to be changed, i.e. the user moved the row header section \fIsection\fR from \fIfromIndex\fR to \fItoIndex\fR..PPIf you want to change the order programmatically, call swapRows() or swapColumns();.PPSee also QHeader::indexChange() and columnIndexChanged()..SH "bool QTable::rowMovingEnabled () const"Returns TRUE if rows can be moved by the user; otherwise returns FALSE. See the "rowMovingEnabled" property for details..SH "int QTable::rowPos ( int row ) const\fC [virtual]\fR"Returns the y-coordinate of the row \fIrow\fR in content coordinates..PPSee also rowAt() and columnPos()..SH "void QTable::selectCells ( int start_row, int start_col, int end_row, int end_col )"Selects the range starting at \fIstart_row\fR and \fIstart_col\fR and ending at \fIend_row\fR and \fIend_col\fR..PPSee also QTableSelection..SH "void QTable::selectColumn ( int col )"Selects the column \fIcol\fR.PPSee also QTableSelection..SH "void QTable::selectRow ( int row )"Selects the row \fIrow\fR.PPSee also QTableSelection..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"This signal is emitted whenever a selection changes..PPSee also QTableSelection..SH "SelectionMode QTable::selectionMode () const"Returns the current selection mode. See the "selectionMode" property for details..SH "void QTable::setCellContentFromEditor ( int row, int col )\fC [virtual protected]\fR"This function is called to replace the contents of the cell at \fIrow\fR, \fIcol\fR with the contents of the cell's editor. If a QTableItem already exists for this cell, it is removed first (see clearCell())..PPIf for example, you want to create different QTableItems depending on the contents of the editor, you might reimplement this function..PPIf you want to work without QTableItems, you will need to reimplement this function to save the data the user entered into your data structure. (See the notes on large tables.).PPSee also QTableItem::setContentFromEditor() and createEditor()..SH "void QTable::setCellWidget ( int row, int col, QWidget * e )\fC [virtual]\fR"Sets the widget \fIe\fR to the cell at \fIrow\fR, \fIcol\fR and takes care of placing and resizing the widget when the cell geometry changes..PPBy 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() and clearCellWidget()..PPCell widgets are created dynamically with the \fCnew\fR operator. The cell widgets are destroyed automatically once the table is destroyed; the table takes ownership of the widget when using setCellWidget..PPExample: chart/setdataform.cpp..SH "void QTable::setColumnLabels ( const QStringList & labels )\fC [slot]\fR"Sets the section labels of the horizontalHeader() to \fIlabels\fR.SH "void QTable::setColumnMovingEnabled ( bool b )\fC [virtual slot]\fR"Sets whether columns can be moved by the user to \fIb\fR. See the "columnMovingEnabled" property for details..SH "void QTable::setColumnReadOnly ( int col, bool ro )\fC [virtual slot]\fR"If \fIro\fR is TRUE, column \fIcol\fR is set to be read-only; otherwise the column is set to be editable..PPWhether a cell in this column is editable or read-only depends on the cell's EditType, and this setting: see QTableItem::EditType..PPSee also isColumnReadOnly(), setRowReadOnly(), and readOnly..PPExample: chart/setdataform.cpp..SH "void QTable::setColumnStretchable ( int col, bool stretch )\fC [virtual slot]\fR"If \fIstretch\fR is TRUE, column \fIcol\fR is set to be stretchable; otherwise column \fIcol\fR is set to be unstretchable..PPIf 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..PPSee also isColumnStretchable(), setRowStretchable(), and adjustColumn()..SH "void QTable::setColumnWidth ( int col, int w )\fC [virtual slot]\fR"Resizes column \fIcol\fR to be \fIw\fR pixels wide..PPSee also columnWidth() and setRowHeight()..PPExample: chart/setdataform.cpp..PPReimplemented in QDataTable..SH "void QTable::setCurrentCell ( int row, int col )\fC [virtual slot]\fR"Moves the focus to the cell at \fIrow\fR, \fIcol\fR.

⌨️ 快捷键说明

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