Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:41:38+00:00 2026-06-04T15:41:38+00:00

So i have a main layout called the ‘vboxmain’. And the program has two

  • 0

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:

BlackjackiValikud = new QVBoxLayout; //for blackjack
Pokkerivalikud = new QVBoxLayout;  //for poker

And I tried creating two button actions like this:

void mainwindow::BlackJack_clicked(){
    vboxmain->removeItem(Pokkerivalikud);
    vboxmain->addItem(BlackjackiValikud);
}

void mainwindow::Poker_clicked(){
    vboxmain->removeItem(BlackjackiValikud);
    vboxmain->addItem(Pokkerivalikud);
}

Buttons are connected like this:

connect(BlackjackButton, SIGNAL(clicked()), this, SLOT(BlackJack_clicked()));
connect(PokerButton, SIGNAL(clicked()), this, SLOT(Poker_clicked()));

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.

I’m open to solutions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:41:39+00:00Added an answer on June 4, 2026 at 3:41 pm

    What do you mean by it is not working?

    You have to make sure that the layout are enabled when you add them (via QLayout::setEnabled ( bool enable)) or that widget are visible (via QWidget::show()). In general you have to manuable make visible items which are added to a widget which is already visible…

    An alternative would be to use a QStackedLayout to display either. You have a widget poker for the poker view and a widget blackjack for the black jack view. On button push you use either

    void QStackedLayout::setCurrentIndex ( int index )
    void QStackedLayout::setCurrentWidget ( QWidget * widget )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two layouts, one is the main layout inside which I am including
I have main table called 'Employee' and another slave table called 'EmployeeTypes' that has
I have two layouts: main.xml and journal.xml When I click on a button in
I have two main.xml files in layout-land and layout-port folders and when the orientation
so I have my main layout as such: <div class=menu> <?php include('/menu.php'); ?> </div>
I have two panels: main_panel child_panel The main_panel layout is set using: main_panel.setLayout(flowlayout) I
I have 3 main elements in my XML layout (also see the image): The
I have a reasonably complex layout problem: I would like to have a main
My problem: I have 3 templates: main.html.twig (main layout file) layout.html.twig (a bundle specific
I have a custom view called DrawView created in the main activity. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.