Important: Please read the Qt Code of Conduct -

Transition between two QDialogs

  • I am developping a new application and I would like that it starts with a QDialog saying welcome and letting the user choose between two options by clicking on one of the two buttons representing the two options.
    I would like that when the user clicks on one of the two buttons, the application answers with another QDialog.

    My question is technical: how is the best way of implement the transition between the two QDialogs?
    One solution can be that I create only one QDialog and when a button is clicked, the same QDialog deletes the widget of the welcome QDialog and sets the new widgets.
    The other solution could be that when a button is clicked, a new QDialog is created.

    Do you have any suggestion? Thanks!

  • Lifetime Qt Champion


    Sounds more like a QWizard use case

  • Yes I agree with you, but I would like to have a customized page of the wizard where the buttons in the bottom of the page are not there and the buttons that is suppose to go to the next page is positioned elsewhere... in the page... I couldnt do that for this reason I tried with QDialog

  • Lifetime Qt Champion

    QStackedWidget/Layout inside your QDialog ?

  • Qt Champions 2017

    You are better to create two different dialogs and based on your first action, show the second one. You can either delete the previous one or keep it based on whether you want to reuse the same dialog.

Log in to reply