Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to morph a Qdialog into a QMainWindow



  • Being a newbie, I put a lot of effort designing a Ui but unfortunately I started with a Qdialog and now I realize I am better off with a QMainWindow.

    I found the post Re below, then edited the ui XML file, substituted QMainWindow for QDialog (it was there only once), but the effect was I lost all my content. When opened in QtDesigner everything is gone. Fortunately I kept a backup copy :)

    It seems it works from QMainWindow to QDialog but not the reverse. What can I do?

    Re: Converting between QMainWindow/QWidget/QDialog in QtDesigner


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You likely have put everything in a layout, right ?
    That's the correct thing to do however, QMainWindow already has a layout hence your "losing" stuff impression.

    What you would need to do is to set a central widget on it and put your layout on that central widget.


Log in to reply