How to close first windows , and open different window but in the same application (l
Hello all
Until now I was developing Qt MainWindow and always stay in this window , changing the content with QStackedWidget
But now I need to do something like to skype , the flow is
user open first window the login window after successful login , the window closes
And new different window opens with the user friends , now maybe it’s the same first window
That changed its look totally .. I don’t know.
How I manage this in Qt ?
Re: How to close first windows , and open different window but in the same applicatio
it should be simple, once user logs in create a new window, and close the existing one.
Code:
void MainWindow::logInOk(void)
{
QWidget* new_window
= new NewWindow
("Username");
//you can have NewWindow based off QMainWindow.. any other QWidget() based class, or QWidget itself
this.close(); //to destroy
//this.hide(); // to reuse it sometime later;
}
Re: How to close first windows , and open different window but in the same applicatio
The suggestion in the post above is dangerous, and should NOT be done, since after MainWindow is destroyed and you get a dangling pointer, and a leak.
One way is to start with the main window hidden (but alive) and show a login dialog (which is NOT a child of the main window) and connect the finished() signal to MainWindow show() slot.
Re: How to close first windows , and open different window but in the same applicatio
Quote:
The suggestion in the post above is dangerous, and should NOT be done, since after MainWindow is destroyed and you get a dangling pointer, and a leak.
Yes, I agree on this