Nominate our 2022 Qt Champions!

"VIEWS" on same window

  • I need some suggestions on how to implement this. This is a newbie question

    I want different views based on user state:

    -When user is disconnected I want to show a LOGIN FORM

    -After login I want to show a form with BUTTON like PAUSE and LOGOFF

    -If user press PAUSE button, show a form showing LOGOFF and PAUSE OFF button

    I don't want develop three main forms, just one (if possible) showing on and off a container.

    Thanks for any suggestion


  • You can use QStackedWidget.
    For states you can use QStateMachine.

  • A QStateMachine seems overly sophisticated for this, in my opinione. An enum with three states (LoggedOff, LoggedIn, Paused) should do the trick too.

Log in to reply