Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QCheckListItem Class Reference

The QCheckListItem class provides checkable list view items. More...

#include <QCheckListItem>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits Q3ListViewItem.

Public Types

Public Functions

Protected Functions


Detailed Description

The QCheckListItem class provides checkable list view items.

QCheckListItems are used in Q3ListViews to provide Q3ListViewItems that are checkboxes, radio buttons or controllers.

Checkbox and controller check list items may be inserted at any level in a list view. Radio button check list items must be children of a controller check list item.

The item can be checked or unchecked with setOn(). Its type can be retrieved with type() and its text retrieved with text().

List View Items

See also Q3ListViewItem and Q3ListView.


Member Type Documentation

enum QCheckListItem::ToggleState

This enum specifies a QCheckListItem's toggle state.

QCheckListItem::Off 
QCheckListItem::NoChange 
QCheckListItem::On 

enum QCheckListItem::Type

This enum type specifies a QCheckListItem's type:

QCheckListItem::RadioButton 
QCheckListItem::CheckBox 
QCheckListItem::RadioButtonController 
QCheckListItem::CheckBoxController

Member Function Documentation

QCheckListItem::QCheckListItem ( QCheckListItem * parent, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, text text and of type tt. Note that a RadioButton must be the child of a RadioButtonController, otherwise it will not toggle.

QCheckListItem::QCheckListItem ( QCheckListItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, which is after after in the parent's list of children, and with text text and of type tt. Note that a RadioButton must be the child of a RadioButtonController, otherwise it will not toggle.

QCheckListItem::QCheckListItem ( Q3ListViewItem * parent, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, text text and of type tt. Note that this item must not be a RadioButton. Radio buttons must be children of a RadioButtonController.

QCheckListItem::QCheckListItem ( Q3ListViewItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, which is after after in the parent's list of children, with text text and of type tt. Note that this item must not be a RadioButton. Radio buttons must be children of a RadioButtonController.

QCheckListItem::QCheckListItem ( Q3ListView * parent, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, text text and of type tt. Note that tt must not be RadioButton. Radio buttons must be children of a RadioButtonController.

QCheckListItem::QCheckListItem ( Q3ListView * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, which is after after in the parent's list of children, with text text and of type tt. Note that tt must not be RadioButton. Radio buttons must be children of a RadioButtonController.

QCheckListItem::QCheckListItem ( Q3ListViewItem * parent, const QString & text, const QPixmap & p )

Constructs a RadioButtonController item with parent parent, text text and pixmap p.

QCheckListItem::QCheckListItem ( Q3ListView * parent, const QString & text, const QPixmap & p )

Constructs a RadioButtonController item with parent parent, text text and pixmap p.

QCheckListItem::~QCheckListItem ()

Destroys the item, and all its children to any depth, freeing up all allocated resources.

void QCheckListItem::activate ()   [virtual protected]

Toggle check box or set radio button to on.

Reimplemented from Q3ListViewItem.

bool QCheckListItem::isOn () const

Returns true if the item is toggled on; otherwise returns false.

bool QCheckListItem::isTristate () const

Returns true if the item is tristate; otherwise returns false.

See also setTristate().

void QCheckListItem::paintCell ( QPainter * p, const QPalette & pal, int column, int width, int align )   [virtual]

Paints the item using the painter p and the color group pal. The item is in column column, has width width and has alignment align. (See Qt::Alignment for valid alignments.)

Reimplemented from Q3ListViewItem.

void QCheckListItem::paintFocus ( QPainter * p, const QPalette & pal, const QRect & r )   [virtual]

Draws the focus rectangle r using the color group pal on the painter p.

Reimplemented from Q3ListViewItem.

int QCheckListItem::rtti () const   [virtual]

Returns 1.

Make your derived classes return their own values for rtti(), and you can distinguish between list view items. You should use values greater than 1000, to allow for extensions to this class.

Reimplemented from Q3ListViewItem.

void QCheckListItem::setOn ( bool b )   [virtual]

Sets the button on if b is true, otherwise sets it off. Maintains radio button exclusivity.

void QCheckListItem::setState ( ToggleState s )

Sets the toggle state of the checklistitem to s. s can be Off, NoChange or On.

Tristate can only be enabled for CheckBox or CheckBoxController, therefore the NoChange only applies to them.

Setting the state to On or Off on a CheckBoxController will recursivly set the states of its children to the same state.

Setting the state to NoChange on a CheckBoxController will make it recursivly recall the previous stored state of its children. If there was no previous stored state the children are all set to On.

void QCheckListItem::setTristate ( bool b )

Sets tristate to b if the Type is either a CheckBoxController or a CheckBox.

CheckBoxControllers are tristate by default.

See also state() and isTristate().

ToggleState QCheckListItem::state () const

Returns the state of the item.

See also QCheckListItem::ToggleState.

void QCheckListItem::stateChange ( bool b )   [virtual protected]

This virtual function is called when the item changes its state. b is true if the state is On; otherwise the state is Off. NoChange (if tristate is enabled and the type is either CheckBox or CheckBoxController) reports the same as Off, so use state() to determine if the state is actually Off or NoChange.

QString QCheckListItem::text () const

Returns the item's text.

void QCheckListItem::turnOffChild ()   [protected]

If this is a RadioButtonController that has RadioButton children, turn off the child that is on.

Type QCheckListItem::type () const

Returns the type of this item.


Copyright © 2004 Trolltech. Trademarks
Qt 4.0.0-tp2