Important: Please read the Qt Code of Conduct -

Converting between QMainWindow/QWidget/QDialog in QtDesigner

  • Is it possible to convert between these types of widgets in the designer? Say I have a QMainWindow in QtDesigner and now I'd rather it be a QDialog - is there a way to convert this to a QWidget without copying/pasting all of the subwidgets?



  • u can try one thing,

    just right click on the widget which u want to convert and then select morph into option and this will give u option to covert ur widget into another widget...

  • When I right click on a QMainWindow, I don't see any "morph" option.

  • You might want to try to edit the xml file that designer is. When opened design, click on Edit and there in the first couple of lines are the QMainWindow class and name.
    Would try it there. Couldn't find it in Designer myself.

  • @daviddoria

    In QMainWindow morph does not work, but the widget will support

  • You need to manually edit ui file outside Qt Designer and replace QMainWindow to QDialog. Then remove <widget class="QWidget" name="centralwidget"> element and correspondent closing tag. Then fix cpp/h accordingly.

Log in to reply