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

📄 qtableitem.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.SH "QWidget * QTableItem::createEditor () const\fC [virtual]\fR"This virtual function creates an editor which the user can interact with to edit the cell's contents. The default implementation creates a QLineEdit..PPIf the function returns 0, the cell is read-only..PPThe returned widget should preferably be invisible, ideally with QTable::viewport() as parent..PPIf you reimplement this function you'll almost certainly need to reimplement setContentFromEditor(), and may need to reimplement sizeHint()..PP.nf.br    QWidget *ComboItem::createEditor() const.br    {.br        // create an editor - a combobox in our case.br        ( (ComboItem*)this )->cb = new QComboBox( table()->viewport() );.br        cb->insertItem( "Yes" );.br        cb->insertItem( "No" );.br        // and initialize it.br        cb->setCurrentItem( text() == "No" ? 1 : 0 );.br        return cb;.fi.PPSee also QTable::createEditor(), setContentFromEditor() and QTable::viewport()..PPExample: table/statistics/statistics.cpp..SH "EditType QTableItem::editType () const"Returns the table item's edit type..PPThis is set when the table item is constructed..PPSee also EditType and QTableItem()..SH "bool QTableItem::isEnabled () const"Returns TRUE if the table item is enabled; otherwise returns FALSE..PPSee also setEnabled()..SH "bool QTableItem::isReplaceable () const"This function returns whether the contents of the cell may be replaced with the contents of another table item. Regardless of this setting, table items that span more than one cell may not have their contents replaced by another table item..PP(This differs from EditType because EditType is concerned with whether the \fIuser\fR is able to change the contents of a cell.).PPSee also setReplaceable() and EditType..SH "QString QTableItem::key () const\fC [virtual]\fR"This virtual function returns the key that should be used for sorting. The default implementation returns the text() of the relevant item..PPSee also QTable::sorting..SH "void QTableItem::paint ( QPainter * p, const QColorGroup & cg, const QRect & cr, bool selected )\fC [virtual]\fR"This virtual function is used to paint the contents of an item using the painter \fIp\fR in the rectangular area \fIcr\fR using the color group \fIcg\fR..PPIf \fIselected\fR is TRUE the cell is displayed in a way that indicates that it is highlighted..PPYou don't usually need to use this function but if you want to draw custom content in a cell you will need to reimplement it..PPNote that the painter is not clipped by default in order to get maximum efficiency. If you want clipping, use.SH "QPixmap QTableItem::pixmap () const\fC [virtual]\fR"Returns the table item's pixmap or a null pixmap if no pixmap has been set..PPSee also setPixmap() and text()..SH "int QTableItem::row () const"Returns the row where the table item is located. If the cell spans multiple rows, this function returns the top-most row..PPSee also col() and setRow()..SH "int QTableItem::rowSpan () const"Returns the row span of the table item, usually 1..PPSee also setSpan() and colSpan()..SH "int QTableItem::rtti () const\fC [virtual]\fR"Returns the Run Time Type Identification value for this table item which for QTableItems is 0..PPAlthough often frowned upon by purists, Run Time Type Identification is very useful for QTables as it allows for an efficient indexed storage mechanism..PPWhen you create subclasses based on QTableItem make sure that each subclass returns a unique rtti() value. It is advisable to use values greater than 1000, preferably large random numbers, to allow for extensions to this class..PPSee also QCheckTableItem::rtti() and QComboTableItem::rtti()..PPReimplemented in QComboTableItem and QCheckTableItem..SH "void QTableItem::setCol ( int c )\fC [virtual]\fR"Sets column \fIc\fR as the table item's column. Usually you will not need to call this function..PPIf the cell spans multiple columns, this function sets the left-most column and retains the width of the multi-cell table item..PPSee also col(), setRow() and colSpan()..SH "void QTableItem::setContentFromEditor ( QWidget * w )\fC [virtual]\fR"Whenever the content of a cell has been edited by the editor \fIw\fR, QTable calls this virtual function to copy the new values into the QTableItem..PPIf you reimplement createEditor() and return something that is not a QLineEdit you will almost certainly have to reimplement this function..PP.nf.br    void ComboItem::setContentFromEditor( QWidget *w ).br    {.br        // the user changed the value of the combobox, so synchronize the.br        // value of the item (its text), with the value of the combobox.br        if ( w->inherits( "QComboBox" ) ).br            setText( ( (QComboBox*)w )->currentText() );.br        else.br            QTableItem::setContentFromEditor( w );.fi.PPSee also QTable::setCellContentFromEditor()..SH "void QTableItem::setEnabled ( bool b )\fC [virtual]\fR"If \fIb\fR is TRUE, the table item is enabled; if \fIb\fR is FALSE the table item is disabled..PPA disabled item doesn't respond to user interaction..PPSee also isEnabled()..SH "void QTableItem::setPixmap ( const QPixmap & p )\fC [virtual]\fR"Sets pixmap \fIp\fR to be this item's pixmap..PPNote that setPixmap() does not update the cell the table item belongs to. Use QTable::updateCell() to repaint the cell's contents..PPFor QComboTableItems and QCheckTableItems this function has no visible effect..PPSee also QTable::setPixmap(), pixmap() and setText()..SH "void QTableItem::setReplaceable ( bool b )\fC [virtual]\fR"If \fIb\fR is TRUE it is acceptable to replace the contents of the cell with the contents of another QTableItem. If \fIb\fR is FALSE the contents of the cell may not be replaced by the contents of another table item. Table items that span more than one cell may not have their contents replaced by another table item..PP(This differs from EditType because EditType is concerned with whether the \fIuser\fR is able to change the contents of a cell.).PPSee also isReplaceable()..SH "void QTableItem::setRow ( int r )\fC [virtual]\fR"Sets row \fIr\fR as the table item's row. Usually you do not need to call this function..PPIf the cell spans multiple rows, this function sets the top row and retains the height of the multi-cell table item..PPSee also row(), setCol() and rowSpan()..SH "void QTableItem::setSpan ( int rs, int cs )\fC [virtual]\fR"Changes the extent of the QTableItem so that it spans multiple cells covering \fIrs\fR rows and \fIcs\fR columns. The top left cell is the original cell..PP\fBWarning:\fR This function only works, if the item has already been inserted into the table using e.g. QTable::setItem()..PPSee also rowSpan() and colSpan()..SH "void QTableItem::setText ( const QString & str )\fC [virtual]\fR"Changes the text of the table item to \fIstr\fR..PPNote that setText() does not update the cell the table item belongs to. Use QTable::updateCell() to repaint the cell's contents..PPSee also QTable::setText(), text(), setPixmap() and QTable::updateCell()..SH "void QTableItem::setWordWrap ( bool b )\fC [virtual]\fR"If \fIb\fR is TRUE, the cell's text will be wrapped over multiple lines, when necessary, to fit the width of the cell; otherwise the text will be written as a single line..PPSee also wordWrap(), QTable::adjustColumn() and QTable::setColumnStretchable()..SH "QSize QTableItem::sizeHint () const\fC [virtual]\fR"This virtual function returns the size a cell needs to show its entire content..PPIf you subclass QTableItem you will often need to reimplement this function..SH "QTable * QTableItem::table () const"Returns the QTable the table item belongs to..PPSee also QTable::setItem() and QTableItem()..SH "QString QTableItem::text () const\fC [virtual]\fR"Provides the text of the table item or a null string if there's no text..PPSee also setText() and pixmap()..SH "bool QTableItem::wordWrap () const"Returns TRUE if word wrap is enabled for the cell; otherwise returns FALSE..PPSee also setWordWrap()..SH "SEE ALSO".BR http://doc.trolltech.com/qtableitem.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 help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtableitem.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

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