fix(cpn): Companion simulator would crash post add model (#2281)

This commit is contained in:
Neil Horne
2022-09-06 21:08:02 +10:00
committed by GitHub
parent aec0639e66
commit 58a6239ac5
+3 -1
View File
@@ -516,7 +516,7 @@ void MdiChild::initModelsList()
ui->lstLabels->setAcceptDrops(true);
ui->lstLabels->setDropIndicatorShown(true);
ui->lstLabels->setDragDropOverwriteMode(false);
ui->lstLabels->setDragDropMode(QAbstractItemView::InternalMove);
ui->lstLabels->setDragDropMode(QAbstractItemView::InternalMove);
ui->lstLabels->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
ui->modelsList->setIndentation(0);
@@ -756,6 +756,8 @@ int MdiChild::newModel(int modelIndex)
bool isNewModel = radioData.models[modelIndex].isEmpty();
checkAndInitModel(modelIndex);
radioData.fixModelFilenames();
// Only set the default model if we just added the first one.
if (countUsedModels() == 1) {
radioData.setCurrentModel(modelIndex);