Allowed areas for QDockWidgets
-
Hello,
I have a main window composed of several other main windows. Each of these main windows has at least one dock. I am wondering how to manage the distribution of the docks inside a specific main window. Specifically, I want to be able to distribute them flexibly, placing a dock at the top, bottom, left, or right, without binding it to a specific position, allowing for dynamic positioning in any of these four locations.
-
Hi and welcome to devnet,
The default value of the allowedAreas property of QDockWidget is
AllDockWidgetAreasso it should already cover your needs. -
Hi,
First of all thank you for taking the time to answer my question, but... When I add the Dock to the main window, am I not forced to choose an area when calling the 'addDockWidget' method?
This is a picture of my main window. It consists of a number of main windows, one at the bottom and two more at the top, one on the left and the other on the right. Right now I have 2 docks on the left main window and I want to be able to position them wherever I want within that main window. For example, I would like to move the dock containing the small table so that it is located to the left of the dock with the 'Send Hex' button and then being able to relocate that dock to the bottom of the other and then to the right... I am not sure if i'm being able to explain it clearly...

-
Yes you have to set the initial area, but nothing stops you from changing it afterward. You can even have several docks in the same area, they will be tabified.
-
It appears I may be doing something incorrectly. I can change the position of the dock widgets, but they are constrained to either top/bottom or left/right orientations. For instance, I am unable to move a widget from the top position to the left position.

I have created a custom QMainWindow class to perform additional functions my code requires, which is why it may appear different than usual. When I add the docks to the main window and launch the application, they are initially positioned top/bottom. I can then change their position to left/right, but I cannot reposition them to be one above the other. The only time they are displayed this way is at the initial launch of the application.
I have tried a lot of things but nothing seems to work. It is not a requirement for the docks can move to all position, but it would be pretty nice to have that.
Thanks again :)
-
You might want to check KDAB's KDDockWidgets. It's more flexible and might better suit your plans.