Fix last instance remaining selected when deleted
This commit is contained in:
		@@ -870,17 +870,14 @@ void MainWindow::updateInstanceToolIcon(QString new_icon)
 | 
			
		||||
 | 
			
		||||
void MainWindow::setSelectedInstanceById(const QString &id)
 | 
			
		||||
{
 | 
			
		||||
	QModelIndex selectionIndex = proxymodel->index(0, 0);
 | 
			
		||||
	if (!id.isNull())
 | 
			
		||||
	{
 | 
			
		||||
	if (id.isNull())
 | 
			
		||||
		return;
 | 
			
		||||
	const QModelIndex index = MMC->instances()->getInstanceIndexById(id);
 | 
			
		||||
	if (index.isValid())
 | 
			
		||||
	{
 | 
			
		||||
			selectionIndex = proxymodel->mapFromSource(index);
 | 
			
		||||
		QModelIndex selectionIndex = proxymodel->mapFromSource(index);
 | 
			
		||||
		view->selectionModel()->setCurrentIndex(selectionIndex, QItemSelectionModel::ClearAndSelect);
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
	view->selectionModel()->setCurrentIndex(selectionIndex,
 | 
			
		||||
											QItemSelectionModel::ClearAndSelect);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_actionChangeInstGroup_triggered()
 | 
			
		||||
@@ -1349,8 +1346,8 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &
 | 
			
		||||
{
 | 
			
		||||
	if(!current.isValid())
 | 
			
		||||
	{
 | 
			
		||||
        selectionBad();
 | 
			
		||||
		MMC->settings()->set("SelectedInstance", QString());
 | 
			
		||||
		selectionBad();
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	QString id = current.data(InstanceList::InstanceIDRole).toString();
 | 
			
		||||
@@ -1370,8 +1367,8 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
        selectionBad();
 | 
			
		||||
		MMC->settings()->set("SelectedInstance", QString());
 | 
			
		||||
		selectionBad();
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user