update_combobox

glue.utils.qt.update_combobox(combo, labeldata, default_index=0, block_signals=True)[source]

Redefine the items in a QComboBox

Parameters
widgetQComboBox

The widget to update

labeldatasequence of N (label, data) tuples

The combobox will contain N items with the appropriate labels, and data set as the userData

Returns
comboQComboBox

The updated input

Notes

If the current userData in the combo box matches any of labeldata, that selection will be retained. Otherwise, the first item will be selected.

Signals are disabled while the combo box is updated

The QComboBox is modified inplace