Results 1 to 7 of 7

Thread: How to show/hide a whole docking area?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question How to show/hide a whole docking area?

    Hi,

    My application has a few widgets which are docked to the left docking area of my application. Now, there are times where I wish my central widget would get as much real estate as possible. So, in that context, I wish there I could hide all my docked widgets at once, effectively hiding the left docking area (and not hiding each docked widget individually). Ideally, there would be some kind of a button to the right of my left docking area which, when clicked, would either show/hide the whole left docking area. I have googled around a bit for this, but couldn't find anything useful, but I can't imagine this couldn't be done, so... anyone, any idea?

    Cheers, Alan.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to show/hide a whole docking area?

    It is possible to do so, but the QDockWidget does not support this out of box. You will need to have a custom QDockWidget with a special button mechanism to hide / unhide, expect the button itself. That will mean that the dock widget will never be completely hidded, at-lest the button part of it will be visible.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to show/hide a whole docking area?

    Thanks, but if I was to have a 'special' QDockWidget, then it means that I could potentially move it around within the docking area. Also, it could be 'grouped' with one or several of my other docked widgets, etc. So, I am not sure how this could work efficiently for me...

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to show/hide a whole docking area?

    If you don't want the QDockWidget to move around, then set QDockWidget::setFeatures(QDockWidget::NoDockWidget Features)

    Also you could use QDockWidget::setTitleBarWidget(), to set the custom title bar which has the hide/show button.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. #5
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to show/hide a whole docking area?

    Ah, I clearly didn't know about QDockWidget::setFeatures(QDockWidget::NoDockWidget Features) and together with QDockWidget::setTitleBarWidget(), I can see that working. Now, I wouldn't want that 'special' QDockWidget to be visible when no other docked widgets are, but I guess I could catch some signal to find out when there is only one QDockWidget object left (i.e. the 'special' one) and thus hide it?...

  6. #6
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to show/hide a whole docking area?

    One other option is that you could use QMainWindow functions

    QMainWindow::saveState()
    QMainWindow::removeDockWidget() // remove all
    ...// Now central widget uses all the space
    QMainWindow::addDockWidget() // Add them back
    QMainWindow::restoreState()
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  7. #7
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to show/hide a whole docking area?

    Hmm... not sure that I like that solution, sorry. I mean that I have some menu items that I use to show/hide some dockable widgets, so that I get the feeling that it would mess everything up. No, I just want to be able to show/hide the docking area, not its docked widgets.

Similar Threads

  1. how to show an app if it manually hide
    By jthacker in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2010, 13:02
  2. Replies: 5
    Last Post: 19th March 2010, 05:33
  3. QAxWidget hide other widgets in it's area
    By sprnshld in forum Qt Programming
    Replies: 1
    Last Post: 27th July 2008, 15:56
  4. Show or hide a form
    By Gayathri in forum Newbie
    Replies: 11
    Last Post: 17th November 2006, 12:39
  5. Replies: 6
    Last Post: 18th August 2006, 17:50

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.