Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Implementing QDialogButtonBox by storing values of the indexes
Forum Updated to NodeBB v4.3 + New Features

Implementing QDialogButtonBox by storing values of the indexes

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 524 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yetbutno
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved