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.
  • S Offline
    S Offline
    Saviz
    wrote on 15 May 2023, 16:57 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 15 May 2023, 18:12
    0
    • S Saviz
      15 May 2023, 18:28

      @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 15 May 2023, 18:38 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
      • S Saviz
        15 May 2023, 16:57

        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 15 May 2023, 18:12 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

        S S 2 Replies Last reply 15 May 2023, 18:28
        1
        • C CPPUIX
          15 May 2023, 18:12

          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

          S Offline
          S Offline
          Saviz
          wrote on 15 May 2023, 18:28 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 15 May 2023, 18:38
          0
          • C CPPUIX
            15 May 2023, 18:12

            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

            S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 15 May 2023, 18:30 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

            S 1 Reply Last reply 15 May 2023, 18:33
            1
            • S SGaist
              15 May 2023, 18:30

              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.

              S Offline
              S Offline
              Saviz
              wrote on 15 May 2023, 18:33 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.

              S 1 Reply Last reply 15 May 2023, 18:42
              0
              • S Saviz
                15 May 2023, 18:28

                @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 15 May 2023, 18:38 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
                • S Saviz
                  15 May 2023, 18:33

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

                  S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 15 May 2023, 18:42 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
                  • S Saviz has marked this topic as solved on 15 May 2023, 20:54

                  2/7

                  15 May 2023, 18:12

                  topic:navigator.unread, 5
                  • Login

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