PyQT5 Combobox re-sort??
shift838 last edited by
I am trying to figure out how to resort my combobox with PYQT5 and python when a new item is added.
I can get it to add, but it will not sort.
I am just doing a very basic example to get it functioning
self.comboloadsystem.addItem(favfile + ".xml")
I have the combobox set to add items alphabetically, but I am assuming I will need to do something grammatically.
I have not found a refresh option.
I have tried to count the items and put them in an array and re-add with .addItems(array) but it still puts it in the same place.
Denni 0 last edited by
Well without seeing a minimal fully functioning example of your code it is kind of hard to guess what you might be doing wrong.
However as a general answer I (unless the combo box has a large amount of data in it) just store this data in dictionary and/or list and then add to the dictionary/list -- purge the combo box -- and add the data pre-sorted back into the combo box