Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 564393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:45:42+00:00 2026-05-13T12:45:42+00:00

I have an application with the following UI forms deriving from QMainWindow LoginWindow TasksWindow

  • 0

I have an application with the following UI forms deriving from QMainWindow

  • LoginWindow
  • TasksWindow
  • DetailsWindow

I’m supposed to login into the application in the LoginWindow where I will move to the TasksWindow. In the TasksWindow, I will choose an item from a combo box, and then I should move to the DetailsWindow and populate data related to that item. On the DetailsWindow, I will have a menu action to return me back to the TasksWindow.

Currently, what I have in mind (and what I’ve tried) is this. In the main.cpp:

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    LoginWindow loginWindow;
    loginWindow.showMaximized();

    return app.exec();
}

And in the LoginWindow push button:

void LoginWindow::on_loginButton_clicked()
{
        this->hide(); // hide the login window
        TasksWindow tasksWindow;
        tasksWindow.showMaximized();
}

is there a better way to do this? It is becoming unmanageable as now I have to include a reference to each window class that I’m supposed to go to, possibly creating circular references!

Note that I’m doing this and compiling the application to be a Qt Symbian application.

What is the best way to switch between application windows? I thought about using a QStackedWidget before, and actually tried it, but the problem then is that I would have to write all the code for handling the different events in the same file and also, the action menus are different across the windows.

Help! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:45:42+00:00Added an answer on May 13, 2026 at 12:45 pm

    My suggestion is to use State Machine to manager all your status. It’s fairly easy to extend also.

    1. Read the State Machine Framework documents in Qt Help.
    2. After you have some basic knowledge on Qt state machine framework, you may understand the approach below.

    a.) Define necessary state, e.g. Guest, Logged In, Logged Out. You may have 3 dialogs (I defined an additional logged out dialog here) for each state, connect the state entered signal to dialog show slot, and connect state exited signal to dialog hide slot. In this way you don’t need to worry about when to show/hide a dialog, just focus on the transition of states.

    b). Define signals for dialogs, for example, signal “loggedIn” for loginWindow, signal “loggedOut” for TasksWindow, add a transition trigged by signal “loggedIn” from state Guest to Logged in.

    c). So the initial state of the state machine is “guest”, when this state entered, your loginWindow shows up. After log in information has been verfied, a “loggedIn” signal emitted, and the state of the machine will change from “guest” to “Logged In”, so the loginWindow will be hide when “Guest” state exited, and your TasksWindow will show up when “Logged In” state entered.

    d). You may end the session by clicking “log out” in your TasksWindow, also what you need to do is to define trisitions for states change.

    e). A trick here: You can define a final state and connect the “finished” or “stopped” signal of the state machine to your application “quit” slot. Then after you have done all the things, the application will be closed automatically by state machine.

    Easy to maintence and extend, and the logic is very clear by using state machine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following line of code for a Windows forms application: return Encoding.ASCII.GetBytes(chars.ToArray());
I have the following situation: I have an application that collects some data from
In my c# win-forms application, I have changed the following line in Main() Application.Run(new
I have the following projects: MVC Console application Class library Windows forms application COM
I have an MVC application with the following block inside in Web.config: <authentication mode=Forms>
I have an ASP.NET MVC 3 application with the following web.config settings. <authentication mode=Forms>
I have the following working code in a Win Forms application: Bitmap bitmap =
I am getting the following error on a Windows Forms application that I have
I have only just started received the following error in my windows forms application
I have an application that has a few different forms. From the main form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.