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. QMainWindow swap Central Widget or QStackedWidget
Forum Updated to NodeBB v4.3 + New Features

QMainWindow swap Central Widget or QStackedWidget

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 425 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.
  • S Offline
    S Offline
    sandro4912
    wrote on last edited by
    #1

    I have the following Situation:

    A Widget of type A which is like a Dialog. Which can only get accepted.

    A Widget of type B which runs the main application

    A Widget of type C which reports the Outcome of the main widget. It is also like a Dialog with the choice to start a new B or quit the program.

    So my program flow is :

    Display A.
    A gets accepted.
    Display B
    B-> finnishes.
    Dsiplay C (show the result of B)

    Have the option to start again a new B (Some aspects of B are random so it has to get created new everytime we switch back).

    I was wondering how to organize the flow of the programm the best?

    • Putting them in a QMainWindow and change centralWidget ?
      -> I tryed this approach it seems to work but A and C don't follow the size rules since they are based on QDialog. So in Short evrytime I switch centralWidget the QMainWindow jumps to annother place and resizes. Even with setFixedSize

    • Or use QStackedWidget and get the old B and C out at the time to replace them with new ones?

    • Annother option im not aware off.

    I hope you can push me in the right direction here.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Why do you need to put them out of the stacked widget ?
      Implement them so that you can refresh/reset them so you only have one instance of each and be done with it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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