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
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QMainwindow

Scheduled Pinned Locked Moved General and Desktop
qmainwindowqwidget
14 Posts 3 Posters 5.0k 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.
  • G Gillou_beginqt
    31 Aug 2015, 15:56

    @mrjj I want to create navigational button between the main window and subwindows

    M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 31 Aug 2015, 17:52 last edited by
    #4

    @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 1 Reply Last reply 1 Sept 2015, 03:44
    0
    • M mrjj
      31 Aug 2015, 17:52

      @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 1 Sept 2015, 03:44 last edited by
      #5

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

      M 1 Reply Last reply 1 Sept 2015, 06:51
      0
      • G Gillou_beginqt
        1 Sept 2015, 03:44

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

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 1 Sept 2015, 06:51 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 1 Sept 2015, 11:38 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 1 Sept 2015, 19:13 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 4 Sept 2015, 11:00
            0
            • G Gillou_beginqt
              1 Sept 2015, 19:13

              @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 4 Sept 2015, 11:00 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 4 Sept 2015, 14:56
              0
              • A Ajith_P_V
                4 Sept 2015, 11:00

                @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 4 Sept 2015, 14:56 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 ?

                M 1 Reply Last reply 4 Sept 2015, 16:34
                0
                • G Gillou_beginqt
                  4 Sept 2015, 14:56

                  @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 ?

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 4 Sept 2015, 16:34 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 4 Sept 2015, 19:32
                  0
                  • M mrjj
                    4 Sept 2015, 16:34

                    @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 4 Sept 2015, 19:32 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
                    M 1 Reply Last reply 5 Sept 2015, 07:33
                    0
                    • G Gillou_beginqt
                      4 Sept 2015, 19:32

                      @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
                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 5 Sept 2015, 07:33 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 5 Sept 2015, 13:17
                      1
                      • M mrjj
                        5 Sept 2015, 07:33

                        @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 5 Sept 2015, 13:17 last edited by
                        #14

                        @mrjj Thank you !! It's working

                        1 Reply Last reply
                        0

                        13/14

                        5 Sept 2015, 07:33

                        • Login

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