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

Popular posts from this blog

MySql variables and php -

c# - How can I find out if there are windows above a control? -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -