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. MDI application with multiple Forms
QtWS25 Last Chance

MDI application with multiple Forms

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 4 Posters 3.9k 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.
  • N Offline
    N Offline
    Nishanth
    wrote on 18 Aug 2018, 07:25 last edited by
    #1

    Hi,

    I am looking to develop an MDI application with multiple ui forms in QT C++, a basic user management application for storing multiple user information.

    Starting from a login form where in the user logs in and then the next form where in the user enters information in multiple textboxes and then save into a file. I am having trouble creating a MDI application with multiple forms like this as SDI application doesnt serve my purposes.

    Can anyone direct me to an example or share the source code, where in I can load multiple predesigned forms inside a MDI in QT.

    Thank you,
    Nishanth

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gerd
      wrote on 18 Aug 2018, 07:47 last edited by
      #2

      look here

      MDI Example

      N 1 Reply Last reply 19 Aug 2018, 06:24
      3
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 18 Aug 2018, 09:29 last edited by
        #3

        Hi
        When you say MDi, we think of mutiple windows type embedded
        in the same app. shown at same time.
        From your description, it sounds more like a wizard type of
        sequence. Fill in X, press next Fill in Y, then press save.
        Which a
        http://doc.qt.io/qt-5/qstackedwidget.html
        is super for.
        Or even
        http://doc.qt.io/qt-5/qwizard.html

        N 1 Reply Last reply 19 Aug 2018, 06:09
        3
        • M mrjj
          18 Aug 2018, 09:29

          Hi
          When you say MDi, we think of mutiple windows type embedded
          in the same app. shown at same time.
          From your description, it sounds more like a wizard type of
          sequence. Fill in X, press next Fill in Y, then press save.
          Which a
          http://doc.qt.io/qt-5/qstackedwidget.html
          is super for.
          Or even
          http://doc.qt.io/qt-5/qwizard.html

          N Offline
          N Offline
          Nishanth
          wrote on 19 Aug 2018, 06:09 last edited by
          #4

          @mrjj I would say so.. I have developed a set of UI forms but they are in SDI format, which are activated by clicking the button clicks on the respective forms, but not menu driven, which is not convenient for going back and forth.

          So I am designing a menu driven app which will contain all the forms within the MDI allowing only a single instance of each window after the login.

          For example, I will start of the application with the login screen and according to the type of users will allow access to certain screens by enabling and disabling of the menu items and then after that I will logout which will take me back to the login screen. which is more user friendly to the end users.

          It is not a wizard as you suggested, i.e. operation on the single screens will start and end there, for the next screen the user will have to go to the menu item and select and invoke the screens. But all will be interacting with the same data source (text/ xml / DB).

          I am having trouble invoking the multiple forms within the MDI.. The example with the Qt creator shows a text editor it is sort of a repeater for the same form. where as I want a select set of forms within the MDI container invoked from the menu.

          Will look into the link you have pointed out, if possible let me know if you find a tutorial or example to the problem I have explained.

          Thank you.

          1 Reply Last reply
          0
          • G Gerd
            18 Aug 2018, 07:47

            look here

            MDI Example

            N Offline
            N Offline
            Nishanth
            wrote on 19 Aug 2018, 06:24 last edited by Nishanth
            #5

            @Gerd I have looked into the example, it is more of a text editor which can be invoked multiple times, My requirement is invoking of predetermined and pre designed UI forms with a selection of text fields for editing and saving information into a data source. I will look into the example again and see if I can get some help with the problem I am working on.
            looks like the terminology used is slightly different to the one used in .net development, hopefully I could clarify.
            Thank you.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 19 Aug 2018, 06:28 last edited by mrjj
              #6

              Hi
              It sounds like something stackedwidget would work for.
              These different forms-will they need to be shown at same time inside app, or will it always be just one that is visible? and u can navigate between them inside the app/same area.

              try this fast sample
              it has stacked and 3 forms it switches between.
              https://www.dropbox.com/s/00chu3zefptjkr7/mdiwithstacked.zip?dl=0

              alt text
              alt text

              N 1 Reply Last reply 20 Aug 2018, 05:30
              2
              • M mrjj
                19 Aug 2018, 06:28

                Hi
                It sounds like something stackedwidget would work for.
                These different forms-will they need to be shown at same time inside app, or will it always be just one that is visible? and u can navigate between them inside the app/same area.

                try this fast sample
                it has stacked and 3 forms it switches between.
                https://www.dropbox.com/s/00chu3zefptjkr7/mdiwithstacked.zip?dl=0

                alt text
                alt text

                N Offline
                N Offline
                Nishanth
                wrote on 20 Aug 2018, 05:30 last edited by
                #7

                @mrjj Hi, I looked into the code you shared, it is not what I had in mind, I need the application to be menu driven.
                I should be able to choose the UI form based on the user selection in the menubar.
                For example I want to have Appmenu under which I will have the options, Login, form1, form2, form3, Logout, Exit.

                So at the app start the user will be shown the login form and once he logs in he will be able to choose any one of the forms from the menu or all the forms available in the menu.

                I would say the Login, form1, form2, form3 are all mdichild forms which are contained within the MDIParent whenever invoked. I am yet to come across an example which explains the process.

                I am not sure if stacked widgets is going to help me with that.

                The MDI example available with the Qt package doesnt use forms UI as it is a text editor, which has a MDI parent and the text editors being the MDI Childs. wish Qt had an example along the similar lines but with forms.

                Thanks for looking into the issue, if you find a solution please do post.

                J M 2 Replies Last reply 20 Aug 2018, 05:40
                0
                • N Nishanth
                  20 Aug 2018, 05:30

                  @mrjj Hi, I looked into the code you shared, it is not what I had in mind, I need the application to be menu driven.
                  I should be able to choose the UI form based on the user selection in the menubar.
                  For example I want to have Appmenu under which I will have the options, Login, form1, form2, form3, Logout, Exit.

                  So at the app start the user will be shown the login form and once he logs in he will be able to choose any one of the forms from the menu or all the forms available in the menu.

                  I would say the Login, form1, form2, form3 are all mdichild forms which are contained within the MDIParent whenever invoked. I am yet to come across an example which explains the process.

                  I am not sure if stacked widgets is going to help me with that.

                  The MDI example available with the Qt package doesnt use forms UI as it is a text editor, which has a MDI parent and the text editors being the MDI Childs. wish Qt had an example along the similar lines but with forms.

                  Thanks for looking into the issue, if you find a solution please do post.

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 20 Aug 2018, 05:40 last edited by
                  #8

                  @Nishanth said in MDI application with multiple Forms:

                  The MDI example available with the Qt package doesnt use forms UI

                  Well, it uses QTextWidget (I guess), which is a QWidget at the end. Just put your own widget there instead of the text edit.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  N 1 Reply Last reply 20 Aug 2018, 05:49
                  0
                  • J jsulm
                    20 Aug 2018, 05:40

                    @Nishanth said in MDI application with multiple Forms:

                    The MDI example available with the Qt package doesnt use forms UI

                    Well, it uses QTextWidget (I guess), which is a QWidget at the end. Just put your own widget there instead of the text edit.

                    N Offline
                    N Offline
                    Nishanth
                    wrote on 20 Aug 2018, 05:49 last edited by
                    #9

                    @jsulm I have explained why the MDI example doesn't provide the required solution to my problem in the previous threads. If it was just one widget as you told I would have got it over with, My requirement is multiple controls (widgets) which comprises of multiple text boxes and buttons in a UI form. and I have multiple UI forms.

                    J 1 Reply Last reply 20 Aug 2018, 05:51
                    0
                    • N Nishanth
                      20 Aug 2018, 05:49

                      @jsulm I have explained why the MDI example doesn't provide the required solution to my problem in the previous threads. If it was just one widget as you told I would have got it over with, My requirement is multiple controls (widgets) which comprises of multiple text boxes and buttons in a UI form. and I have multiple UI forms.

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 20 Aug 2018, 05:51 last edited by
                      #10

                      @Nishanth I know. The thing is: all these widgets you are talking about are placed on some widget (parent widget), right? So, create a custom widget where you put all these widgets and then put this custom widget (parent widget) where you need it...

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      N 1 Reply Last reply 20 Aug 2018, 06:00
                      2
                      • J jsulm
                        20 Aug 2018, 05:51

                        @Nishanth I know. The thing is: all these widgets you are talking about are placed on some widget (parent widget), right? So, create a custom widget where you put all these widgets and then put this custom widget (parent widget) where you need it...

                        N Offline
                        N Offline
                        Nishanth
                        wrote on 20 Aug 2018, 06:00 last edited by Nishanth
                        #11

                        @jsulm I have placed a MDIarea into the main window and have tried to load the forms created inside the main window, but it was not working. Maybe I am missing something here.
                        Maybe I am not used to the terminology used here, so in Qt, UI forms are widgets, controls (textboxes, labels, etc..) are widgets?
                        I will look around for the solution, hopefully should be able to figure it out.
                        Thanks.

                        J 1 Reply Last reply 20 Aug 2018, 06:04
                        0
                        • N Nishanth
                          20 Aug 2018, 06:00

                          @jsulm I have placed a MDIarea into the main window and have tried to load the forms created inside the main window, but it was not working. Maybe I am missing something here.
                          Maybe I am not used to the terminology used here, so in Qt, UI forms are widgets, controls (textboxes, labels, etc..) are widgets?
                          I will look around for the solution, hopefully should be able to figure it out.
                          Thanks.

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 20 Aug 2018, 06:04 last edited by
                          #12

                          @Nishanth Did you check the documentation and MDI example?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          2
                          • N Nishanth
                            20 Aug 2018, 05:30

                            @mrjj Hi, I looked into the code you shared, it is not what I had in mind, I need the application to be menu driven.
                            I should be able to choose the UI form based on the user selection in the menubar.
                            For example I want to have Appmenu under which I will have the options, Login, form1, form2, form3, Logout, Exit.

                            So at the app start the user will be shown the login form and once he logs in he will be able to choose any one of the forms from the menu or all the forms available in the menu.

                            I would say the Login, form1, form2, form3 are all mdichild forms which are contained within the MDIParent whenever invoked. I am yet to come across an example which explains the process.

                            I am not sure if stacked widgets is going to help me with that.

                            The MDI example available with the Qt package doesnt use forms UI as it is a text editor, which has a MDI parent and the text editors being the MDI Childs. wish Qt had an example along the similar lines but with forms.

                            Thanks for looking into the issue, if you find a solution please do post.

                            M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 20 Aug 2018, 06:14 last edited by mrjj
                            #13

                            @Nishanth
                            Well you could switch pages in stack widget with menus.

                            However, it sounds like you a really hooked on MDI.
                            Note, though. they draw win 7 style on win 8/9.

                            MDI can hold any widget, including forms.
                            The process is the same as inserting any other widget.

                            N 1 Reply Last reply 20 Aug 2018, 07:27
                            3
                            • M mrjj
                              20 Aug 2018, 06:14

                              @Nishanth
                              Well you could switch pages in stack widget with menus.

                              However, it sounds like you a really hooked on MDI.
                              Note, though. they draw win 7 style on win 8/9.

                              MDI can hold any widget, including forms.
                              The process is the same as inserting any other widget.

                              N Offline
                              N Offline
                              Nishanth
                              wrote on 20 Aug 2018, 07:27 last edited by
                              #14

                              @mrjj I am looking at MDI as it has a familiar feel to a lot of desktop applications I use, and meets the requirement. I just have to find a good tutorial or an example for what I am looking for in QT. I guess I am having beginners trouble with Qt. Couple of examples that with the documentations are implemented in a different way which I feel will not work for me. going through them I might just land on some thing that helps me.
                              Thanks.

                              M 1 Reply Last reply 20 Aug 2018, 07:46
                              0
                              • N Nishanth
                                20 Aug 2018, 07:27

                                @mrjj I am looking at MDI as it has a familiar feel to a lot of desktop applications I use, and meets the requirement. I just have to find a good tutorial or an example for what I am looking for in QT. I guess I am having beginners trouble with Qt. Couple of examples that with the documentations are implemented in a different way which I feel will not work for me. going through them I might just land on some thing that helps me.
                                Thanks.

                                M Offline
                                M Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on 20 Aug 2018, 07:46 last edited by
                                #15

                                @Nishanth
                                Hi
                                Can you perhaps show an image of such a desktop program you use?
                                Might help us pinpoint exactly what you are after.
                                Most app i use is not MDI in the old sense where is document is
                                a floating window inside the app. but more like stacked widget where I switch views.

                                Also check out
                                http://doc.qt.io/qt-5/qdockwidget.html

                                1 Reply Last reply
                                1
                                • N Offline
                                  N Offline
                                  Nishanth
                                  wrote on 20 Aug 2018, 15:35 last edited by Nishanth
                                  #16

                                  Qt Creator for one is a MDI application.. I think there are a lot of apps which are an MDI and I have seen desktop application like the one I am trying to develop in Qt developed in c#, vb.net for windows platforms as well.

                                  I have explained the requirement I am working on couple of times I really cannot be any more elaborate than I have been. Anyways thanks for your time. I am sure I will get to the solution.

                                  If I get a working solution I will maybe post a sample code later on. Till then the search is on.

                                  M 1 Reply Last reply 20 Aug 2018, 15:45
                                  0
                                  • N Nishanth
                                    20 Aug 2018, 15:35

                                    Qt Creator for one is a MDI application.. I think there are a lot of apps which are an MDI and I have seen desktop application like the one I am trying to develop in Qt developed in c#, vb.net for windows platforms as well.

                                    I have explained the requirement I am working on couple of times I really cannot be any more elaborate than I have been. Anyways thanks for your time. I am sure I will get to the solution.

                                    If I get a working solution I will maybe post a sample code later on. Till then the search is on.

                                    M Offline
                                    M Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on 20 Aug 2018, 15:45 last edited by
                                    #17

                                    @Nishanth
                                    Yep, its a multi view application but not a MDI app in the traditional sense.
                                    You can split a Editor view and see 2 or more at same time but the views do not have
                                    captions and decorations.
                                    For such design, QSplitter can be used to divide the client area into view.
                                    You can also use QDockWidgets which also can support multiple views
                                    and/or support floating windows.
                                    http://doc.qt.io/qt-5/qtwidgets-mainwindows-dockwidgets-example.html

                                    N 1 Reply Last reply 20 Aug 2018, 16:12
                                    2
                                    • M mrjj
                                      20 Aug 2018, 15:45

                                      @Nishanth
                                      Yep, its a multi view application but not a MDI app in the traditional sense.
                                      You can split a Editor view and see 2 or more at same time but the views do not have
                                      captions and decorations.
                                      For such design, QSplitter can be used to divide the client area into view.
                                      You can also use QDockWidgets which also can support multiple views
                                      and/or support floating windows.
                                      http://doc.qt.io/qt-5/qtwidgets-mainwindows-dockwidgets-example.html

                                      N Offline
                                      N Offline
                                      Nishanth
                                      wrote on 20 Aug 2018, 16:12 last edited by
                                      #18

                                      @mrjj I am looking at developing a MDI application in as you put it “traditional sense” which is probably very simple when compared to how other mdi application are from the requirement I have posted. Whatever suggestions you have suggested are pretty neat but it doesn’t really help me with my requirement.
                                      Thank you for taking the time to post.

                                      M 1 Reply Last reply 20 Aug 2018, 16:17
                                      0
                                      • N Nishanth
                                        20 Aug 2018, 16:12

                                        @mrjj I am looking at developing a MDI application in as you put it “traditional sense” which is probably very simple when compared to how other mdi application are from the requirement I have posted. Whatever suggestions you have suggested are pretty neat but it doesn’t really help me with my requirement.
                                        Thank you for taking the time to post.

                                        M Offline
                                        M Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on 20 Aug 2018, 16:17 last edited by mrjj
                                        #19

                                        @Nishanth
                                        Ok, then MDI area is best fit. Its 100% traditional :)
                                        alt text

                                        You can use any form/widget for the inner content.
                                        just use
                                        QMdiSubWindow *addSubWindow(QWidget *widget, Qt::WindowFlags flags = Qt::WindowFlags());
                                        to create new window where widget is your form object.

                                        1 Reply Last reply
                                        2

                                        7/19

                                        20 Aug 2018, 05:30

                                        topic:navigator.unread, 12
                                        • Login

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