From 86fbb071daf04b4ef23a35d9c750d7baf42f1056 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Sun, 5 Mar 2017 08:39:59 +0100 Subject: [PATCH] [companion] Horus models didn't get their defaults set (thanks @Max) --- companion/src/mdichild.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 5b6cdcc82..634e506b3 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -472,16 +472,16 @@ void MdiChild::modelAdd() } ModelData model; - model.category = categoryIndex; - model.used = true; - strcpy(model.filename, radioData.getNextModelFilename().toStdString().c_str()); - strcpy(model.name, qPrintable(tr("New model"))); radioData.models.push_back(model); + int row = radioData.models.size() - 1; + checkAndInitModel(row); + radioData.models[row].category = categoryIndex; + strcpy(radioData.models[row].filename, radioData.getNextModelFilename().toStdString().c_str()); + strcpy(radioData.models[row].name, qPrintable(tr("New model"))); // Only set the default model if we just added the first one. - int newModelIndex = radioData.models.size() - 1; - if (newModelIndex == 0) { - radioData.setCurrentModel(newModelIndex); + if (row == 0) { + radioData.setCurrentModel(row); } setModified(); emit copyAvailable(false); // workaround : nothing is selected after model creation