Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to switch forms?

How to switch forms?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 4.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    strgezer
    wrote on last edited by
    #1

    i'm new to QT development.
    i'm trying to write a multi-form application that will run on linux/android system.

    so, i read through the documentation, and am able to get a 'hello world' app running on my android box.
    then, put a few buttons/labels/displays on the main form. figure out how to hook up event handlers with the buttons.
    now, i make a second form.
    i want to be able to push the button and bring up the second form. (and more forms as my app progresses).
    can anyone tell me how to do this?

    thanks!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kxyu
      wrote on last edited by
      #2

      Qt on android? What kind of witchcraft is that?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        strgezer
        wrote on last edited by
        #3

        it's called neccessitas, and it works great.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          strgezer
          wrote on last edited by
          #4

          okay, so i did this in my event handler:

          Screen1 *screen1 = new Screen1();
          screen1->show();

          Screen1 is of course my other form. this works, except that the new form pops up like a dialog, leaving the original screen running. that's closer, but not quite what i want to do. what i want to do is replace the original ui, along with all it's controls & code.

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            qxoz
            wrote on last edited by
            #5

            You want hide parent form after showing Screen1, and after close Screen1 back the parent form?
            Did I understand you? If yes, maybe setVisible(bool); can be helpful.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Scylla
              wrote on last edited by
              #6

              Take a look at QStackedWidget!

              1 Reply Last reply
              0
              • S Offline
                S Offline
                strgezer
                wrote on last edited by
                #7

                hiding the main window probably isn't quite what i wanted to do.

                i want to be able to start the app with a home screen, then click a button and go to another screen. the second(and subsequent) screens will have their own controls, event handlers, etc. i then want to be able to switch to other screens, as well as return to the 'home' screen.

                i'll take a look at QStackedWidget, that sounds like it might be closer to what i wish to do.

                thanks for input, i'll report back what i discover here.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved