qcombobox - Add QObject in the combo box of Qt -
I have a custom class that I have created, called Mycleas. How to add reference to MyClass's reference as the second parameter in the combo box below:
it-> ui-> comboBox-> addItem ("item-1",);
The purpose is when the item changes are also removed, I have to get that specific class installation MyClass and process accordingly.
First you need to use, so that the type used in QVariant
can go. Then you can add items like this:
it-> ui-> ComboBox-> AddItem ("item-1", QVariant :: fromValue (myClass));
and get it back:
it->; -> combobox- & gt; Item data (x) .value & lt; MyClass * & gt; ();
Comments
Post a Comment