Error::-> "aggregate QSet<QPersistentModelIndex> checklist' has incomplete type and cannot be defined"



  • Hii, I am getting the follwing error,can any1 help me..

    Error::-> "aggregate QSet<QPersistentModelIndex> checklist' has incomplete type and cannot be defined"

    below is my code..

    @
    standarditemmodel::standarditemmodel(QObject *parent) :
    QStandardItemModel(parent)
    {
    QSet <QPersistentModelIndex> checklist;
    }

    QVariant standarditemmodel::data(const QModelIndex& index, int role) const
    {
    if (role == Qt::CheckStateRole) return checklist.contains(index) ? Qt::Checked : Qt::Unchecked;
    return QStandardItemModel::data(index, role);
    }

    Qt::ItemFlags standarditemmodel::flags(const QModelIndex& index) const
    {
    return QStandardItemModel::flags(index) | Qt::ItemIsUserCheckable;
    }

    bool standarditemmodel::setData(const QModelIndex& index, const QVariant& value, int role)
    {
    if (role == Qt::CheckStateRole)
    {
    if (value == Qt::Checked)
    checklist.insert(index);
    else checklist.remove(index);
    emit dataChanged(index, index);
    return true;
    }
    return QStandardItemModel::setData(index, value, role);
    }
    @

    [edit: code highlighted / Denis Kormalev]



  • how are the header files included?



  • Hm, strange bug with bolding all text. And nothing wrong in first post. Marius, do you see?



  • [quote author="Denis Kormalev" date="1306693935"]Hm, strange bug with bolding all text. And nothing wrong in first post. Marius, do you see?[/quote]

    Strange indeed, thanks for reporting Denis.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.