QDockWidget split size
-
Hi,
So you would like to keep the "empty space" occupied ?
-
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. -
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:
I saw in another post that the solution could be related to the QSplitter, I've been playing with it as well without success....
-
It looks like you need a central widget for that, no ?
-
@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 ?
-
On the Design editor I've added a widget that contains a FancyTabBar, a QStackedWidget, and a QMenuBar, therefore it looks like this:
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).
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);
-
But why not use QMainWindow's dock feature ?
-
@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.
-
Did you check the KDDockWidgets project ? They might have your issue handled.