MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / setData

Method setData

Source/GUI/StructEditor/StructSelectModel.cpp:126–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126bool StructSelectModel::setData(const QModelIndex& index, const QVariant& value, int role)
127{
128 if (role == Qt::EditRole)
129 {
130 QString newName = value.toString();
131 if (newName.isEmpty())
132 return false;
133
134 StructTreeNode* node = static_cast<StructTreeNode*>(index.internalPointer());
135 if (newName == node->getName())
136 return false;
137 QString oldNamespace = node->getNameSpace();
138
139 if (!node->getParent()->isNameAvailable(newName))
140 {
141 emit nameChangeFailed(node, newName);
142 return false;
143 }
144 node->setName(newName);
145 emit dataChanged(index, index);
146 emit dataEdited(index, oldNamespace, role);
147 return true;
148 }
149
150 return false;
151}
152
153Qt::ItemFlags StructSelectModel::flags(const QModelIndex& index) const
154{

Callers 1

mimeDataMethod · 0.45

Calls 4

getNameSpaceMethod · 0.80
isNameAvailableMethod · 0.80
setNameMethod · 0.80
getParentMethod · 0.45

Tested by

no test coverage detected