QDockWidget inside MDI area
-
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?
-
@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.
-
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
-
@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)
-
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.
-
@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.
-