Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    Tools
    3
    7
    2416
    Loading More Posts
    • 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
      aCOSwt last edited by

      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 Reply Quote 0
      • francescmm
        francescmm last edited by

        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 Reply Quote 0
        • M
          MianKashifAli last edited by

          [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 Reply Quote 0
          • francescmm
            francescmm last edited by

            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 Reply Quote 0
            • A
              aCOSwt last edited by

              [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 Reply Quote 0
              • francescmm
                francescmm last edited by

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

                1 Reply Last reply Reply Quote 0
                • A
                  aCOSwt last edited by

                  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 Reply Quote 0
                  • First post
                    Last post