![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QCheckTableItem class provides checkboxes in QTables. More...
#include <qtable.h>
Inherits QTableItem.
The QCheckTableItem class provides checkboxes in QTables.
To fill a table cell with a checkbox instead of the usual text or pixmap create a QCheckTableItem object and use QTable::setItem() to make it the contents of a table cell.
The QCheckTableItem is not a real checkbox, but paints itself to look like one. When the focus is in the QCheckTableItem cell a checkbox that the user can interact with is displayed. The QCheckTableItem provides the appearance and functionality of a checkbox but without the overhead of every cell actually being a checkbox.
QCheckTableItems have the edit type WhenCurrent. To change the checkbox's label use setText(). The checkbox can be checked and unchecked with setChecked() and its state retrieved using isChecked(). Check box items cannot include a pixmap.
QCheckTableItems can be distinguished from QTableItems and QComboTableItems using their Run Time Type Identification (rtti) number.
QTable table( numRows, numCols );
table.setItem( j, 1, new QCheckTableItem( &table, "Check me" ) );
(Code taken from table/small-table-demo/main.cpp).
By default QCheckTableItem objects are unchecked. To check them use setChecked(). The text can be changed using setText().
QTable::setItem() makes checkbox items the contents of a QTable that may or may not be the item's parent. It is not possible to use a QCheckTableItem in more than one table at a time.
See also setChecked().
Returns 2.
Make your derived classes return their own values for rtti(), and you can distinguish between table items. You should use values greater than 1000 preferably a large random number, to allow for extensions to this class.
See also QTableItem::rtti().
Reimplemented from QTableItem.
See also isChecked().
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
|