0

is it possible to store some additional data in a QComboBox? I would like to store the Id of a data set beside its caption/name in a combobox, but it shouldnt show up (Ids can be some how cryptic and might confuse the user)

Any ideas?

Thanks in advance,

Ben

Ben A.
  • 1,511
  • 2
  • 11
  • 8

1 Answers1

3

You should use setItemData, itemData and findData methods of QComboBox. It allows to attach arbitrary QVariant value to each item.

Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
  • Thanks for the answer. This indeed works; I can set and retrieve an additional index programmatically. However, I can't do it by using QT Designer, right? – Ben A. Jun 20 '13 at 05:24