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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top