When I set data from QML to model, how can I check returned value of setData
method?
For example:
QML:
delegate:
CheckBox {
id: selCheckbox
onCheckStateChanged: {
// This call setData method
itemSelected = checked
// And HERE I need check returned value from setData method.
}
}
C++:
class EditedListModel: public QAbstractListModel
{
bool EditedListModel::setData( const QModelIndex &index, const QVariant &value, int role )
{
bool retVal = false;
if( index.isValid() )
{
// Some condition which allows item selection
if( ... )
m_ItemSelected[index.row()] = data.toBool();
}
return retVal;
}
}