| 201 | } |
| 202 | |
| 203 | bool InstanceList::setData(const QModelIndex& index, const QVariant& value, int role) |
| 204 | { |
| 205 | if (!index.isValid()) { |
| 206 | return false; |
| 207 | } |
| 208 | if (role != Qt::EditRole) { |
| 209 | return false; |
| 210 | } |
| 211 | BaseInstance* pdata = static_cast<BaseInstance*>(index.internalPointer()); |
| 212 | auto newName = value.toString(); |
| 213 | if (pdata->name() == newName) { |
| 214 | return true; |
| 215 | } |
| 216 | pdata->setName(newName); |
| 217 | return true; |
| 218 | } |
| 219 | |
| 220 | Qt::ItemFlags InstanceList::flags(const QModelIndex& index) const |
| 221 | { |