Switching between multiple ui forms in Qt

gfernandes picture gfernandes · Jan 10, 2014 · Viewed 13.2k times · Source

I am developing the user interface for a embedded device. I have created about 30 ui forms. You have first the Welcome form which loads the database and connects automatically to the available known wifi and all those start up functions. Once everything is loaded the next form to be loaded is the user login

So this is how I go about it, if Login is my second ui

//Instantiating the Login class
Login *myLog = new Login();

//Close the welcome class
this->close();

//open the Login class
myLog->show();

Is this the right way to switch between multiple UI? The software can be imagined like any smart phone device with multiple Icon buttons to open different apps. And each app or folder has a functionality of its own. I have a home button to move back to main menu homepage and so on. I have used the above given code to switch between various ui forms and I am not sure if this is the way to go about it. I am very new to Qt and I was asked to do this task within 2 weeks and I created the easiest way I found. Is there a better way to go about it?

Any help or guidelines is appreciated. If you could give me links to understand better it would be great

Thank you

EDIT enter image description here

Every ui form has a short cut panel for direct access to login, main menu, settings-power options, wifi options (within settings). The layout flow shown under 1 is similar to 2, 3 and settings. Sorry for the ugly image. The two way arrow indicates i can switch back and forth. The single arrow shows linear movement.

Answer

lpapp picture lpapp · Jan 10, 2014

Is there a better way to go about it?

I think so.

As noted in the comment, I would use a QStackedWidget myself.

I think this blog post explains how to establish "Home", "First" and so forth widgets inside it. This should be useful for you:

How to use Qstackedwidget in Qt (Switching between multiple views in Qt)