Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt-creator : Recommanded way to create a window to integrate an mdiarea [Solved]
QtWS25 Last Chance

Qt-creator : Recommanded way to create a window to integrate an mdiarea [Solved]

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 3 Posters 2.7k 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.
  • A Offline
    A Offline
    aCOSwt
    wrote on last edited by
    #1

    I get one project A with, for the time being one form.
    In this form is defined an mdiarea.
    I now want to design the widgets that the mdiarea will host.

    How should I proceed : Add New > Qt > Qt Designer Form Class ? Qt Designer Form ?

    Being said that, if possible, I'd like to make so these "sub" widgets can be launched "on their own" (as main windows) of other standalone applications, should I even prefer creating a new independent project for each one of these "sub"widgets?

    I apologize for not using the exact terminology. I am completely new to qt.

    1 Reply Last reply
    0
    • francescmmF Offline
      francescmmF Offline
      francescmm
      wrote on last edited by
      #2

      You can create widgets at your own like "Qt Designer Form Class" and then add to a QMdiArea. The way to do this should be:

      subWindowWidget = ui.mdiArea->addSubWindow(treeView,Qt::Widget);
      subWindowWidget->show();

      In this methods, "treeView" is a personalized QTreeView with a performed .ui, .cpp and .h.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MianKashifAli
        wrote on last edited by
        #3

        [quote author="francescmm" date="1360145954"]You can create widgets at your own like "Qt Designer Form Class" and then add to a QMdiArea. The way to do this should be:

        subWindowWidget = ui.mdiArea->addSubWindow(treeView,Qt::Widget);
        subWindowWidget->show();

        In this methods, "treeView" is a personalized QTreeView with a performed .ui, .cpp and .h.

        [/quote]

        if you want to execute each widget separately then it could be more work required for developing your required app.

        1 Reply Last reply
        0
        • francescmmF Offline
          francescmmF Offline
          francescmm
          wrote on last edited by
          #4

          It is no true. If you want to execute each QWidget independently you only have to do widget.show() importing the .cpp and .h to the project you want.

          The best way to insert widgets to a QMdiArea is creating a class member with a list of QMdiSubWindow pointers to each window.

          If you need more information I can post my code.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aCOSwt
            wrote on last edited by
            #5

            [quote author="francescmm" date="1360145954"]You can create widgets at your own like "Qt Designer Form Class" and then add to a QMdiArea. The way to do this should be:

            subWindowWidget = ui.mdiArea->addSubWindow(treeView,Qt::Widget);
            subWindowWidget->show();

            In this methods, "treeView" is a personalized QTreeView with a performed .ui, .cpp and .h.
            [/quote]
            This was helpful! Thank you, francescmm for your contribution.
            [quote]if you want to execute each widget separately then it could be more work required for developing your required app.[/quote]
            Well... I appreciate this... however, as my first goal is to learn... I am already ready to add (even uselessly) unneeded extra work.
            [quote author="francescmm" date="1360145954"]If you need more information I can post my code.[/quote]
            That is very kind from you. I am much tempted to answer "Oh yes please!" but reason commands me to first try to figure this out by myself from the help you provided in your first post.

            I wont resist anyway in the unfortunate (but highly probable) case I just fail.

            1 Reply Last reply
            0
            • francescmmF Offline
              francescmmF Offline
              francescmm
              wrote on last edited by
              #6

              I recommend you that if your problem/dubt has been solved, type "(solved)" in the title of the topic.

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

                OK, I managed to sort this out.
                I had a compilation error with the line :
                @subWindowWidget->show();@
                Complaining that the subWindowWidget's structure was only partial or something like that anyway, so I amended your code the following way :
                @Ps_Detview *ps_detview = new Ps_Detview;
                ui->Pctrl_Mda->addSubWindow(ps_detview);
                ps_detview->show();@
                I cannot tell if this is formally correct but... it builds and... work !

                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