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 split size
QtWS25 Last Chance

QDockWidget split size

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdockwidgetsplitsize
13 Posts 4 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
    avmg
    wrote on last edited by
    #1

    Hi all,

    I'm trying to set the size from some QDockWidget tabs but I'm getting lost with so much information in the forum (QsizePolicy, QSplitter,...). For example, looking at the picture below I would like to not show the QDockWidget with the red square but keep the smaller width of the two marked with the blue squares. At the moment, if I don't paint the red QDockWidget the other two in blue are occupying the whole available screen space.

    2c9fedf4-cc01-445e-aed1-2efce1fd975f-image.png

    Thanks in advance!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      So you would like to keep the "empty space" occupied ?

      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
      0
      • gde23G Offline
        gde23G Offline
        gde23
        wrote on last edited by
        #3

        If you want the red are to not be a dockwidget then it will by default be the "central widget".
        If you then set the maximumSize of the Dockwidget to some value it wont be wider than that. Or if you put something into the central widget then it will also reclaim some space.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          avmg
          wrote on last edited by
          #4

          Hi,

          My target is to show a picture like a screen saver, and once the user clicks the blue docks then appears the dock in red color. So basically the logo can occupy all the space but the blue docks.

          I tried to set a maximum width to the dock but then the result becomes like this:
          edd5f29b-57bf-4144-8c5e-ce4adf3cb0ac-image.png

          I saw in another post that the solution could be related to the QSplitter, I've been playing with it as well without success....

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            It looks like you need a central widget for that, no ?

            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
            0
            • A Offline
              A Offline
              avmg
              wrote on last edited by avmg
              #6

              I have a central widget where I added the left tab plus the dock manager that contains the docks. But I can't find the way to set the default size of them, at the beginning they fill the whole space splitting it equally divided.

              SGaistS 1 Reply Last reply
              0
              • A avmg

                I have a central widget where I added the left tab plus the dock manager that contains the docks. But I can't find the way to set the default size of them, at the beginning they fill the whole space splitting it equally divided.

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

                @avmg said in QDockWidget split size:

                I have a central widget where I added the left tab plus the dock manager that contains the docks. But I can't find the way to set the default size of them, at the beginning they fill the whole space splitting it equally divided.

                That sounds like you are not using QMainWindow's feature.

                Can you show the code you are using ?

                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
                0
                • A Offline
                  A Offline
                  avmg
                  wrote on last edited by
                  #8

                  On the Design editor I've added a widget that contains a FancyTabBar, a QStackedWidget, and a QMenuBar, therefore it looks like this:
                  1dfe3b66-1b3f-4aba-adc4-3e05595e5bdc-image.png

                  Now typing this I have realized what @gde23 and @SGaist were asking for, the dock manager is inside a layout from one of the QStackedWidget pages, not the central widget. It's a bit confusing but basically the left side tab "FancyTabBar" functionality is to select the visible QStackedWidget page. Each of them has inside a dock manager and for example one of them has the three docks from the picture below (two blues plus the red).
                  8df9c2f4-5817-4277-87f0-2581ccbd86da-image.png

                  Here is an example on how I create the docks and I insert them into the dock manager and finally into the layout:

                  DockWidget_xy = new ads::CDockWidget("Mag-XY");
                  DockWidget_xz = new ads::CDockWidget("Mag-XZ");
                  DockWidget_yz = new ads::CDockWidget("Mag-YZ");
                  DockWidget_xy->setFeatures(ads::CDockWidget::DockWidgetFeature::DockWidgetMovable);
                  DockWidget_xz->setFeatures(ads::CDockWidget::DockWidgetFeature::DockWidgetMovable);
                  DockWidget_yz->setFeatures(ads::CDockWidget::DockWidgetFeature::DockWidgetMovable);
                  
                  auto DockArea_bottom = m_DockManager_mag->addDockWidget(ads::BottomDockWidgetArea, DockWidget_xy);
                      m_DockManager_mag->addDockWidget(ads::RightDockWidgetArea, DockWidget_xz,DockArea_bottom);
                      m_DockManager_mag->addDockWidget(ads::RightDockWidgetArea, DockWidget_yz,DockArea_bottom);
                  ui->layout_mag->addWidget(m_DockManager_mag);
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    But why not use QMainWindow's dock feature ?

                    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
                    0
                    • A Offline
                      A Offline
                      avmg
                      wrote on last edited by
                      #10

                      @avmg said in QDockWidget split size:

                      CDockWidget

                      Because this dock has a couple of things that were not possible on the "standard" version ( I can't remember exactly, maybe was only a graphical difference). The author says that all the properties are the same as the original dock feature. I saw the solution was something related to QSplitter but I haven't been able to achieve my goal yet.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        avmg
                        wrote on last edited by
                        #11

                        Hi again,

                        So far I couldn't find a solution to this. I have seen quite many people asking for the same thing but there are no solutions, resize(int w, int h) is not changing anything, might be some way to set the initial size of the docks...¿?

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Did you check the KDDockWidgets project ? They might have your issue handled.

                          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
                          0
                          • N Offline
                            N Offline
                            NupurS
                            wrote on last edited by
                            #13

                            is there any solution for setting Initial Width of QDockWidget in Qt 6 C++ without affecting splitter behavior yet?

                            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