An extended QListWidgetItem. More...
#include <qxtlistwidgetitem.h>
Public Member Functions | |
| QxtListWidgetItem (QListWidget *parent=0, int type=Type) | |
| QxtListWidgetItem (const QString &text, QListWidget *parent=0, int type=Type) | |
| QxtListWidgetItem (const QIcon &icon, const QString &text, QListWidget *parent=0, int type=Type) | |
| QxtListWidgetItem (const QxtListWidgetItem &other) | |
| virtual | ~QxtListWidgetItem () |
| bool | testFlag (Qt::ItemFlag flag) const |
| void | setFlag (Qt::ItemFlag flag, bool enabled=true) |
| virtual void | setData (int role, const QVariant &value) |
An extended QListWidgetItem.
QxtListWidgetItem provides means for offering check state change signals and convenience methods for testing and setting flags.
Definition at line 32 of file qxtlistwidgetitem.h.
| QxtListWidgetItem::QxtListWidgetItem | ( | QListWidget * | parent = 0, |
| int | type = Type |
||
| ) | [explicit] |
Definition at line 40 of file qxtlistwidgetitem.cpp.
: QListWidgetItem(parent, type)
{}
| QxtListWidgetItem::QxtListWidgetItem | ( | const QString & | text, |
| QListWidget * | parent = 0, |
||
| int | type = Type |
||
| ) | [explicit] |
Definition at line 44 of file qxtlistwidgetitem.cpp.
: QListWidgetItem(text, parent, type)
{}
| QxtListWidgetItem::QxtListWidgetItem | ( | const QIcon & | icon, |
| const QString & | text, | ||
| QListWidget * | parent = 0, |
||
| int | type = Type |
||
| ) | [explicit] |
Definition at line 48 of file qxtlistwidgetitem.cpp.
: QListWidgetItem(icon, text, parent, type)
{}
| QxtListWidgetItem::QxtListWidgetItem | ( | const QxtListWidgetItem & | other ) | [explicit] |
Definition at line 52 of file qxtlistwidgetitem.cpp.
: QListWidgetItem(other)
{}
| QxtListWidgetItem::~QxtListWidgetItem | ( | ) | [virtual] |
Definition at line 56 of file qxtlistwidgetitem.cpp.
{}
| void QxtListWidgetItem::setData | ( | int | role, |
| const QVariant & | value | ||
| ) | [virtual] |
Definition at line 85 of file qxtlistwidgetitem.cpp.
References QxtListWidget::itemCheckStateChanged().
{
if (role == Qt::CheckStateRole)
{
const Qt::CheckState newState = static_cast<Qt::CheckState>(value.toInt());
const Qt::CheckState oldState = static_cast<Qt::CheckState>(data(role).toInt());
QListWidgetItem::setData(role, value);
if (newState != oldState)
{
QxtListWidget* list = qobject_cast<QxtListWidget*>(listWidget());
if (list)
{
emit list->itemCheckStateChanged(this);
}
}
}
else
{
QListWidgetItem::setData(role, value);
}
}
| void QxtListWidgetItem::setFlag | ( | Qt::ItemFlag | flag, |
| bool | enabled = true |
||
| ) |
If enabled is true, the item flag is enabled; otherwise, it is disabled.
Definition at line 74 of file qxtlistwidgetitem.cpp.
| bool QxtListWidgetItem::testFlag | ( | Qt::ItemFlag | flag ) | const |
Returns true if the flag is set, otherwise false.
Definition at line 64 of file qxtlistwidgetitem.cpp.
{
return (flags() & flag);
}
1.7.2