Results 1 to 4 of 4

Thread: QDockWidget : docking, reopening after closing

  1. #1
    Join Date
    Jul 2008
    Location
    East Coast, USA
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question QDockWidget : docking, reopening after closing

    Hi!

    I have a QMainWindow with a QDockWidget in it generated through Designer. I figured out that after floating the widget, double clicking on the dockwidget will redock it in the original place. I can not however figure out how:
    1. To redock the widget anywhere on the main window
    2. reopen the dockwidget after I close it


    Any help in much appreciated.
    -K

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDockWidget : docking, reopening after closing

    To redock the widget anywhere on the main window
    Just dragging and dropping the widget in the dock area should re-dock it again. Make sure allowedAreas is set to Qt::AllDockWidgetAreas

    reopen the dockwidget after I close it
    When the dock widget is closed, its hidden and visibilityChanged singnal is emitted. I think you will need to write your own code to make it visible again (setVisible).

  3. The following user says thank you to munna for this useful post:

    kghose (14th July 2008)

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDockWidget : docking, reopening after closing

    Notice also QDockWidget::toggleAction() which you can for example put to some menu.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    kghose (14th July 2008)

  6. #4
    Join Date
    Jul 2008
    Location
    East Coast, USA
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Thumbs up Re: QDockWidget : docking, reopening after closing

    Thanks Guys! show() works just fine. I mistakenly though close() destroyed the window rather than just hid it.

    But... I still can't dock my window anywhere I want. I have "allowedAreas" set to Qt::AllDockWidgetAreas (via Designer AND in the constructor).

    -K
    Last edited by kghose; 14th July 2008 at 21:09. Reason: reformatted to look better

Similar Threads

  1. QDockWidget closing detection
    By danielperaza in forum Qt Programming
    Replies: 1
    Last Post: 16th April 2008, 15:28
  2. Replies: 5
    Last Post: 10th May 2006, 00:20

Tags for this Thread

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.