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

📄 qtableitem.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.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        QObject::connect( cb, SIGNAL( activated( int ) ), table(), SLOT( doValueChanged() ) );.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.PP.nf.br    p->setClipRect( table()->cellRect(row, col), QPainter::ClipPainter );.br    //... your drawing code.br    p->setClipping( FALSE );.br.fi.PPExample: table/statistics/statistics.cpp..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..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()..PPExample: table/statistics/statistics.cpp..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(). This function also checks to make sure if \fIrs\fR and \fIcs\fR are within the bounds of the table and returns without changing the span if they are not. In addition swapping, inserting or removing rows and columns that cross QTableItems spanning more than one cell is not supported..PPSee also rowSpan() and colSpan()..SH "void QTableItem::setText ( const QString & str )\fC [virtual]\fR"Changes the table item's text 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()..PPExample: table/statistics/statistics.cpp..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"Returns the text of the table item or QString::null if there is no text..PPTo ensure that the current value of the editor is returned, setContentFromEditor() is called: <ol type=1>.TPif the editMode() is Always, or.TPif editMode() is \fInot\fR Always but the editor of the cell is active and the editor is not a QLineEdit..PPThis means that text() returns the original text value of the item if the editor is a line edit, until the user commits an edit (e.g. by pressing Enter or Tab) in which case the new text is returned. For other editors (e.g. a combobox) setContentFromEditor() is always called so the currently display value is the one returned..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.1.1).

⌨️ 快捷键说明

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