Unfortunately, I have no idea how to implement setData in this case but I have tried something like this:
{
if (index.isValid() && role == Qt::DisplayRole)
{
QMap<int, QVariant> itemData;
itemData.insert(Qt::DisplayRole, value);
setItemData(index, itemData);
emit(dataChanged(index, index));
return true;
}
return false;
}
bool CMyQueryModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (index.isValid() && role == Qt::DisplayRole)
{
QMap<int, QVariant> itemData;
itemData.insert(Qt::DisplayRole, value);
setItemData(index, itemData);
emit(dataChanged(index, index));
return true;
}
return false;
}
To copy to clipboard, switch view to plain text mode
But this does not work. How do I get hold of a row on the model?
Thanks for your help. I was not in town, so I could not respond to your replies sooner.
Bookmarks