MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / setData

Method setData

launcher/InstanceList.cpp:191–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191bool InstanceList::setData(const QModelIndex& index, const QVariant& value, int role)
192{
193 if (!index.isValid()) {
194 return false;
195 }
196 if (role != Qt::EditRole) {
197 return false;
198 }
199 BaseInstance* pdata = static_cast<BaseInstance*>(index.internalPointer());
200 auto newName = value.toString();
201 if (pdata->name() == newName) {
202 return true;
203 }
204 pdata->setName(newName);
205 return true;
206}
207
208Qt::ItemFlags InstanceList::flags(const QModelIndex& index) const
209{

Callers 1

mimeDataMethod · 0.45

Calls 4

isValidMethod · 0.45
toStringMethod · 0.45
nameMethod · 0.45
setNameMethod · 0.45

Tested by

no test coverage detected