Manager: Add machine deletion

This commit is contained in:
Alexander Babikov
2025-08-07 13:36:46 +05:00
parent d10d77481a
commit 74501db7fc
4 changed files with 41 additions and 1 deletions

View File

@@ -140,6 +140,18 @@ VMManagerModel::addConfigToModel(VMManagerSystem *system_config)
connect(system_config, &VMManagerSystem::itemDataChanged, this, &VMManagerModel::modelDataChanged);
endInsertRows();
}
void
VMManagerModel::removeConfigFromModel(VMManagerSystem *system_config)
{
const QModelIndex index = getIndexForConfigFile(system_config->config_file);
disconnect(system_config, &VMManagerSystem::itemDataChanged, this, &VMManagerModel::modelDataChanged);
beginRemoveRows(QModelIndex(), index.row(), index.row());
machines.remove(index.row());
endRemoveRows();
emit systemDataChanged();
}
void
VMManagerModel::modelDataChanged()
{
@@ -177,4 +189,4 @@ VMManagerModel::getActiveMachineCount()
running++;
}
return running;
}
}