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?
Thanks,
David
-
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.
greetz -
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.
-
I just had to do this (QT 6.3)
Edit the UI -> replace QMainWindow with QWidget.
Same for Class CPP & UI ...
My issue was I need to keep a constant "main menu" - I then found that my recently converted QWidget form had menu in the XML definition.
I cut this out, clean,qmake and run ... now I have a constant main-menu.
Easy fix - thanks to you starting me out in the right direction.
Tim