Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Unsolved QDockWidget split size

    General and Desktop
    qdockwidget split size
    3
    12
    914
    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
      avmg last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

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

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

            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 Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

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

                SGaist 1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion @avmg last edited by

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

                    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 Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

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

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

                          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 Reply Quote 0
                          • SGaist
                            SGaist Lifetime Qt Champion last edited by

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