Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDocWidget cannot move when undocked
Forum Updated to NodeBB v4.3 + New Features

QDocWidget cannot move when undocked

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 5.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    farakon
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tony
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • F Offline
          F Offline
          farakon
          wrote on last edited by
          #4

          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 ?

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

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

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • F Offline
                F Offline
                farakon
                wrote on last edited by
                #7

                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.

                @

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

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

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    farakon
                    wrote on last edited by
                    #9

                    ok, thanks for the info.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved