Results 1 to 2 of 2

Thread: QDockWidget inside another widget in the center?

  1. #1
    Join Date
    Aug 2008
    Qt products
    Qt3 Qt4
    Unix/X11 Windows

    Default QDockWidget inside another widget in the center?

    Ok, this is all theory. But, I am creating an application that will have different modules (Vendors, Customers, Inventory, Sales, Shipping, etc... you get the idea). Sometimes 2 or more modules need to be visible to work better. Is it possible to have a QDockWidget Dock Widget inside another central widget. I will create my own manager to show or hide a tab (show tab only if more than 1 module visible), so there will always be a central form (which cannot be undocked if only 1 qdockwidget is visible). This will enable the user to "pull" or undock a dock widget to the side.

    My hypothesis is this: Use some sort of container widget (stacked widget, tab widget, or just a plain frame) that will contain many dock widgets or forms. When only 1 module is open then the dock widget title is hidden and the properties are set to NOT floatable or undockable. This will keep it in place, but when another module opens then either can be undocked and floated. Now, in order to undock I was either thinking of actually using "click and drag" as if it were another any other dock widget. OR, in order to move it off the center, either hide the dock widget (or a frame) programmatically make a floating widget and then load the hidden form in the new floating dock widget.

    Also, can you have 2 main windows?? If I can, then I would like to then make the module load into a 2nd "child" Main window that can contain it's OWN docked widgets that would dock as normal. These would hold actions related to that module only.

    So, basic question, can I make a module/form hide from inside the a widget that is the central widget and make it appear in another 2nd form without losing anything?

    Or, can I make a dock widget that is inside another control (tab widget for example) floating by click-and-drag?

    I know I would have to create my own MDI manager.

    Right now, with a simple test app I can put a dock widget inside the central widget, click to undock, and double-click to make it dock back (but I need to work at making it fill the center). I cannot click-and-drag to either dock or undock. This would be great if I can get this working. I'm just trying to come up with an application that will work the way a person does and not make the user contort and change how they do business around an application.

  2. #2
    Join Date
    Feb 2010
    Sydney, Australia
    Thanked 5 Times in 5 Posts
    Qt products

    Default Re: QDockWidget inside another widget in the center?

    This is quite similar to what I would like to be able to do. I would ideally like a QMainWindow with a number of child dialog windows which would behave like worksheets by allowing QDockWidgets to dock to them. This way a user could create an arbitrary number of worksheets, each seperate to (but children of) the QMainWindow and then dock various QDockWidgets to those worksheets.

    Also, is there a way to get undocked QDockWidgets to dock to one another or over one another as they do when they are docked? This would be very useful.

Similar Threads

  1. Replies: 10
    Last Post: 20th April 2015, 22:24
  2. Center a widget in a cell on a QTableWidget
    By roleroz in forum Qt Programming
    Replies: 16
    Last Post: 5th March 2009, 14:47
  3. Custom Widget inside a QVboxLayout
    By nemesis in forum Qt Programming
    Replies: 5
    Last Post: 25th June 2008, 14:55
  4. Replies: 3
    Last Post: 17th March 2008, 19:54
  5. Default size of a QListWidget inside a QDockWidget
    By rakuco in forum Qt Programming
    Replies: 0
    Last Post: 25th July 2007, 08:01

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.