PDA

View Full Version : Change Widgets in the center of MainWindow.



Trader
23rd July 2010, 05:17
Hi guys,

I need your help!!! Attached is my project, I have 2 Widget Forms that open in the center of MainWindow, I have two problems:

1) when I change (using the icons in QToolBar) from one Widget to another repeatedly, get an error: Microsoft Visual C + + Runtime Library.

2) on Form mainwindow.ui, I can’t set correctly the layout Widget Forms to which they are displayed without changing the layout of MainWindow.

Please, thank you for any help.

ChrisW67
23rd July 2010, 05:46
1) when I change (using the icons in QToolBar) from one Widget to another repeatedly, get an error: Microsoft Visual C + + Runtime Library.

I have always considered this an error also ;)

Seriously though...

Your widget1 and widget2 objects are being deleted by the QMainWindow::setCentralWidget() when you set another widget to be the central one.

Have a look a QStackedWidget if you are just flipping between widgets. This should also help with your layout issues.