Results 1 to 8 of 8

Thread: QDockWidget/Central Widget Problem

  1. #1
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QDockWidget/Central Widget Problem

    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. This causes some empty space that should not be there. Covering this space by resizing the widgets causes two splitters to become adjacent (and that is definetely not good). The attached screenshots showcase the nature of the problem.

    Is there any known way to deal with this problem? Probably there can be some kind of a set-up for dock widgets and corners that will help (can't think of one now) or some other workaround?

    Thank You

    /Lemming/
    Attached Images Attached Images
    • File Type: png a.png (17.6 KB, 269 views)
    • File Type: png b.png (17.5 KB, 192 views)

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDockWidget/Central Widget Problem

    my understanding of your screenshots is that your app aims to be some sort of scrip IDE. What's wrong with setting the "Javascript pane" as central widget? It wouldn't be directly resizable or movable but moving and resizing other dock widgets would give the impression that it is...

    Anyway, a main windows with only dockable components seems a bad idea to me... there should be at least one "static" component (i.e central widget), whatever you put inside...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QDockWidget/Central Widget Problem

    Yes, this is a Script IDE... sort of...

    And there will be VB Script and Applescript panes as well. And they are required to be visible at the same time. Therefore turning one of the script panes into a central widget doesn't seem to be an option...

  4. #4
    Join Date
    Apr 2006
    Posts
    29
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QDockWidget/Central Widget Problem

    And how about some kind of template general script pane as a central widget which can be specialized for a specific kind of script within a script manager which would allow the edition of several scripts in maybe different script languages ?

    Another idea is to have a document manager like the kate one as a central widget and docks for each kind of script language which features specific actions meeting the script language requirements ...

    I know it is never funny to change its application architecture ... but I agree with fullmetalcoder, an application with only dock widget is not very common and I think the QMainWindow has not been designed to meet this purpose ...

  5. #5
    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.

  6. #6
    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?

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

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

    alketi (31st March 2014)

  9. #8
    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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.