Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Mainwindow layout change
Actually i face a problem while going form one Mainwindow to another Mainwindow..
suppose i have mainwindow name Mainwindow1 and another mainwindow name Mainwindow2...now on the pushbutton of Mainwindow1 when i want to go to Mainwindow2 then it works but the layout of the mainwindow changes..its size decreses..
the code i have wrritten in pushbutton of Mainwindow is..
MainWindow2 *m=new Mainwindow();
but when i perform same task by using diaglog its works fine..so whats the problem..if anyone please suggest..
Zlatomir last edited by
I can't say i understood your problem, but in the second main-window do you have a "container" QWidget as a parent of the rest of the Widgets (and layouts) and add that in the main-window using setCentralWidget?
And a second issue is that code you wrote will leak - the pointer m will get out of scope when the function ends and you can't delete the allocated MainWindow2 object (and you don't pass a parent that will delete that for you)
Also you have a typo: MainWindow 2 *m=new Mainwindow();
giesbert last edited by
There are more typos, the code should be:
MainWindow2 *m=new MainWindow2();
But i had try that also...result is same..is there any way to resolve this
its working..by using setCentralWidget.....