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. [SOLVED]QMainwindow
Qt 6.11 is out! See what's new in the release blog

[SOLVED]QMainwindow

Scheduled Pinned Locked Moved General and Desktop
qmainwindowqwidget
14 Posts 3 Posters 5.6k Views 2 Watching
  • 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.
  • mrjjM mrjj

    @Gillou_beginqt

    Well, you can show any window from any window.
    Have a look at this mini sample and tell me if that is what you mean or
    you have other needs.

    https://www.dropbox.com/s/eq9b8np8alyu5gj/gilltest.zip?dl=0

    G Offline
    G Offline
    Gillou_beginqt
    wrote on last edited by
    #5

    @mrjj I want the main window to disappear when you click on win1 and reappear when home is clicked

    mrjjM 1 Reply Last reply
    0
    • G Gillou_beginqt

      @mrjj I want the main window to disappear when you click on win1 and reappear when home is clicked

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @Gillou_beginqt
      ok.
      here is one that does that using signals
      https://www.dropbox.com/s/ic7ecp8iql1xkje/gilltest2.zip?dl=0

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Ajith_P_V
        wrote on last edited by
        #7

        You can use "stacked widget" concept which do what you want.
        Please see the below documentation for more details.
        http://doc.qt.io/qt-4.8/qstackedwidget.html

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gillou_beginqt
          wrote on last edited by
          #8

          @mrjj Your answer is basically what i want to do. Thank you but with many sub windows of sub windows I'll difficult for me. The stackwidget seems adequate for my project
          @Ajith_P_V Can you elaborate? I tried the but my program stops

          A 1 Reply Last reply
          0
          • G Gillou_beginqt

            @mrjj Your answer is basically what i want to do. Thank you but with many sub windows of sub windows I'll difficult for me. The stackwidget seems adequate for my project
            @Ajith_P_V Can you elaborate? I tried the but my program stops

            A Offline
            A Offline
            Ajith_P_V
            wrote on last edited by
            #9

            @Gillou_beginqt Basically, stacked widget is a concept which will show either of the "page(or screen)" at a time. Create a widget project in Qt creator. Drag and drop the stacked widget item from the panel. Then in stacked widget, create your main window page followed by creating your sub window(s) as another page(s). In this way, while running your project, first your main window page will appear with your desired button. When you click on the button, set it to go to the next page (sub window) which also means that, the main window page will get disappear and new page will get displayed! . From your current window page, you can come back to your first page (Main window page) by click on "home" button clicked.

            Regards,
            Ajith P V

            G 1 Reply Last reply
            0
            • A Ajith_P_V

              @Gillou_beginqt Basically, stacked widget is a concept which will show either of the "page(or screen)" at a time. Create a widget project in Qt creator. Drag and drop the stacked widget item from the panel. Then in stacked widget, create your main window page followed by creating your sub window(s) as another page(s). In this way, while running your project, first your main window page will appear with your desired button. When you click on the button, set it to go to the next page (sub window) which also means that, the main window page will get disappear and new page will get displayed! . From your current window page, you can come back to your first page (Main window page) by click on "home" button clicked.

              Regards,
              Ajith P V

              G Offline
              G Offline
              Gillou_beginqt
              wrote on last edited by
              #10

              @Ajith_P_V But If I already created different QWidget windows separately and I want to use the QStacked widget. How can I do it ?

              mrjjM 1 Reply Last reply
              0
              • G Gillou_beginqt

                @Ajith_P_V But If I already created different QWidget windows separately and I want to use the QStacked widget. How can I do it ?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #11

                @Gillou_beginqt

                Hi
                If you created UI files that are based on Widget as parent, you could
                place a Widget on the stack page, and use the promote feature (right click)
                to get the widgets into the stacked.

                G 1 Reply Last reply
                0
                • mrjjM mrjj

                  @Gillou_beginqt

                  Hi
                  If you created UI files that are based on Widget as parent, you could
                  place a Widget on the stack page, and use the promote feature (right click)
                  to get the widgets into the stacked.

                  G Offline
                  G Offline
                  Gillou_beginqt
                  wrote on last edited by
                  #12

                  @mrjj I have 3 Pages 1 Qmainwindow and 2 sub windows Qwidget:

                  • Main window
                  • Movie widget
                  • Sport widget
                    I palced the QStackedWidget on my main waindow and placed all the widgets on page 1
                    On page 2 I promoted to a qwidget movie which is supposed to appear when you click on a button but nothing happens when I clicked
                  mrjjM 1 Reply Last reply
                  0
                  • G Gillou_beginqt

                    @mrjj I have 3 Pages 1 Qmainwindow and 2 sub windows Qwidget:

                    • Main window
                    • Movie widget
                    • Sport widget
                      I palced the QStackedWidget on my main waindow and placed all the widgets on page 1
                      On page 2 I promoted to a qwidget movie which is supposed to appear when you click on a button but nothing happens when I clicked
                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    @Gillou_beginqt
                    and you switch to the page with
                    ui->stackedWidget->setCurrentIndex(1); ?

                    Sounds like you are almost there.

                    have a look at this sample
                    https://www.dropbox.com/s/023mjp464ctdzsm/mystacked.zip?dl=0

                    G 1 Reply Last reply
                    1
                    • mrjjM mrjj

                      @Gillou_beginqt
                      and you switch to the page with
                      ui->stackedWidget->setCurrentIndex(1); ?

                      Sounds like you are almost there.

                      have a look at this sample
                      https://www.dropbox.com/s/023mjp464ctdzsm/mystacked.zip?dl=0

                      G Offline
                      G Offline
                      Gillou_beginqt
                      wrote on last edited by
                      #14

                      @mrjj Thank you !! It's working

                      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