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:
chris2oph 2018-12-07 11:18:53 +00:00 committed by Vadim Zeitlin
parent 5189781072
commit 89e4ee1ec0

View File

@ -148,6 +148,10 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
int wxChoice::DoInsertOneItem(const wxString& item, unsigned int pos)
{
m_qtComboBox->insertItem(pos, wxQtConvertString(item));
if ( IsSorted() )
m_qtComboBox->model()->sort(0);
return pos;
}