![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QComboTableItem class provides a means of using comboboxes in QTables. More...
#include <qtable.h>
Inherits QTableItem.
The QComboTableItem class provides a means of using comboboxes in QTables.
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 a real combobox. 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 looks like a combobox. Only strings (i.e. no pixmaps) may be used in QComboTableItems.
QComboTableItem items have the edit type WhenCurrent (see EditType). The QComboTableItem's list of items is provided by a QStringList passed to the constructor. The list of items can be changed later with setStringList().
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(). The QComboTableItem can accept user input if it isEditable() -- see setEditable().
To populate a table cell with a QComboTableItem use QTable::setItem():
QStringList currencylist;
currencies = new QComboTableItem( this, currencylist ); setItem( 0, 1, currencies );
(Code taken from table/euroconversion/converter.cpp )
A combobox item is deleted like any other QTableItem using QTable::clearCell().
QComboTableItems can be distinguished from QTableItems and QCheckTableItems using their Run Time Type Identification number (see rtti()).
To use a combobox item as content for a QTable cell use QTable::setItem(), e.g.:
QTable table( numRows, numCols );
QStringList comboEntries;
for ( int i = 0; i < numRows; ++i ){ QComboTableItem * item = new QComboTableItem( &table, comboEntries, TRUE );
table.setItem( i, 5, item ); }
(Code taken from table/small-table-demo/main.cpp).
Like regular QTableItems, a combobox table item might be used in a QTable which is not its parent. A QComboTableItems may not be used in more than one QTable at a time.
By default QComboTableItems cannot be replaced by other items as they return FALSE for isReplaceable().
See also QTable::clearCell() and EditType.
See also setCurrentItem().
Example: table/euroconversion/converter.cpp.
See also currentItem() and text().
See also setEditable().
For QComboTableItems this function returns a Run Time Identification number of 1.
See also QTableItem::rtti().
Reimplemented from QTableItem.
See also currentItem().
Example: table/small-table-demo/main.cpp.
Makes the combobox item whose text is s the current item.
Does nothing if the text is not found.
See also currentItem().
See also isEditable().
See also currentText().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version main-beta1
|