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

📄 qtableview.3qt

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 3QT
📖 第 1 页 / 共 2 页
字号:
See also lastRowVisible()..SH "int QTableView::lastRowVisible () const \fC[protected]\fR"Returns the index of the last (bottom) row in the view. The index of the first row is 0..PPIf no rows are visible it returns -1. This can happen if the view is too small for the first row and Tbl_cutCellsV is set..PPSee also lastColVisible()..SH "int QTableView::leftCell () const \fC[protected]\fR"Returns the index of the first column in the table that is visible in the view. The index of the very leftmost column is 0..PPSee also topCell() and setLeftCell()..SH "int QTableView::maxColOffset () \fC[protected]\fR"Returns the index of the last column which may be at the left edge of the view..PPDepending on the Tbl_scrollLastHCell flag, this may or may not be the last column..PPSee also maxXOffset() and maxRowOffset()..SH "int QTableView::maxRowOffset () \fC[protected]\fR"Returns the index of the last row which may be at the top edge of the view..PPDepending on the Tbl_scrollLastVCell flag, this may or may not be the last row..PPSee also maxYOffset() and maxColOffset()..SH "int QTableView::maxViewX () const \fC[protected]\fR"Returns the rightmost pixel of the table view in \fIview\fR coordinates. This excludes the frame and any scroll bar, but includes blank pixels to the right of the visible table data..PPSee also maxViewY(), viewWidth() and contentsRect()..SH "int QTableView::maxViewY () const \fC[protected]\fR"Returns the bottom pixel of the table view in \fIview\fR coordinates. This excludes the frame and any scroll bar, but includes blank pixels below the visible table data..PPSee also maxViewX(), viewHeight() and contentsRect()..SH "int QTableView::maxXOffset () \fC[protected]\fR"Returns the maximum horizontal offset within the table of the view's left edge, in \fItable\fR coordinates..PPThis is used mainly to set the horizontal scroll bar's range..PPSee also maxColOffset(), maxYOffset() and totalWidth()..SH "int QTableView::maxYOffset () \fC[protected]\fR"Returns the maximum vertical offset within the table of the view's top edge, in \fItable\fR coordinates..PPThis is used mainly to set the vertical scroll bar's range..PPSee also maxRowOffset(), maxXOffset() and totalHeight()..SH "int QTableView::minViewX () const \fC[protected]\fR"Returns the leftmost pixel of the table view in \fIview\fR coordinates. This excludes the frame and any header..PPSee also maxViewY(), viewWidth() and contentsRect()..SH "int QTableView::minViewY () const \fC[protected]\fR"Returns the top pixel of the table view in \fIview\fR coordinates. This excludes the frame and any header..PPSee also maxViewX(), viewHeight() and contentsRect()..SH "int QTableView::numCols () const \fC[protected]\fR"Returns the number of columns in the table.PPSee also numRows() and setNumCols()..SH "int QTableView::numRows () const \fC[protected]\fR"Returns the number of rows in the table..PPSee also numCols() and setNumRows()..SH "void QTableView::paintCell ( QPainter * p, int row, int col ) \fC[virtual protected]\fR"This pure virtual function is called to paint the single cell at \fI(row,col)\fR using \fIp,\fR which is open when paintCell() is called and must remain open..PPThe coordinate system is translated such that the origin is at the top left corner of the cell to be painted; i.e. \fIcell\fR coordinates. Do not scale or shear the coordinate system (or if you do, restore the transformation matrix before you return)..PPBy default, the painter is not clipped, for maximum efficiency. For safety, call setTableFlags(Tbl_clipCellPainting) to enable clipping..PPSee also paintEvent(), QPainter() and setTableFlags()..PPReimplemented in QMultiLineEdit..SH "void QTableView::paintEvent ( QPaintEvent * e ) \fC[virtual protected]\fR"Handles paint events for the table view..PPCalls paintCell() for the cells that needs to be repainted..PPReimplemented from QWidget..SH "void QTableView::repaint ( int x, int y, int w, int h, bool erase=TRUE )"Repaints the table view directly by calling paintEvent() directly, unless updates are disabled..PPErases the view area \fI(x,y,w,h)\fR if \fIerase\fR is TRUE. Parameters \fI(x,y)\fR are in \fIwidget\fR coordinates..PPIf \fIw\fR is negative, it is replaced with \fCwidth() - x\fR. If \fIh\fR is negative, it is replaced width \fCheight() - y\fR..PPDoing a repaint() usually is faster than doing an update(), but calling update() many times in a row will generate a single paint event..PPAt present, QTableView is the only widget that reimplements repaint(). It does this because by clearing and then repainting one cell at at time, it can make the screen flicker less than it would otherwise..SH "void QTableView::repaint ( bool erase=TRUE )"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPRepaints the entire view..SH "void QTableView::repaint ( const QRect & r, bool erase=TRUE )"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QTableView::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "bool QTableView::rowIsVisible ( int row ) const \fC[protected]\fR"Returns TRUE if \fIrow\fR is at least partially visible..PPSee also colIsVisible()..SH "bool QTableView::rowYPos ( int row, int * yPos ) const \fC[protected]\fR"Computes the position in the widget of row \fIrow.\fR.PPReturns TRUE and stores the result in \fI*yPos\fR (in \fIwidget\fR coordinates) if the row is visible. Returns FALSE and does not modify \fI*yPos\fR if \fIrow\fR is invisible or invalid..PPSee also colXPos() and findRow()..SH "void QTableView::scroll ( int xPixels, int yPixels ) \fC[protected]\fR"Moves the visible area of the table rightwards by \fIxPixels\fR and downwards by \fIyPixels\fR pixels. Both may be negative..PP\fBWarning:\fR You might find that QScrollView offers a higher-level of functionality than using QTableView and this function..PPThis function is \fInot\fR the same as QWidget::scroll(), in particular, the signs of \fIxPixels\fR and \fIyPixels\fR have the reverse semantics..PPSee also setXOffset(), setYOffset(), setOffset(), setTopCell(), setLeftCell() and setTopLeftOffset()..SH "void QTableView::setAutoUpdate ( bool enable ) \fC[virtual protected]\fR"Sets the auto-update option of the table view to \fIenable.\fR.PPIf \fIenable\fR is TRUE (this is the default) then the view updates itself automatically whenever it has changed in some way (for example when a flag is changed)..PPIf \fIenable\fR is FALSE, the view does NOT repaint itself, or update its internal state variables itself when it is changed. This can be useful to avoid flicker during large changes, and is singularly useless otherwise: Disable auto-update, do the changes, re-enable auto-update, and call repaint()..PP\fBWarning:\fR Do not leave the view in this state for a long time (i.e. between events ). If, for example, the user interacts with the view when auto-update is off, strange things can happen..PPSetting auto-update to TRUE does not repaint the view, you must call repaint() to do this..PPSee also autoUpdate() and repaint()..SH "void QTableView::setCellHeight ( int cellHeight ) \fC[virtual protected]\fR"Sets the height in pixels of the table cells to \fIcellHeight.\fR.PPSetting it to zero means that the row height is variable. When set to 0 (this is the default) QTableView calls the virtual function cellHeight() to get the height..PPSee also cellHeight(), setCellWidth(), totalHeight() and numRows()..SH "void QTableView::setCellWidth ( int cellWidth ) \fC[virtual protected]\fR"Sets the width in pixels of the table cells to \fIcellWidth.\fR.PPSetting it to zero means that the column width is variable. When set to 0 (this is the default) QTableView calls the virtual function cellWidth() to get the width..PPSee also cellWidth(), setCellHeight(), totalWidth() and numCols()..SH "void QTableView::setLeftCell ( int col ) \fC[virtual protected]\fR"Scrolls the table such that \fIcol\fR becomes the leftmost column. The index of the very leftmost column is 0..PPSee also setXOffset(), setTopLeftCell() and setTopCell()..SH "void QTableView::setNumCols ( int cols ) \fC[virtual protected]\fR"Sets the number of columns of the table to \fIcols\fR (must be non-negative). Does not change leftCell()..PPThe table repaints itself automatically if autoUpdate() is set..PPSee also numCols(), numRows() and setNumRows()..SH "void QTableView::setNumRows ( int rows ) \fC[virtual protected]\fR"Sets the number of rows of the table to \fIrows\fR (must be non-negative). Does not change topCell()..PPThe table repaints itself automatically if autoUpdate() is set..PPSee also numCols(), setNumCols() and numRows()..SH "void QTableView::setOffset ( int x, int y, bool updateScrBars = TRUE ) \fC[virtual protected]\fR"Scrolls the table such that \fI(x,y)\fR becomes the top left pixel in the view. Parameters \fI(x,y)\fR are in \fItable\fR coordinates..PPThe interaction with Tbl_snapTo*Grid is tricky. If \fIupdateScrBars\fR is TRUE, the scroll bars are updated..PPSee also xOffset(), yOffset(), setXOffset(), setYOffset() and setTopLeftCell()..SH "void QTableView::setPalette ( const QPalette & p ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..SH "void QTableView::setTableFlags ( uint f ) \fC[virtual protected]\fR"Sets the table flags to \fIf.\fR.PPIf a flag setting changes the appearance of the table the table is repainted if and only if autoUpdate() is TRUE..PPThe table flags are mostly single bits, though there are some multibit flags for convenience. Here is a complete list:.IP "Tbl_vScrollBar" 1cThe table has a vertical scroll bar..IP "Tbl_hScrollBar" 1cThe table has a horizontal scroll bar..IP "Tbl_autoVScrollBar" 1cThe table has a vertical scroll bar if and only if the table is taller than the view..IP "Tbl_autoHScrollBar" 1cThe table has a horizontal scroll bar if and only if the table is wider than the view..IP "Tbl_autoScrollBars" 1cThe union of the previous two flags..IP "Tbl_clipCellPainting" 1cThe table uses QPainter::setClipRect() to make sure that paintCell() will not draw outside the cell boundaries..IP "Tbl_cutCellsV" 1cThe table will never show part of a cell at the bottom of the table; if there is not space for all of a cell the space is left blank..IP "Tbl_cutCellsH" 1cThe table will never show part of a cell at the right side of the table; if there is not space for all of a cell the space is left blank..IP "Tbl_cutCells" 1cThe union of the previous two flags..IP "Tbl_scrollLastHCell" 1cWhen the user scrolls horizontally, let him/her scroll the last cell leftward until it is at the left edge of the view. If this flag is not set, the user can only scroll to the point where last cell is completely visible..IP "Tbl_scrollLastVCell" 1cWhen the user scrolls vertically, let him/her scroll the last cell upward until it is at the top edge of the view. If this flag is not set, the user can only scroll to the point where last cell is completely visible..IP "Tbl_scrollLastCell" 1cThe union of the previous two flags..IP "Tbl_smoothHScrolling" 1cThe table scrolls as smoothly as possible when the user scrolls horizontally. When this flag is not set scrolling is done one cell at a time..IP "Tbl_smoothVScrolling" 1cThe table scrolls as smoothly as possible when scrolling vertically. When this flag is not set scrolling is done one cell at a time..IP "Tbl_smoothScrolling" 1cThe union of of previous two flags..IP "Tbl_snapToHGrid" 1cExcept when the user is actually scrolling, the leftmost column shown snaps to the leftmost edge of the view..IP "Tbl_snapToVGrid" 1cExcept when the user is actually scrolling, the top row snaps to the top edge of the view..IP "Tbl_snapToGrid" 1cThe union of the previous two flags..PPYou can specify more than one flag at a time using bitwise OR..PPExample:.PP.nf.br    setTableFlags( Tbl_smoothScrolling | Tbl_autoScrollBars );.fi.PP\fBWarning:\fR The cutCells options (\fCTbl_cutCells, Tbl_cutCellsH\fR and Tbl_cutCellsV) may cause painting problems when scrollbars are enabled. Do not combine cutCells and scrollbars..PPSee also clearTableFlags(), testTableFlags() and tableFlags()..SH "void QTableView::setTopCell ( int row ) \fC[virtual protected]\fR"Scrolls the table such that \fIrow\fR becomes the top row. The index of the very first row is 0..PPSee also setYOffset(), setTopLeftCell() and setLeftCell()..SH "void QTableView::setTopLeftCell ( int row, int col ) \fC[virtual protected]\fR"Scrolls the table such that the cell at row \fIrow\fR and colum \fIcol\fR becomes the top left cell in the view. The cell at the extreme top left of the table is at position (0,0)..PPSee also setLeftCell(), setTopCell() and setOffset()..SH "void QTableView::setXOffset ( int x ) \fC[virtual protected]\fR"Scrolls the table such that \fIx\fR becomes the leftmost pixel in the view. The \fIx\fR parameter is in \fItable\fR coordinates..PPThe interaction with Tbl_snapToHGrid is tricky..PPSee also xOffset(), setYOffset(), setOffset() and setLeftCell()..SH "void QTableView::setYOffset ( int y ) \fC[virtual protected]\fR"Scrolls the table such that \fIy\fR becomes the top pixel in the view. The \fIy\fR parameter is in \fItable\fR coordinates..PPThe interaction with Tbl_snapToVGrid is tricky..PPSee also yOffset(), setXOffset(), setOffset() and setTopCell()..SH "void QTableView::setupPainter ( QPainter * ) \fC[virtual protected]\fR"This virtual function is called before painting of table cells is started. It can be reimplemented by subclasses that want to to set up the painter in a special way and that do not want to do so for each cell..SH "void QTableView::show () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "uint QTableView::tableFlags () const \fC[protected]\fR"Returns the union of the table flags that are currently set..PPSee also setTableFlags(), clearTableFlags() and testTableFlags()..SH "bool QTableView::testTableFlags ( uint f ) const \fC[protected]\fR"Returns TRUE if any of the table flags in \fIf\fR are currently set, otherwise FALSE..PPSee also setTableFlags(), clearTableFlags() and tableFlags()..SH "int QTableView::topCell () const \fC[protected]\fR"Returns the index of the first row in the table that is visible in the view. The index of the very first row is 0..PPSee also leftCell() and setTopCell()..SH "int QTableView::totalHeight () \fC[virtual protected]\fR"Returns the total height of the table in pixels..PPThis function is virtual and should be reimplemented by subclasses that have variable cell heights and a non-trivial cellHeight() function, or a large number of rows in the table..PPThe default implementation may be slow for very tall tables..PPSee also cellHeight() and totalWidth()..SH "int QTableView::totalWidth () \fC[virtual protected]\fR"Returns the total width of the table in pixels..PPThis function is virtual and should be reimplemented by subclasses that have variable cell widths and a non-trivial cellWidth() function, or a large number of columns in the table..PPThe default implementation may be slow for very wide tables..PPSee also cellWidth() and totalHeight()..SH "void QTableView::updateCell ( int row, int col, bool erase=TRUE ) \fC[protected]\fR"Repaints the cell at row \fIrow,\fR column \fIcol\fR if it is inside the view..PPIf \fIerase\fR is TRUE, the relevant part of the view is cleared to the background color/pixmap before the contents are repainted..PPSee also isVisible()..SH "void QTableView::updateScrollBars () \fC[protected]\fR"Updates the scroll bars' contents and presence to match the table's state. Generally you should not need to call this..PPSee also setTableFlags()..SH "void QTableView::updateTableSize () \fC[protected]\fR"Updates the scroll bars and internal state..PPCall this function when the table view's total size is changed; typically because the result of cellHeight() or cellWidth() have changed..PPThis function does not repaint the widget..SH "QScrollBar * QTableView::verticalScrollBar () const \fC[protected]\fR"Returns a pointer to the vertical scroll bar, mainly so you can connect() to its signals. Note that the scroll bar works in pixel values, use findRow() to translate to cell numbers..SH "int QTableView::viewHeight () const \fC[protected]\fR"Returns the height of the table view, as such, in \fIview\fR coordinates. This does not include any header, scroll bar or frame, but does include background pixels below the table data..PPSee also minViewY(), maxViewY(), viewWidth(), contentsRect() and viewRect()..SH "QRect QTableView::viewRect () const \fC[protected]\fR"Returns the rectangle which is the actual table, excluding any frame, in \fIwidget\fR coordinates..SH "int QTableView::viewWidth () const \fC[protected]\fR"Returns the width of the table view, as such, in \fIview\fR coordinates. This does not include any header, scroll bar or frame, but does include background pixels to the right of the table data..PPSee also minViewX(), maxViewX(), viewHeight(), contentsRect() and viewRect()..SH "int QTableView::xOffset () const \fC[protected]\fR"Returns the x coordinate in \fItable\fR coordinates of the pixel which is currently on the left edge of the view..PPSee also setXOffset(), yOffset() and leftCell()..SH "int QTableView::yOffset () const \fC[protected]\fR"Returns the y coordinate in \fItable\fR coordinates of the pixel which is currently on the top edge of the view..PPSee also setYOffset(), xOffset() and topCell()..SH "void QTableView::setBackgroundColor ( const QColor & c ) \fC[virtual]\fR"For internal use only..SH "SEE ALSO".BR http://doc.trolltech.com/qtableview.html.SH COPYRIGHTCopyright 1992-2000 Trolltech AS, http://www.trolltech.com/.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

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