I want / have to write a setData() function in a class derived from QAbstractListModel because I want to modify the variable QList<ListItem*> m_list
in the QList I save Parameter-Objects with have a value property which can be written by calling setValue()
I tried the following lines in setData without success:
Parameter item = *m_list[index.row()];
item.setValue(value.toString());
AND
m_list.at(index.row())->setValue(value.toString);
emit dataChanged(index,index);
return true;
}
bool ListModel::setData(const QModelIndex &index, const QVariant &value, int role) {
Parameter item = *m_list[index.row()];
item.setValue(value.toString());
AND
m_list.at(index.row())->setValue(value.toString);
emit dataChanged(index,index);
return true;
}
To copy to clipboard, switch view to plain text mode
Why is it not possible to get a Parameter object by reference and call the function setValue()?
Bookmarks