diff --git a/src/dialogs/profilesdialog.h b/src/dialogs/profilesdialog.h --- a/src/dialogs/profilesdialog.h +++ b/src/dialogs/profilesdialog.h @@ -47,7 +47,7 @@ void updateCBProfiles(); void setModified(bool modified); bool m_modified; - + int m_prevIndex = 0; signals: void updateProfiles(); }; diff --git a/src/dialogs/profilesdialog.cpp b/src/dialogs/profilesdialog.cpp --- a/src/dialogs/profilesdialog.cpp +++ b/src/dialogs/profilesdialog.cpp @@ -34,8 +34,15 @@ ui->baudCB->addItems(SERIAL::BAUDS); ui->baudCB->setCurrentText(QLatin1String("115200")); ui->profileCB->setAutoCompletion(true); - connect(ui->profileCB, static_cast(&QComboBox::currentIndexChanged), this, [this] { + connect(ui->profileCB, static_cast(&QComboBox::currentIndexChanged), this, [this](const int newIndex) { + blockSignals(true); + ui->profileCB->setCurrentIndex(m_prevIndex); + blockSignals(false); askToSave(); + blockSignals(true); + m_prevIndex = newIndex; + ui->profileCB->setCurrentIndex(m_prevIndex); + blockSignals(false); loadSettings(); }); updateCBProfiles();