diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index c7fb519e4..443efa8ac 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -805,7 +805,7 @@ void MainWindow::readEeprom() if (readEepromFromRadio(tempFile)) { MdiChild * child = createMdiChild(); - child->newFile(); + child->newFile(false); child->loadFile(tempFile, false); child->show(); qunlink(tempFile); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index e9545888a..7676e9b49 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -565,7 +565,6 @@ void MdiChild::onItemActivated(const QModelIndex index) openModelEditWindow(mIdx); } else if (modelsListModel->isCategoryType(index)) { - ui->modelsList->setCurrentIndex(index); ui->modelsList->edit(index); } } @@ -591,8 +590,8 @@ void MdiChild::onDataChanged(const QModelIndex & index) } strcpy(radioData.categories[categoryIndex].name, modelsListModel->data(index, 0).toString().left(sizeof(CategoryData::name)-1).toStdString().c_str()); - ui->modelsList->setCurrentIndex(QModelIndex()); // must do this otherwise leaves QTreeView in limbo after TreeModel::refresh() (Qt undoc/bug?) - setModified(); + setWindowModified(true); + emit modified(); } /* @@ -1299,14 +1298,14 @@ void MdiChild::modelSimulate() startSimulation(this, radioData, getCurrentModel()); } -void MdiChild::newFile() +void MdiChild::newFile(bool createDefaults) { static int sequenceNumber = 1; isUntitled = true; curFile = QString("document%1.otx").arg(sequenceNumber++); updateTitle(); - if (firmware->getCapability(Capability::HasModelCategories)) { + if (createDefaults && firmware->getCapability(Capability::HasModelCategories)) { categoryAdd(); } } diff --git a/companion/src/mdichild.h b/companion/src/mdichild.h index f9f062553..3c3cc333e 100644 --- a/companion/src/mdichild.h +++ b/companion/src/mdichild.h @@ -81,7 +81,7 @@ class MdiChild : public QWidget QAction * getAction(const Actions type); public slots: - void newFile(); + void newFile(bool createDefaults = true); bool loadFile(const QString & fileName, bool resetCurrentFile=true); bool save(); bool saveAs(bool isNew=false);