| 430 | } |
| 431 | |
| 432 | bool AspectTreeModel::setData(const QModelIndex& index, const QVariant& value, int role) { |
| 433 | if (!index.isValid() || role != Qt::EditRole) |
| 434 | return false; |
| 435 | auto* aspect = static_cast<AbstractAspect*>(index.internalPointer()); |
| 436 | switch (index.column()) { |
| 437 | case 0: { |
| 438 | if (!aspect->setName(value.toString(), AbstractAspect::NameHandling::UniqueRequired)) { |
| 439 | Q_EMIT statusInfo(i18n("The name \"%1\" is already in use. Choose another name.", value.toString())); |
| 440 | return false; |
| 441 | } |
| 442 | break; |
| 443 | } |
| 444 | case 3: |
| 445 | aspect->setComment(value.toString()); |
| 446 | break; |
| 447 | default: |
| 448 | return false; |
| 449 | } |
| 450 | Q_EMIT dataChanged(index, index); |
| 451 | return true; |
| 452 | } |
| 453 | |
| 454 | QModelIndex AspectTreeModel::modelIndexOfAspect(const AbstractAspect* aspect, int column) const { |
| 455 | if (!aspect) |
nothing calls this directly
no test coverage detected