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

Method data

launcher/minecraft/mod/ModFolderModel.cpp:347–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345}
346
347QVariant ModFolderModel::data(const QModelIndex &index, int role) const
348{
349 if (!index.isValid())
350 return QVariant();
351
352 int row = index.row();
353 int column = index.column();
354
355 if (row < 0 || row >= mods.size())
356 return QVariant();
357
358 switch (role)
359 {
360 case Qt::DisplayRole:
361 switch (column)
362 {
363 case NameColumn:
364 return mods[row].name();
365 case VersionColumn: {
366 switch(mods[row].type()) {
367 case Mod::MOD_FOLDER:
368 return tr("Folder");
369 case Mod::MOD_SINGLEFILE:
370 return tr("File");
371 default:
372 break;
373 }
374 return mods[row].version();
375 }
376 case DateColumn:
377 return mods[row].dateTimeChanged();
378
379 default:
380 return QVariant();
381 }
382
383 case Qt::ToolTipRole:
384 return mods[row].mmc_id();
385
386 case Qt::CheckStateRole:
387 switch (column)
388 {
389 case ActiveColumn:
390 return mods[row].enabled() ? Qt::Checked : Qt::Unchecked;
391 default:
392 return QVariant();
393 }
394 default:
395 return QVariant();
396 }
397}
398
399bool ModFolderModel::setData(const QModelIndex &index, const QVariant &value, int role)
400{

Callers 1

ReadMCModTOMLFunction · 0.45

Calls 8

dateTimeChangedMethod · 0.80
mmc_idMethod · 0.80
enabledMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45
nameMethod · 0.45
typeMethod · 0.45
versionMethod · 0.45

Tested by

no test coverage detected