I am trying to dynamically create a checkbox for each restaurant in a vector. I was able to dynamically create checkboxes, but I would then like to know which ones were selected. Here is my code:
for(unsigned int i = 0; i < restaurantList.size(); i++)
{
QCheckBox *thisCheckBox = new QCheckBox(restaurantList.at(i).GetName());
CTui->verticalLayout->addWidget(thisCheckBox);
}
I currently have 5 restaurants filled in the vector, and as of now I have it look something like this:
() McDonalds
() Papa John's
() Burger King
() Dominos
() Taco Bell
When they click an "OK" button, I would like to know which ones were selected. They are all called thisCheckBox, so I don't know how to get each specific one. How can I do this? Any help is much appreciated!
Aucun commentaire:
Enregistrer un commentaire