How to add/change QStackedLayout without changing current layout?

  Kiến thức lập trình

I am making a Sudoku app, and I am trying to show text boxes (line edit) on top of sudoku grid. To do this, I have a 2-page stackedWidget, one with the grid and one with the text boxes. Everything is already organized in the event of a window resize, and now whenever I try to add the QStackedLayout (to enable ShowAll), it changes the window layout entirely.

The only difference between the two attached pictures is this set of code (and it doesn’t even stack both as far as I can tell):

    QStackedLayout * layoutt = new QStackedLayout;
    layoutt->addWidget(ui->stackedWidget);
    layoutt->setStackingMode(QStackedLayout::StackingMode::StackAll);

The third image is the structure I think is being destroyed when I assign the stackedWidget to my new layout.

There doesn’t seem to be a way to put a QStackedLayout in the designer, and I’m not entirely sure how to just replace my stackedWidget in its layout with a QStackedLayout, with the stackedWidget as its child.

The overall goal is to get both the sudoku and the text box pages visible, which I think requires QStackedLayout, which means I need to add QStackedLayout in place of stackedWidget, and set stackedWidget as its child.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT