Don't select the newly added item in wxChoice
This commit is contained in:
committed by
Vadim Zeitlin
parent
f2538a0bc4
commit
b0defd5876
@@ -212,11 +212,17 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
|
|||||||
|
|
||||||
int wxChoice::DoInsertOneItem(const wxString& item, unsigned int pos)
|
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));
|
m_qtComboBox->insertItem(pos, wxQtConvertString(item));
|
||||||
|
|
||||||
if ( IsSorted() )
|
if ( IsSorted() )
|
||||||
m_qtComboBox->model()->sort(0);
|
m_qtComboBox->model()->sort(0);
|
||||||
|
|
||||||
|
if ( unselected )
|
||||||
|
m_qtComboBox->setCurrentIndex(-1);
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user