MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / setData

Method setData

launcher/minecraft/mod/ResourceFolderModel.cpp:461–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461bool ResourceFolderModel::setData(const QModelIndex& index, [[maybe_unused]] const QVariant& value, int role)
462{
463 int row = index.row();
464 if (row < 0 || row >= rowCount(index.parent()) || !index.isValid())
465 return false;
466
467 if (role == Qt::CheckStateRole) {
468 if (m_instance != nullptr && m_instance->isRunning()) {
469 auto response =
470 CustomMessageBox::selectable(nullptr, tr("Confirm toggle"),
471 tr("If you enable/disable this resource while the game is running it may crash your game.\n"
472 "Are you sure you want to do this?"),
473 QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
474 ->exec();
475
476 if (response != QMessageBox::Yes)
477 return false;
478 }
479 return setResourceEnabled({ index }, EnableAction::TOGGLE);
480 }
481
482 return false;
483}
484
485QVariant ResourceFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientation orientation, int role) const
486{

Callers

nothing calls this directly

Calls 5

selectableFunction · 0.85
parentMethod · 0.45
isValidMethod · 0.45
isRunningMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected