
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3CheckListItem class provides checkable list view items.More...
| Header: | #include <Q3CheckListItem> |
| Inherits: | Q3ListViewItem |
| enum | ToggleState { Off, NoChange, On } |
| enum | Type { RadioButton, CheckBox, RadioButtonController, CheckBoxController } |
| Q3CheckListItem(Q3CheckListItem * parent, const QString & text, Type tt = RadioButtonController) | |
| Q3CheckListItem(Q3CheckListItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController) | |
| Q3CheckListItem(Q3ListViewItem * parent, const QString & text, Type tt = RadioButtonController) | |
| Q3CheckListItem(Q3ListViewItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController) | |
| Q3CheckListItem(Q3ListView * parent, const QString & text, Type tt = RadioButtonController) | |
| Q3CheckListItem(Q3ListView * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController) | |
| Q3CheckListItem(Q3ListViewItem * parent, const QString & text, const QPixmap & p) | |
| Q3CheckListItem(Q3ListView * parent, const QString & text, const QPixmap & p) | |
| ~Q3CheckListItem() | |
| bool | isOn() const |
| bool | isTristate() const |
| virtual void | setOn(bool b) |
| void | setState(ToggleState s) |
| void | setTristate(bool b) |
| ToggleState | state() const |
| QString | text() const |
| Type | type() const |
| virtual void | paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align) |
| virtual void | paintFocus(QPainter * p, const QColorGroup & cg, const QRect & r) |
| virtual int | rtti() const |
| virtual void | setup() |
| virtual QString | text(int n) const |
| virtual int | width(const QFontMetrics & fm, const Q3ListView * lv, int column) const |
| virtual void | stateChange(bool b) |
| void | turnOffChild() |
| virtual void | activate() |
TheQ3CheckListItem class provides checkable list view items.
Q3CheckListItems are used inQ3ListViews to provideQ3ListViewItems 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 withsetOn(). Its type can be retrieved withtype() and its text retrieved withtext().

See alsoQ3ListViewItem andQ3ListView.
This enum specifies aQ3CheckListItem's toggle state.
| Constant | Value |
|---|---|
Q3CheckListItem::Off | 0 |
Q3CheckListItem::NoChange | 1 |
Q3CheckListItem::On | 2 |
This enum type specifies aQ3CheckListItem's type:
| Constant | Value |
|---|---|
Q3CheckListItem::RadioButton | 0 |
Q3CheckListItem::CheckBox | 1 |
Q3CheckListItem::RadioButtonController | Controller |
Q3CheckListItem::CheckBoxController | ? |
Constructs a checkable item with parentparent, texttext and of typett. Note that aRadioButton must be the child of aRadioButtonController, otherwise it will not toggle.
Constructs a checkable item with parentparent, which is afterafter in the parent's list of children, and with texttext and of typett. Note that aRadioButton must be the child of aRadioButtonController, otherwise it will not toggle.
Constructs a checkable item with parentparent, texttext and of typett. Note that this item mustnot be aRadioButton. Radio buttons must be children of aRadioButtonController.
Constructs a checkable item with parentparent, which is afterafter in the parent's list of children, with texttext and of typett. Note that this item mustnot be aRadioButton. Radio buttons must be children of aRadioButtonController.
Constructs a checkable item with parentparent, texttext and of typett. Note thattt mustnot beRadioButton. Radio buttons must be children of aRadioButtonController.
Constructs a checkable item with parentparent, which is afterafter in the parent's list of children, with texttext and of typett. Note thattt mustnot beRadioButton. Radio buttons must be children of aRadioButtonController.
Constructs aRadioButtonController item with parentparent, texttext and pixmapp.
Constructs aRadioButtonController item with parentparent, texttext and pixmapp.
Destroys the item, and all its children to any depth, freeing up all allocated resources.
[virtual protected]void Q3CheckListItem::activate()Reimplemented fromQ3ListViewItem::activate().
Toggle check box or set radio button to on.
Returns true if the item is toggled on; otherwise returns false.
Returns true if the item is tristate; otherwise returns false.
See alsosetTristate().
[virtual]void Q3CheckListItem::paintCell(QPainter * p, constQColorGroup & cg,int column,int width,int align)Reimplemented fromQ3ListViewItem::paintCell().
Paints the item using the painterp and the color groupcg. The item is in columncolumn, has widthwidth and has alignmentalign. (SeeQt::Alignment for valid alignments.)
[virtual]void Q3CheckListItem::paintFocus(QPainter * p, constQColorGroup & cg, constQRect & r)Reimplemented fromQ3ListViewItem::paintFocus().
Draws the focus rectangler using the color groupcg on the painterp.
[virtual]int Q3CheckListItem::rtti() constReimplemented fromQ3ListViewItem::rtti().
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.
[virtual]void Q3CheckListItem::setOn(bool b)Sets the button on ifb is true, otherwise sets it off. Maintains radio button exclusivity.
See alsoisOn().
Sets the toggle state of the checklistitem tos.s can beOff,NoChange orOn.
Tristate can only be enabled forCheckBox orCheckBoxController, therefore theNoChange only applies to them.
Setting the state toOn orOff on aCheckBoxController will recursivly set the states of its children to the same state.
Setting the state toNoChange on aCheckBoxController will make it recursivly recall the previous stored state of its children. If there was no previous stored state the children are all set toOn.
See alsostate().
Sets tristate tob if theType is either aCheckBoxController or aCheckBox.
CheckBoxControllers are tristate by default.
See alsostate() andisTristate().
[virtual]void Q3CheckListItem::setup()Reimplemented fromQ3ListViewItem::setup().
Returns the state of the item.
See alsosetState() andQ3CheckListItem::ToggleState.
[virtual protected]void Q3CheckListItem::stateChange(bool b)This virtual function is called when the item changes its state.b is true if the state isOn; otherwise the state isOff.NoChange (if tristate is enabled and the type is eitherCheckBox orCheckBoxController) reports the same asOff, so usestate() to determine if the state is actuallyOff orNoChange.
Returns the item's text.
[virtual]QString Q3CheckListItem::text(int n) constReimplemented fromQ3ListViewItem::text().
[protected]void Q3CheckListItem::turnOffChild()If this is aRadioButtonController that hasRadioButton children, turn off the child that is on.
Returns the type of this item.
[virtual]int Q3CheckListItem::width(constQFontMetrics & fm, constQ3ListView * lv,int column) constReimplemented fromQ3ListViewItem::width().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.