MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / toggleState

Method toggleState

src/modlist.cpp:1394–1421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394bool ModList::toggleState(const QModelIndexList& indices)
1395{
1396 emit aboutToChangeData();
1397
1398 QList<unsigned int> modsToEnable;
1399 QList<unsigned int> modsToDisable;
1400 for (auto index : indices) {
1401 auto idx = index.data(IndexRole).toInt();
1402 if (m_Profile->modEnabled(idx)) {
1403 modsToDisable.append(idx);
1404 } else {
1405 modsToEnable.append(idx);
1406 }
1407 }
1408
1409 m_Profile->setModsEnabled(modsToEnable, modsToDisable);
1410
1411 emit tutorialModlistUpdate();
1412
1413 m_Modified = true;
1414 m_LastCheck.restart();
1415
1416 emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
1417
1418 emit postDataChanged();
1419
1420 return true;
1421}
1422
1423void ModList::setActive(const QModelIndexList& indices, bool active)
1424{

Callers 2

toggleSelectionStateMethod · 0.45
toggleSelectionStateMethod · 0.45

Calls 3

modEnabledMethod · 0.80
setModsEnabledMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected