From b0defd5876e13e92308fc4375b32d128b18ca2cd Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 17 Jan 2019 12:00:01 +0000 Subject: [PATCH] Don't select the newly added item in wxChoice --- src/qt/choice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qt/choice.cpp b/src/qt/choice.cpp index 20c9dac7fb..491398b718 100644 --- a/src/qt/choice.cpp +++ b/src/qt/choice.cpp @@ -212,11 +212,17 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, int wxChoice::DoInsertOneItem(const wxString& item, unsigned int pos) { + // Maintain unselected state + const bool unselected = m_qtComboBox->currentIndex() == -1; + m_qtComboBox->insertItem(pos, wxQtConvertString(item)); if ( IsSorted() ) m_qtComboBox->model()->sort(0); + if ( unselected ) + m_qtComboBox->setCurrentIndex(-1); + return pos; }