Don't select the newly added item in wxChoice

This commit is contained in:
Richard Smith
2019-01-17 12:00:01 +00:00
committed by Vadim Zeitlin
parent f2538a0bc4
commit b0defd5876

View File

@@ -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;
}