QDocWidget cannot move when undocked



  • Hi,

    I am having this problem with QDockWidget. Once undocked, it cannot be moved or dragged (the only action that works is resizing).

    System is ubuntu amd64 with QT 4.7.1 (nvidia driver).

    Anyone has a solution to this problem ?

    Thanks in advance



  • Hi,

    well, I cannot reproduce your problem. If you start with a new project, select QMainWindow as base ui, place a QDockWidget, build and run, it works.

    Can you provide more details? Are you sure that you didn't set up some size constraint or whatever?



  • Have you set the Movable property to true for the dock widget?



  • 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 ?



  • can u paste ur code here ? including the ui header generated by designer



  • [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.



  • ok, thanks for the info.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.