[Qt-interest] userdata and qtcombobox items
cbruner at quadro.net
cbruner at quadro.net
Fri Jan 15 08:22:57 CET 2010
I'm sure there must be a way to do this properly. I'm trying to pass
around a const pointer to an instance using a combobox, so the item in
the combobox is matched to my pointer.
class myclass {..}
...
const myclass *mc = ....
ui->comboBox->addItem(QIcon(":/images/in.bmp"),a,mc);
...
const myclass *mc = ui->comboBox->itemData(index);
Can this be done in a proper way. I've looked at Qvarients, and
Qmetatype and qusertypes docs, but what I need is an example.
More information about the Qt-interest-old
mailing list