Implementing QDialogButtonBox by storing values of the indexes
-
I am trying to create a dialog that pops up that gives the user a selection of 6 different options. I read the documentation on QDialogButtonBox but still am a little bit confused on how to implement it. Right now I have a QInputDialog that takes in the player's names and after the user enters that information, I want to prompt each player with this button box. After they select what they want, it stores the selected index into a variable and I can use that info to assign them pieces accordingly.
Here is a snippet of my code:
@ hatbutton = new QPushButton(tr("Hat"));
hatbutton->setDefault(true);carbutton = new QPushButton(tr("Car")); carbutton ->setDefault(true); spaceshipbutton = new QPushButton(tr("Spaceship")); spaceshipbutton->setDefault(true); basketballbutton = new QPushButton(tr("Basketball")); basketballbutton -> setDefault(true); ringbutton = new QPushButton(tr("Ring")); ringbutton -> setDefault(true); shoebutton = new QPushButton(tr("Shoe")); shoebutton ->setDefault(true); pieces = new QDialogButtonBox(this); pieces -> addButton(hatbutton, QDialogButtonBox::ActionRole); pieces -> addButton(carbutton, QDialogButtonBox::ActionRole); pieces -> addButton(spaceshipbutton, QDialogButtonBox::ActionRole); pieces -> addButton(basketballbutton, QDialogButtonBox::ActionRole); pieces -> addButton(ringbutton, QDialogButtonBox::ActionRole); pieces -> addButton(shoebutton, QDialogButtonBox::ActionRole);@
Right now the issue is the button box is not even popping up. If anyone can teach me how to properly implement it, first by making it appear then by storing the values somehow it would help me tremendously. Thank you so much.
Please let me know if you need more info to help me implement this. I am also running qt 4.8