Signals | Public Member Functions

QxtCheckComboModel Class Reference

#include <qxtcheckcombobox_p.h>

List of all members.

Signals

void checkStateChanged ()

Public Member Functions

 QxtCheckComboModel (QObject *parent=0)
virtual Qt::ItemFlags flags (const QModelIndex &index) const
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)

Detailed Description

Definition at line 33 of file qxtcheckcombobox_p.h.


Constructor & Destructor Documentation

QxtCheckComboModel::QxtCheckComboModel ( QObject *  parent = 0 ) [explicit]

Definition at line 93 of file qxtcheckcombobox.cpp.

        : QStandardItemModel(0, 1, parent) // rows,cols
{
}

Member Function Documentation

void QxtCheckComboModel::checkStateChanged (  ) [signal]

Referenced by setData().

QVariant QxtCheckComboModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const [virtual]

Definition at line 103 of file qxtcheckcombobox.cpp.

{
    QVariant value = QStandardItemModel::data(index, role);
    if (index.isValid() && role == Qt::CheckStateRole && !value.isValid())
        value = Qt::Unchecked;
    return value;
}
Qt::ItemFlags QxtCheckComboModel::flags ( const QModelIndex &  index ) const [virtual]

Definition at line 98 of file qxtcheckcombobox.cpp.

{
    return QStandardItemModel::flags(index) | Qt::ItemIsUserCheckable;
}
bool QxtCheckComboModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
) [virtual]

Definition at line 111 of file qxtcheckcombobox.cpp.

References checkStateChanged().

{
    bool ok = QStandardItemModel::setData(index, value, role);
    if (ok && role == Qt::CheckStateRole)
    {
        emit dataChanged(index, index);
        emit checkStateChanged();
    }
    return ok;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines