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. QDockWidget inside MDI area
QtWS25 Last Chance

QDockWidget inside MDI area

Scheduled Pinned Locked Moved Solved General and Desktop
qdockwidgetqmainwindowmdiarea
7 Posts 3 Posters 992 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.
  • SavizS Offline
    SavizS Offline
    Saviz
    wrote on last edited by
    #1

    I have a requirement where I need to create multiple sub-windows inside the main window for different sections of my program.

    I originally thought about using QDockWidgets because they accomplish this in a great way, allowing the user to drag and drop them into different sections and monitors. But, the only issue is that I cannot seem to place a dock in the central widget area of the main window. I tried hiding and placing dummy widgets inside the central widget (To stop it from displaying and taking up space in my program), but the results are not satisfying.

    I did notice Qt offers a MDI area widget, but I cannot seem to place dock widgets inside of it.

    Any solutions to my problem please?

    C 1 Reply Last reply
    0
    • SavizS Saviz

      @Abderrahmene_Rayene I will look into it and see if it works. Thank you for this suggestion. But, as far as I can remember in the designer I can only define what the layout of the central widget will be (I don't think I can replace the central widget with the MDI area)

      C Offline
      C Offline
      CPPUIX
      wrote on last edited by
      #6

      @Saviz said in QDockWidget inside MDI area:

      I don't think I can replace the central widget with the MDI area

      Do it from your code, I don't think you should be trying to achieve this with Designer.

      1 Reply Last reply
      1
      • SavizS Saviz

        I have a requirement where I need to create multiple sub-windows inside the main window for different sections of my program.

        I originally thought about using QDockWidgets because they accomplish this in a great way, allowing the user to drag and drop them into different sections and monitors. But, the only issue is that I cannot seem to place a dock in the central widget area of the main window. I tried hiding and placing dummy widgets inside the central widget (To stop it from displaying and taking up space in my program), but the results are not satisfying.

        I did notice Qt offers a MDI area widget, but I cannot seem to place dock widgets inside of it.

        Any solutions to my problem please?

        C Offline
        C Offline
        CPPUIX
        wrote on last edited by
        #2

        Hi,

        @Saviz said in QDockWidget inside MDI area:

        I did notice Qt offers a MDI area widget

        Did you try to set QMdiArea as your main window's central widget?

        @Saviz said in QDockWidget inside MDI area:

        but I cannot seem to place dock widgets inside of it.

        And then add your dock widgets to it as sub windows?

        This is just a suggestion, I'm not sure I understand what you need, or if what I'm suggesting is correct, but give it a try.

        Here's where I'm coming from: QMdiArea, QMdiArea::addSubWindow

        SavizS SGaistS 2 Replies Last reply
        1
        • C CPPUIX

          Hi,

          @Saviz said in QDockWidget inside MDI area:

          I did notice Qt offers a MDI area widget

          Did you try to set QMdiArea as your main window's central widget?

          @Saviz said in QDockWidget inside MDI area:

          but I cannot seem to place dock widgets inside of it.

          And then add your dock widgets to it as sub windows?

          This is just a suggestion, I'm not sure I understand what you need, or if what I'm suggesting is correct, but give it a try.

          Here's where I'm coming from: QMdiArea, QMdiArea::addSubWindow

          SavizS Offline
          SavizS Offline
          Saviz
          wrote on last edited by Saviz
          #3

          @Abderrahmene_Rayene I will look into it and see if it works. Thank you for this suggestion. But, as far as I can remember in the designer I can only define what the layout of the central widget will be (I don't think I can replace the central widget with the MDI area)

          C 1 Reply Last reply
          0
          • C CPPUIX

            Hi,

            @Saviz said in QDockWidget inside MDI area:

            I did notice Qt offers a MDI area widget

            Did you try to set QMdiArea as your main window's central widget?

            @Saviz said in QDockWidget inside MDI area:

            but I cannot seem to place dock widgets inside of it.

            And then add your dock widgets to it as sub windows?

            This is just a suggestion, I'm not sure I understand what you need, or if what I'm suggesting is correct, but give it a try.

            Here's where I'm coming from: QMdiArea, QMdiArea::addSubWindow

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Hi,

            QDockWidget cannot go in the central area because they have defined area to be docked in.

            You might want to check KDAB's KDDockWidgets.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            SavizS 1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

              QDockWidget cannot go in the central area because they have defined area to be docked in.

              You might want to check KDAB's KDDockWidgets.

              SavizS Offline
              SavizS Offline
              Saviz
              wrote on last edited by
              #5

              @SGaist Thank you. I am already aware that dock widgets will not go in the area of the central widget. But, my question was is it possible to place them in a MDI area.

              SGaistS 1 Reply Last reply
              0
              • SavizS Saviz

                @Abderrahmene_Rayene I will look into it and see if it works. Thank you for this suggestion. But, as far as I can remember in the designer I can only define what the layout of the central widget will be (I don't think I can replace the central widget with the MDI area)

                C Offline
                C Offline
                CPPUIX
                wrote on last edited by
                #6

                @Saviz said in QDockWidget inside MDI area:

                I don't think I can replace the central widget with the MDI area

                Do it from your code, I don't think you should be trying to achieve this with Designer.

                1 Reply Last reply
                1
                • SavizS Saviz

                  @SGaist Thank you. I am already aware that dock widgets will not go in the area of the central widget. But, my question was is it possible to place them in a MDI area.

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @Saviz not directly no, that's something you need to build on top of it.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • SavizS Saviz has marked this topic as solved on

                  • Login

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