Ensure items are sorted when added to wxChoice in wxQt
Call sort() to resort the model after inserting a new item. Closes https://github.com/wxWidgets/wxWidgets/pull/1054
This commit is contained in:
@@ -148,6 +148,10 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
|
|||||||
int wxChoice::DoInsertOneItem(const wxString& item, unsigned int pos)
|
int wxChoice::DoInsertOneItem(const wxString& item, unsigned int pos)
|
||||||
{
|
{
|
||||||
m_qtComboBox->insertItem(pos, wxQtConvertString(item));
|
m_qtComboBox->insertItem(pos, wxQtConvertString(item));
|
||||||
|
|
||||||
|
if ( IsSorted() )
|
||||||
|
m_qtComboBox->model()->sort(0);
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user