Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Move between windows
jrspepe last edited by
I'm new in QT. I'm trying to make an application with four differents windows. At start, the application show a login page. When log is sucessfull, I want to show the principal window. In this window, there are two buttons for go to the other two windows. I don't want open a new window, I want to change the window.
how can I move to another window? I have to use QT only c++.
I think that QWizard is not a good idea because from principal window I can go to two differents windows, and in QWizard this is not possible .
P.D.: Sorry for my bad English, but I only speak a bit of English. Thanks
thEClaw last edited by
I suggest you take a look at "QGuiApplication::topLevelWindows":http://qt-project.org/doc/qt-5.1/qtgui/qguiapplication.html#topLevelWindows (or "QGuiApplication::allWindows":http://qt-project.org/doc/qt-5.1/qtgui/qguiapplication.html#allWindows ) and "QWidget::setFocus":http://qt-project.org/doc/qt-5.1/qtwidgets/qwidget.html#setFocus.
Hi and welcome to devnet,
Basically you could need to start with a custom "QDialog":http://qt-project.org/doc/qt-4.8/qdialog.html for the login (or a "QInputDialog":http://qt-project.org/doc/qt-4.8/qinputdialog.html if you only need a password), if it's successful, show your main widget that could be a "QWidget":http://qt-project.org/doc/qt-4.8/qwidget.html containing e.g. a "QStackedWidget":http://qt-project.org/doc/qt-4.8/qstackedwidget.html for your two other window and underneath the two buttons to switch them. A "QTabWidget":http://qt-project.org/doc/qt-4.8/qtabwidget.html could also be alternative depending on your use case.
There are also other possibilities
Hope it helps