A
A
Anton2015-11-20 23:25:52
Qt
Anton, 2015-11-20 23:25:52

Is it possible to close one main window and open a new one (Qt)?

Hello!
There is a main window in which authorization takes place. I would like that after successful authorization (after the login and password verification stage), the first window closes and a new one opens.
The class of the first window is called WelcomeWindow, and the class of the second window is called MainWindow. Both of them were created in Qt as main ones.
How to implement it? I tried to prescribe in WelcomeWindow:

MainWindow mw;
mw.show();

As in main.cpp, but it didn't work. There is a wish to fasten a window directly with the visual Qt editor.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Taratin, 2015-11-20
@Taraflex

We set the window attribute
Qt::WA_QuitOnClose ( www.doc.crossplatform.ru/qt/4.7.x/qt.html#WidgetAt... ) to false so that the application does not close after the window is closed.
doc.qt.io/qt-4.8/qwidget.html#setAttribute

J
Jacob E, 2015-11-21
@Zifix

Excuse me, but why do you need two main windows? What did the same QDialog as the basis of the login form not please?

I
Igor, 2015-11-22
@unitby

You can, as Comrade Alexander Taratin described. But in general, you have an error in the architecture. Depending on the task, you need either a child welcom (the main one in hide) or QSplashScreen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question