Eneboo - Documentación para desarrolladores
Métodos públicos | Atributos públicos estáticos
Referencia de la Clase QCheckTableItem

The QCheckTableItem class provides checkboxes in QTables.table. Más...

#include <qtable.h>

Diagrama de herencias de QCheckTableItem
QTableItem QTableItem Qt Qt Qt Qt

Lista de todos los miembros.

Métodos públicos

 QCheckTableItem (QTable *table, const QString &txt)
void setText (const QString &t)
virtual QWidgetcreateEditor () const
virtual void setContentFromEditor (QWidget *w)
virtual void paint (QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected)
virtual void setChecked (bool b)
bool isChecked () const
int rtti () const
QSize sizeHint () const
 QCheckTableItem (QTable *table, const QString &txt)
void setText (const QString &t)
virtual QWidgetcreateEditor () const
virtual void setContentFromEditor (QWidget *w)
virtual void paint (QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected)
virtual void setChecked (bool b)
bool isChecked () const
int rtti () const
QSize sizeHint () const

Atributos públicos estáticos

static int RTTI = 2

Descripción detallada

The QCheckTableItem class provides checkboxes in QTables.

table.

A QCheckTableItem is a table item which looks and behaves like a checkbox. The advantage of using QCheckTableItems rather than real checkboxes is that a QCheckTableItem uses far less resources than a real checkbox would in a {QTable}. When the cell has the focus it displays a real checkbox which the user can interact with. When the cell does not have the focus the cell looks like a checkbox. Pixmaps may not be used in QCheckTableItems.

QCheckTableItem items have the edit type WhenCurrent (see {EditType}).

To change the checkbox's label use setText(). The checkbox can be checked and unchecked with setChecked() and its state retrieved using isChecked().

To populate a table cell with a QCheckTableItem use QTable::setItem().

QCheckTableItems can be distinguished from {QTableItem}s and {QComboTableItem}s using their Run Time Type Identification (rtti) value.

qtableitems.png Table Items

Ver también:
rtti() EditType QComboTableItem QTableItem QCheckBox

Documentación del constructor y destructor

QCheckTableItem::QCheckTableItem ( QTable table,
const QString txt 
)

Creates a QCheckTableItem with an {EditType} of WhenCurrent as a child of table. The checkbox is initially unchecked and its label is set to the string txt.

QCheckTableItem::QCheckTableItem ( QTable table,
const QString txt 
)

Documentación de las funciones miembro

QWidget * QCheckTableItem::createEditor ( ) const [virtual]

Reimplementado de QTableItem.

virtual QWidget* QCheckTableItem::createEditor ( ) const [virtual]

This virtual function creates an editor which the user can interact with to edit the cell's contents. The default implementation creates a QLineEdit.

If the function returns 0, the cell is read-only.

The returned widget should preferably be invisible, ideally with QTable::viewport() as parent.

If you reimplement this function you'll almost certainly need to reimplement setContentFromEditor(), and may need to reimplement sizeHint().

table/statistics/statistics.cpp createEditor }

Ver también:
QTable::createEditor() setContentFromEditor() QTable::viewport() setReplaceable()

Reimplementado de QTableItem.

bool QCheckTableItem::isChecked ( ) const

Returns TRUE if the checkbox table item is checked; otherwise returns FALSE.

Ver también:
setChecked()
bool QCheckTableItem::isChecked ( ) const
void QCheckTableItem::paint ( QPainter p,
const QColorGroup cg,
const QRect cr,
bool  selected 
) [virtual]

Reimplementado de QTableItem.

virtual void QCheckTableItem::paint ( QPainter p,
const QColorGroup cg,
const QRect cr,
bool  selected 
) [virtual]

This virtual function is used to paint the contents of an item using the painter p in the rectangular area cr using the color group cg.

If selected is TRUE the cell is displayed in a way that indicates that it is highlighted.

You 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.

The painter passed to this function is translated so that 0, 0 is the top-left corner of the item that is being painted.

Note that the painter is not clipped by default in order to get maximum efficiency. If you want clipping, use

    p->setClipRect( table()->cellRect(row, col), QPainter::ClipPainter );
    //... your drawing code
    p->setClipping( FALSE );

Reimplementado de QTableItem.

int QCheckTableItem::rtti ( ) const [virtual]

Returns 2.

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.

Ver también:
QTableItem::rtti()

Reimplementado de QTableItem.

int QCheckTableItem::rtti ( ) const [virtual]

Returns the Run Time Type Identification value for this table item which for QTableItems is 0.

When 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.

Ver también:
QCheckTableItem::rtti() QComboTableItem::rtti()

Reimplementado de QTableItem.

virtual void QCheckTableItem::setChecked ( bool  b) [virtual]
void QCheckTableItem::setChecked ( bool  b) [virtual]

If b is TRUE the checkbox is checked; if b is FALSE the checkbox is unchecked.

Ver también:
isChecked()
virtual void QCheckTableItem::setContentFromEditor ( QWidget w) [virtual]

Whenever the content of a cell has been edited by the editor w, QTable calls this virtual function to copy the new values into the QTableItem.

If you reimplement createEditor() and return something that is not a QLineEdit you will need to reimplement this function.

table/statistics/statistics.cpp setContentFromEditor }

Ver también:
QTable::setCellContentFromEditor()

Reimplementado de QTableItem.

void QCheckTableItem::setContentFromEditor ( QWidget w) [virtual]

Reimplementado de QTableItem.

void QCheckTableItem::setText ( const QString str) [virtual]

Changes the table item's text to str.

Note that setText() does not update the cell the table item belongs to. Use QTable::updateCell() to repaint the cell's contents.

Ver también:
QTable::setText() text() setPixmap() QTable::updateCell()

Reimplementado de QTableItem.

void QCheckTableItem::setText ( const QString t) [virtual]

Reimplementado de QTableItem.

QSize QCheckTableItem::sizeHint ( ) const [virtual]

This virtual function returns the size a cell needs to show its entire content.

If you subclass QTableItem you will often need to reimplement this function.

Reimplementado de QTableItem.

QSize QCheckTableItem::sizeHint ( ) const [virtual]

Reimplementado de QTableItem.


Documentación de los datos miembro

static int QCheckTableItem::RTTI = 2 [static]

Reimplementado de QTableItem.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'