Note that there are some explanatory texts on larger screens.

plurals
  1. POQt - how to make QPushButton change between two QVBoxLayouts
    primarykey
    data
    text
    <p>So i have a main layout called the 'vboxmain'. And the program has two states: blackjack and poker. For both I have a button. In this vboxmain I have an upper part, which covers most of the program, and is the same for both games, but I also have a bottom part which should display different parts for both games. For example, poker game should hold five QCheckBoxes and one button. As for the blackjack game i need simply two buttons. I created both of these bottom layouts as QVBoxLayouts. So now i have:</p> <pre><code>BlackjackiValikud = new QVBoxLayout; //for blackjack Pokkerivalikud = new QVBoxLayout; //for poker </code></pre> <p>And I tried creating two button actions like this:</p> <pre><code>void mainwindow::BlackJack_clicked(){ vboxmain-&gt;removeItem(Pokkerivalikud); vboxmain-&gt;addItem(BlackjackiValikud); } void mainwindow::Poker_clicked(){ vboxmain-&gt;removeItem(BlackjackiValikud); vboxmain-&gt;addItem(Pokkerivalikud); } </code></pre> <p>Buttons are connected like this:</p> <pre><code>connect(BlackjackButton, SIGNAL(clicked()), this, SLOT(BlackJack_clicked())); connect(PokerButton, SIGNAL(clicked()), this, SLOT(Poker_clicked())); </code></pre> <p>But currently it's not working and I can't figure out a way to do this, so I'm asking for help. This is probably not the best way to do this either but I don't know any other ways. So I could use some help on how to make this work with whatever solution - so that with both buttons I can change the bottom part of my vboxmain as needed.</p> <p>I'm open to solutions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload