MCPcopy Create free account
hub / github.com/KDE/labplot / setData

Method setData

src/backend/core/AspectTreeModel.cpp:432–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432bool 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
454QModelIndex AspectTreeModel::modelIndexOfAspect(const AbstractAspect* aspect, int column) const {
455 if (!aspect)

Callers

nothing calls this directly

Calls 5

setCommentMethod · 0.80
isValidMethod · 0.45
columnMethod · 0.45
setNameMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected