Results 1 to 2 of 2

Thread: "userdata" field in addItem in QComboBox

  1. #1
    Join Date
    Mar 2006
    Posts
    19
    Thanks
    1

    Default "userdata" field in addItem in QComboBox

    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
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: "userdata" field in addItem in QComboBox

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.