PDA

View Full Version : "userdata" field in addItem in QComboBox



amulya
6th September 2007, 12:05
Hi All,

I m trying to create a combobox with each item containing an icon and a string. But I m not getting the required output when combobox is dropped. I have attached the screenshots explaining my problem. I was wondering what role "userdata" field plays in addItem() of QComboBox. I would really appreciate it if anyone could throw some light into why this behaviour is occuring and explain the role of "userdata" field.

Thanx,
Amulya

marcel
6th September 2007, 12:15
You can leave the third parameter in addItem( the QVariant) the default(an empty QVariant).

This is useful when you want some custom data to be stored in the model. Also, it is useful when painting manually the item(via a delegate) since you can put in there additional information, more than a simple item title.

Regards