WIP refresh gem catalog in place

Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
Alex Peterson
2021-11-01 11:18:38 -07:00
parent 781eaabd94
commit 259ee654ae
7 changed files with 85 additions and 0 deletions
@@ -18,6 +18,7 @@ namespace O3DE::ProjectManager
: QStandardItemModel(parent)
{
m_selectionModel = new QItemSelectionModel(this, parent);
connect(this, &QAbstractItemModel::rowsAboutToBeRemoved, this, &GemModel::OnRowsAboutToBeRemoved);
}
QItemSelectionModel* GemModel::GetSelectionModel() const
@@ -359,6 +360,16 @@ namespace O3DE::ProjectManager
gemModel->emit gemStatusChanged(gemName, numChangedDependencies);
}
void GemModel::OnRowsAboutToBeRemoved(const QModelIndex& parent, int first, int last)
{
for (int i = first; i <= last; ++i)
{
QModelIndex modelIndex = index(i, 0, parent);
const QString& gemName = GetName(modelIndex);
m_nameToIndexMap.remove(gemName);
}
}
void GemModel::SetIsAddedDependency(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isAdded)
{
model.setData(modelIndex, isAdded, RoleIsAddedDependency);