Results 1 to 8 of 8

Thread: QDockWidget/Central Widget Problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: QDockWidget/Central Widget Problem

    Quote Originally Posted by Lemming View Post
    Hi!

    I'm working on the application with the user interface, based around the docking widgets. The ide is that all parts of the UI should be resizable, movable and floatable. The problem is that there is no central widget in my application.
    /Lemming/

    It turns out that you can work with a QMainWindow populated only with QDockWidgets, and have those widgets share all available space, provided you follow 2 requirements:

    1.
    All the QDockWidgets must have the same setting for docWidgetArea, e.g. Qt:BottomDockWidgetArea. You cannot mix, bottom, left or right. Of course you can set allowedAreas to Qt:AllDockWidgetAreas and the user can then distribute them as they wish.

    2.
    There must be no central widget. Designer always creates one of these called centralwidget, so simply delete the sucker in your QMainWindow constructor.

  2. #2
    Join Date
    Jan 2006
    Location
    Leiden, the Netherlands
    Posts
    43
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget/Central Widget Problem

    Hello,

    I tried this with the dockwidgets example delivered in Qt 4.4.1

    - setCentralWidget(0) in the intialization
    - All QDockWidgets have Qt::AllDockWidgetAreas as dock settings

    It seems that I dock the QWidgets horizontally and I can create tabs, but I cannot arrange them vertically.

    Is there any solution to this?

  3. #3
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget/Central Widget Problem

    Hi,

    I was facing the same problem as Arthur: I have a QMainWindow without central widget and was not able to arrange QDockWidgets vertically. Finally I found a solution:

    QMainWindow->setDockNestingEnabled(true)

    Felix

  4. The following user says thank you to FelixB for this useful post:

    alketi (31st March 2014)

  5. #4
    Join Date
    Jul 2013
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QDockWidget/Central Widget Problem

    This should do the trick:

    Qt Code:
    1. centralWidget()->hide();
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 3
    Last Post: 12th April 2006, 08:20
  2. Problem reimplementing QSpinBox in a custom widget
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2006, 08:12
  3. Problem with custom widget
    By jnana in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2006, 11:55
  4. Widget resizing problem
    By fwohlfert in forum Qt Programming
    Replies: 3
    Last Post: 23rd February 2006, 08:16
  5. Replies: 7
    Last Post: 3rd February 2006, 10:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.