Quote Originally Posted by d_stranz View Post
QAbstractTableModel does not re-implement setData(), so it is using the implementation from its base class, QAbstractItemModel. The documentation for QAbstractItemModel::setData() says:



So if you have not implemented setData() in your own model (derived from QAbstractTableModel), then using the default setData() method is doing nothing to store your string.

This tutorial would be a good place to start. There is a section on creating an editable model.
Sorry I had misunderstood your previous message.
Yes I implemented a setData from my model.

I write it below:

Qt Code:
  1. bool SelectedListModel::setData(const QModelIndex &index, const QVariant &value, int role)
  2. {
  3. if (!index.isValid())
  4. {
  5. return false;
  6. }
  7. if (role == Qt::EditRole)
  8. {
  9. m_reports[index.row()].replace("actionName", value.toString());
  10.  
  11. emit dataChanged(index, index);
  12. return true;
  13. }
  14. }
To copy to clipboard, switch view to plain text mode 

It is not clear to me how to add data with a custom role.
Can you help me with a small example?