I spoke too soon... I unchecked "docked" in Designer, and checked it again, and now the QDockWidget is again stuck with dockWidgetArea = LeftDockWidgetArea even though allowedAreas = RightDockWidgetArea.
I spoke too soon... I unchecked "docked" in Designer, and checked it again, and now the QDockWidget is again stuck with dockWidgetArea = LeftDockWidgetArea even though allowedAreas = RightDockWidgetArea.
Are we talking about Designer itself or your application that was designed in Designer?
Are we talking about Designer itself or your application that was designed in Designer?
Designer itself.
It seems like something in the .ui file is forcing the QDockWidget to the left dock area whenever "docked" has been unchecked, and is than checked again. However, I looked in the .ui file and didn't see anything relevant, for either the QDockWidget or main window.
I can't change the dock area in Visual Studio, either, it turns out. If I set "Docked" to False so that I can position the QDockWidget, and click on "RightDockWidgetArea" from the "DockWidgetArea" pick list, the field stays set to "LeftDockWidgetArea."
I also notice that, in Designer, "dockWidgetArea" is never changeable, but in Visual Studio, the field is able to be changed, when "Docked" is True. (Bus as soon as "Docked" is again set to False, the DockWidgetArea reverts to left.)
Am I missing some property that needs to be set?
Also, if I don't check the "docked" check box, then the QDockWidget stays where I put it, on the right. However, when not set to docked, each time the QDockWidget is undocked, and then docked again, its docked location is to the right of, and below, the last docked position. (This is in the application.)
Am I missing something?
Thanks in advance...
Martin
Which dock widget are we talking about? The widget box? I'm using Qt 4.4.3 and it seems I am able to move any of Designer dock widgets into any position and undocking and docking it again works as expected.
Its a "QDockWidget" from "Widget Box -> Containers -> Dock Widget" in Designer.
Maybe I don't have the dock widget's properties set correctly?
I've kind of decided to leave the dock widget on the left for aesthetic reasons, and I can get a layout I like if "docked" isn't checked. As soon as I check docked, the QDockWidget reverts to its original size and position.
Also, any advice as to how to do the following would be appreciated:
- Dock widget on upper left, resizes horizontally and vertically as the main window is dragged. (This contains an Open Inventor SoQtRenderArea.)
- Controls (buttons, etc.) below the dock widget, and to the right of the dock widget. These should stay fixed in size; the main window shouldn't be able to get smaller than the controls.
I'm looking at the Examples and Demos, but don't see anything that helpful done in Designer.
Thanks in advance,
Martin
So it's about an application developed in Designer not Designer itself...
I would not use dock widgets from within designer at all. Design your docs as regular widgets and then embed them into dock widgets using hand written code. I'm not even sure if the dock widget available in Designer can be correctly used as a child widget at all.
Actually, there are two questions at this point. The one about Designer is why doesn't it allow me to move the QDockWidget to a new docking area.
Regarding the dock widget in the software I'm developing, as opposed to the Designer question, the dock widget is in the main window, not inside another widget. I actually am embedding an SoQtRenderArea inside the dock widget.
Martin
Because dock widgets are controlled by QMainWindow's layout. If you place a dock widget as a regular widget using the Designer, there is no layout to control it (even if you place it inside a QMainWindow).
What is the exact question regarding this one?Regarding the dock widget in the software I'm developing, as opposed to the Designer question, the dock widget is in the main window, not inside another widget. I actually am embedding an SoQtRenderArea inside the dock widget.
Dragging a dock widget from Designer's toolbox into one of the main window's docking areas turns the dock widget into a regular widget?
I have a QDockWidget that was originally set for "allowedArea LeftDockWidgetArea" in Designer. I tried to reposition the dock widget to RightDockWidgetArea by checking Designer's check box for that docking area and unchecking the check box for the left dock area. However, Designer's "dockWidgetArea" (the properties field in Designer directly above the "docked" check box) remained set to LeftDockWidgetArea and the dock widget continues to dock in the left dock area.
This usually works, so my question is what about this particular .ui is preventing moving the dock widget to a new docking area. Is there something in the .ui file that Designer isn't showing me that needs to be edited (I looked and didn't see anything that appeared to be relevant), is there some combination of properties for the dock widget and/or main window that I have wrong or is this a bug in Designer?
Are you sure you are dragging it into a docking area? You are dropping the widget onto the main window's central widget, not the main window itself. Check the object hierarchy - the dock widget is child of the central widget, not the child of the main window itself, at least in my 4.4.3 Designer.
Only after you mark the "docked" property, the widget gets docked, but I'd say that the only thing that can be done with it.
There are many hacks in Designer. You might call their behaviour "bugs", I call them "lack of functionality". Try previewing - then you'll see the difference. You'll be able to dock the window into any of the selected dock areas without a problem. Actually my Designer allows to do what you ask for - drag to left dock, change "dockWidgetArea" to right and deselect left from allowed dock widget areas - the widgets stays at the right. If you make it float and dock it back again, it breaks by going back to the left but that's where you actually docked it, remember? Lack of functionality, I guess. But yeah, you may report it as a bug, just check if it wasn't fixed already in 4.5-beta1 or any of the recent snapshots.This usually works, so my question is what about this particular .ui is preventing moving the dock widget to a new docking area. Is there something in the .ui file that Designer isn't showing me that needs to be edited (I looked and didn't see anything that appeared to be relevant), is there some combination of properties for the dock widget and/or main window that I have wrong or is this a bug in Designer?
I really would advise against placing dock widgets in Designer - don't clutter your view.
martinb0820 (9th January 2009)
I didn't see your reply quoted above when I added mine about having found an answer. Having figured out how it works, I understand now what you mean about the dock widget being a child of the central widget. This does become clear looking at the object heirarchy in the Object Inspector.
Your earlier reply about child widgets got me thinking along the lines that led to a workable solution - thanks for your input!
Martin
I think I figured out the one about making the QDockWidget resize properly. I'll post the answer in another thread I started about resizing a QDockwidget. The Designer issue isn't holding me up, so I'm not going to pursue it at this point.
Bookmarks