You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqcombotableitem.3qt

157 lines
6.4 KiB

'\" t
.TH QComboTableItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QComboTableItem \- Means of using comboboxes in QTables
.SH SYNOPSIS
\fC#include <ntqtable.h>\fR
.PP
Inherits QTableItem.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQComboTableItem\fR ( QTable * table, const QStringList & list, bool editable = FALSE )"
.br
.ti -1c
.BI "\fB~QComboTableItem\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetCurrentItem\fR ( int i )"
.br
.ti -1c
.BI "virtual void \fBsetCurrentItem\fR ( const QString & s )"
.br
.ti -1c
.BI "int \fBcurrentItem\fR () const"
.br
.ti -1c
.BI "QString \fBcurrentText\fR () const"
.br
.ti -1c
.BI "int \fBcount\fR () const"
.br
.ti -1c
.BI "QString \fBtext\fR ( int i ) const"
.br
.ti -1c
.BI "virtual void \fBsetEditable\fR ( bool b )"
.br
.ti -1c
.BI "bool \fBisEditable\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetStringList\fR ( const QStringList & l )"
.br
.ti -1c
.BI "virtual int \fBrtti\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QComboTableItem class provides a means of using comboboxes in QTables.
.PP
A QComboTableItem is a table item which looks and behaves like a combobox. The advantage of using QComboTableItems rather than real comboboxes is that a QComboTableItem uses far less resources than real comboboxes in QTables. When the cell has the focus it displays a real combobox which the user can interact with. When the cell does not have the focus the cell \fIlooks\fR like a combobox. Only text items (i.e. no pixmaps) may be used in QComboTableItems.
.PP
QComboTableItem items have the edit type WhenCurrent (see EditType). The QComboTableItem's list of items is provided by a QStringList passed to the constructor.
.PP
The list of items may be changed using setStringList(). The current item can be set with setCurrentItem() and retrieved with currentItem(). The text of the current item can be obtained with currentText(), and the text of a particular item can be retrieved with text().
.PP
If isEditable() is TRUE the QComboTableItem will permit the user to either choose an existing list item, or create a new list item by entering their own text; otherwise the user may only choose one of the existing list items.
.PP
To populate a table cell with a QComboTableItem use QTable::setItem().
.PP
QComboTableItems may be deleted with QTable::clearCell().
.PP
QComboTableItems can be distinguished from QTableItems and QCheckTableItems using their Run Time Type Identification number (see rtti()).
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
See also QCheckTableItem, QTableItem, QComboBox, and Advanced Widgets.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QComboTableItem::QComboTableItem ( QTable * table, const QStringList & list, bool editable = FALSE )"
Creates a combo table item for the table \fItable\fR. The combobox's list of items is passed in the \fIlist\fR argument. If \fIeditable\fR is TRUE the user may type in new list items; if \fIeditable\fR is FALSE the user may only select from the list of items provided.
.PP
By default QComboTableItems cannot be replaced by other table items since isReplaceable() returns FALSE by default.
.PP
See also QTable::clearCell() and EditType.
.SH "QComboTableItem::~QComboTableItem ()"
QComboTableItem destructor.
.SH "int QComboTableItem::count () const"
Returns the total number of list items in the combo table item.
.SH "int QComboTableItem::currentItem () const"
Returns the index of the combo table item's current list item.
.PP
See also setCurrentItem().
.SH "QString QComboTableItem::currentText () const"
Returns the text of the combo table item's current list item.
.PP
See also currentItem() and text().
.SH "bool QComboTableItem::isEditable () const"
Returns TRUE if the user can add their own list items to the combobox's list of items; otherwise returns FALSE.
.PP
See also setEditable().
.SH "int QComboTableItem::rtti () const\fC [virtual]\fR"
Returns 1.
.PP
Make your derived classes return their own values for rtti()to distinguish between different table item subclasses. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class.
.PP
See also QTableItem::rtti().
.PP
Reimplemented from QTableItem.
.SH "void QComboTableItem::setCurrentItem ( int i )\fC [virtual]\fR"
Sets the list item \fIi\fR to be the combo table item's current list item.
.PP
See also currentItem().
.PP
Example: table/small-table-demo/main.cpp.
.SH "void QComboTableItem::setCurrentItem ( const QString & s )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the list item whose text is \fIs\fR to be the combo table item's current list item. Does nothing if no list item has the text \fIs\fR.
.PP
See also currentItem().
.SH "void QComboTableItem::setEditable ( bool b )\fC [virtual]\fR"
If \fIb\fR is TRUE the combo table item can be edited, i.e. the user may enter a new text item themselves. If \fIb\fR is FALSE the user may may only choose one of the existing items.
.PP
See also isEditable().
.SH "void QComboTableItem::setStringList ( const QStringList & l )\fC [virtual]\fR"
Sets the list items of this QComboTableItem to the strings in the string list \fIl\fR.
.SH "QString QComboTableItem::text ( int i ) const"
Returns the text of the combo's list item at index \fIi\fR.
.PP
See also currentText().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qcombotableitem.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If 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.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqcombotableitem.3qt) and the Qt
version (3.3.8).