返回介绍

QCheckListItem Class

发布于 2019-10-04 14:58:45 字数 5921 浏览 1326 评论 0 收藏 0

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

#include <qlistview.h>

Inherits QListViewItem.

List of all member functions.

Public Members

  • enum Type { RadioButton, CheckBox, Controller }
  • QCheckListItem ( QCheckListItem*parent, constQString&text, Typett = Controller )
  • QCheckListItem ( QListViewItem*parent, constQString&text, Typett = Controller )
  • QCheckListItem ( QListView*parent, constQString&text, Typett = Controller )
  • QCheckListItem ( QListViewItem*parent, constQString&text, constQPixmap&p )
  • QCheckListItem ( QListView*parent, constQString&text, constQPixmap&p )
  • ~QCheckListItem ()
  • virtual void paintCell ( QPainter*p, constQColorGroup&cg, intcolumn, intwidth, intalign )
  • virtual void paintFocus ( QPainter*p, constQColorGroup&cg, constQRect&r )
  • virtual void setOn ( boolb )
  • bool isOn () const
  • Type type () const
  • QString text () const
  • virtual int rtti () const

Protected Members

  • virtual void activate ()
  • void turnOffChild ()
  • virtual void stateChange ( bool )

Detailed Description

The QCheckListItem class provides checkable list view items.

QCheckListItems are used in QListViews to provide QListViewItems 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 QListViewItem, QListView and Advanced Widgets.


Member Type Documentation

QCheckListItem::Type

This enum type specifies a QCheckListItem's type:

  • QCheckListItem::RadioButton
  • QCheckListItem::CheckBox
  • QCheckListItem::Controller

Member Function Documentation

QCheckListItem::QCheckListItem ( QCheckListItem*parent, constQString&text, Typett = Controller )

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

QCheckListItem::QCheckListItem ( QListViewItem*parent, constQString&text, Typett = Controller )

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

QCheckListItem::QCheckListItem ( QListView*parent, constQString&text, Typett = Controller )

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

QCheckListItem::QCheckListItem ( QListViewItem*parent, constQString&text, constQPixmap&p )

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

QCheckListItem::QCheckListItem ( QListView*parent, constQString&text, constQPixmap&p )

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

QCheckListItem::~QCheckListItem ()

Destroys the item, deleting all its children, freeing up all allocated resources.

void QCheckListItem::activate () [virtual protected]

Toggle check box or set radio button to on.

Reimplemented from QListViewItem.

bool QCheckListItem::isOn () const

Returns TRUE if the item is toggled on; otherwise returns FALSE.

void QCheckListItem::paintCell ( QPainter*p, constQColorGroup&cg, intcolumn, intwidth, intalign ) [virtual]

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

Reimplemented from QListViewItem.

void QCheckListItem::paintFocus ( QPainter*p, constQColorGroup&cg, constQRect&r ) [virtual]

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

Reimplemented from QListViewItem.

int QCheckListItem::rtti () const [virtual]

Returns 1.

Make your derived classes return their own values for rtti(), and you can distinguish between listview items. You should use values greater than 1000 preferably a large random number, to allow for extensions to this class.

Reimplemented from QListViewItem.

void QCheckListItem::setOn ( boolb ) [virtual]

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

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

This virtual function is called when the item changes its on/off state.

QString QCheckListItem::text () const

Returns the text of the item.

void QCheckListItem::turnOffChild () [protected]

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

Type QCheckListItem::type () const

Returns the type of this item.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文