Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

  • Qt 4.8
  • Qt3SupportLight
  • Q3CheckListItem

Q3CheckListItem Class

TheQ3CheckListItem class provides checkable list view items.More...

Header:#include <Q3CheckListItem>
Inherits:Q3ListViewItem

Public Types

enumToggleState { Off, NoChange, On }
enumType { RadioButton, CheckBox, RadioButtonController, CheckBoxController }

Public Functions

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()
boolisOn() const
boolisTristate() const
virtual voidsetOn(bool b)
voidsetState(ToggleState s)
voidsetTristate(bool b)
ToggleStatestate() const
QStringtext() const
Typetype() const

Reimplemented Public Functions

virtual voidpaintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align)
virtual voidpaintFocus(QPainter * p, const QColorGroup & cg, const QRect & r)
virtual intrtti() const
virtual voidsetup()
virtual QStringtext(int n) const
virtual intwidth(const QFontMetrics & fm, const Q3ListView * lv, int column) const

Protected Functions

virtual voidstateChange(bool b)
voidturnOffChild()

Reimplemented Protected Functions

virtual voidactivate()

Detailed Description

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().

List View Items

See alsoQ3ListViewItem andQ3ListView.

Member Type Documentation

enum Q3CheckListItem::ToggleState

This enum specifies aQ3CheckListItem's toggle state.

ConstantValue
Q3CheckListItem::Off0
Q3CheckListItem::NoChange1
Q3CheckListItem::On2

enum Q3CheckListItem::Type

This enum type specifies aQ3CheckListItem's type:

ConstantValue
Q3CheckListItem::RadioButton0
Q3CheckListItem::CheckBox1
Q3CheckListItem::RadioButtonControllerController
Q3CheckListItem::CheckBoxController?

Member Function Documentation

Q3CheckListItem::Q3CheckListItem(Q3CheckListItem * parent, constQString & text,Type tt = RadioButtonController)

Constructs a checkable item with parentparent, texttext and of typett. Note that aRadioButton must be the child of aRadioButtonController, otherwise it will not toggle.

Q3CheckListItem::Q3CheckListItem(Q3CheckListItem * parent,Q3ListViewItem * after, constQString & text,Type tt = RadioButtonController)

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.

Q3CheckListItem::Q3CheckListItem(Q3ListViewItem * parent, constQString & text,Type tt = RadioButtonController)

Constructs a checkable item with parentparent, texttext and of typett. Note that this item mustnot be aRadioButton. Radio buttons must be children of aRadioButtonController.

Q3CheckListItem::Q3CheckListItem(Q3ListViewItem * parent,Q3ListViewItem * after, constQString & text,Type tt = RadioButtonController)

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.

Q3CheckListItem::Q3CheckListItem(Q3ListView * parent, constQString & text,Type tt = RadioButtonController)

Constructs a checkable item with parentparent, texttext and of typett. Note thattt mustnot beRadioButton. Radio buttons must be children of aRadioButtonController.

Q3CheckListItem::Q3CheckListItem(Q3ListView * parent,Q3ListViewItem * after, constQString & text,Type tt = RadioButtonController)

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.

Q3CheckListItem::Q3CheckListItem(Q3ListViewItem * parent, constQString & text, constQPixmap & p)

Constructs aRadioButtonController item with parentparent, texttext and pixmapp.

Q3CheckListItem::Q3CheckListItem(Q3ListView * parent, constQString & text, constQPixmap & p)

Constructs aRadioButtonController item with parentparent, texttext and pixmapp.

Q3CheckListItem::~Q3CheckListItem()

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.

bool Q3CheckListItem::isOn() const

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

bool Q3CheckListItem::isTristate() const

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() const

Reimplemented 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().

void Q3CheckListItem::setState(ToggleState s)

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().

void Q3CheckListItem::setTristate(bool b)

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().

ToggleState Q3CheckListItem::state() const

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.

QString Q3CheckListItem::text() const

Returns the item's text.

[virtual]QString Q3CheckListItem::text(int n) const

Reimplemented fromQ3ListViewItem::text().

[protected]void Q3CheckListItem::turnOffChild()

If this is aRadioButtonController that hasRadioButton children, turn off the child that is on.

Type Q3CheckListItem::type() const

Returns the type of this item.

[virtual]int Q3CheckListItem::width(constQFontMetrics & fm, constQ3ListView * lv,int column) const

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


[8]ページ先頭

©2009-2025 Movatter.jp