MCPcopy Create free account
hub / github.com/MultiMC/Launcher / setData

Method setData

launcher/InstanceList.cpp:171–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171bool InstanceList::setData(const QModelIndex& index, const QVariant& value, int role)
172{
173 if (!index.isValid())
174 {
175 return false;
176 }
177 if(role != Qt::EditRole)
178 {
179 return false;
180 }
181 BaseInstance *pdata = static_cast<BaseInstance *>(index.internalPointer());
182 auto newName = value.toString();
183 if(pdata->name() == newName)
184 {
185 return true;
186 }
187 pdata->setName(newName);
188 return true;
189}
190
191Qt::ItemFlags InstanceList::flags(const QModelIndex &index) const
192{

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