QDocWidget cannot move when undocked
-
-
-
I have added the QDocWidget using the designer, the movable properties is set to true, however the dockables don't seem to work when they are parented to a QHBoxLayout (using the designer). In the latter case they are unable to be dragged after they are undocked. Is there something I should do to allow dragging ? or - ehem - is that a bug ?
-
[quote author="farakon" date="1297820658"]I have added the QDocWidget using the designer, the movable properties is set to true, however the dockables don't seem to work when they are parented to a QHBoxLayout (using the designer).[/quote]
A dock widget should not be put into any layout.
-
Volker: is there a reason for that? I should be able to put them in whatever container I want, no ?
Can you give me more details ?
Here is the code anyway:
mainwindow.ui
@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>489</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QDockWidget" name="dockWidget_3">
<widget class="QWidget" name="dockWidgetContents_3"/>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDockWidget" name="dockWidget_4">
<widget class="QWidget" name="dockWidgetContents_4"/>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QMdiArea" name="mdiArea">
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
<property name="title">
<string>&File</string>
</property>
</widget>
<addaction name="menu_File"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>the rest of the code is the same as you get from creator for a qtgui project.
@
-
[quote author="farakon" date="1297941676"]Volker: is there a reason for that? I should be able to put them in whatever container I want, no ?
Can you give me more details ?
[/quote]That's just the way dock widgets work. Dock widgets are meant to live either in the dock area or as independent windows. They are not designed to be put into QLayout subclasses.