I'm new to qt programming and would like to know how to open a new window from the main window with the mainwindow disappearing? Is there any source code I can have a look at?
From a slot in your MainWindow call this code :
QWidget *wdg = new QWidget;
wdg->show();
hide();//this will disappear main window
In mainwindow.h
Declare nw object of class NewWindow as below
NewWindow *nw = new NewWindow();
(Lets say we will open NewWindow, once the button1 is clicked on MainWindow)
Then in on_pushButton_1_clicked()
slot of class MainWindow:
void MainWindow::on_pushButton_1_clicked(){
nw->show();
this->hide();
}
try this instead
this-> hide();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With