Hi everyone,
I'm building a gui that creates a mainwindow in which there are two toolbar icons, when you click on any of them a certain dialog should appear. I have done this but it is crashing because it's not closing one widget when the other one opens. I was wondering if there is a command that will clear the CentralWidget, so that the new dialog may open without crashing. Here's my code:
Qt Code:
void MainWindow::dialog1() { if (!dialog) { dialog = new Dialog1; } this->setCentralWidget( dialog ); dialog->show(); } void MainWindow::dialog2() { if (!dialog2) { dialog2 = new Dialog2; } this->setCentralWidget( dialog2 ); dialog2->show(); }To copy to clipboard, switch view to plain text mode
Bookmarks