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

Method data

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

Source from the content-addressed store, hash-verified

144}
145
146QVariant InstanceList::data(const QModelIndex& index, int role) const
147{
148 if (!index.isValid()) {
149 return QVariant();
150 }
151 BaseInstance *pdata = static_cast<BaseInstance *>(index.internalPointer());
152 switch (role)
153 {
154 case InstancePointerRole:
155 {
156 QVariant v = QVariant::fromValue((void *)pdata);
157 return v;
158 }
159 case InstanceIDRole:
160 {
161 return pdata->id();
162 }
163 case Qt::EditRole:
164 case Qt::DisplayRole:
165 {
166 return pdata->name();
167 }
168 case Qt::AccessibleTextRole:
169 {
170 return tr("%1 Instance").arg(pdata->name());
171 }
172 case Qt::ToolTipRole:
173 {
174 return pdata->instanceRoot();
175 }
176 case Qt::DecorationRole:
177 {
178 return pdata->iconKey();
179 }
180 // HACK: see InstanceView.h in gui!
181 case GroupRole:
182 {
183 return getInstanceGroup(pdata->id());
184 }
185 default:
186 break;
187 }
188 return QVariant();
189}
190
191bool InstanceList::setData(const QModelIndex& index, const QVariant& value, int role)
192{

Callers

nothing calls this directly

Calls 5

instanceRootMethod · 0.80
isValidMethod · 0.45
idMethod · 0.45
nameMethod · 0.45
iconKeyMethod · 0.45

Tested by

no test coverage detected