Results 1 to 7 of 7

Thread: Docked Widget Menu

  1. #1
    Join Date
    Jun 2007
    Posts
    19
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Docked Widget Menu

    I have an application with multiple docked widgets, opened from a menu. When I right click on a dock title bar, I get a checked menu of opened docks, which can be hidden/shown by selecting them. I'm trying to find a way to get this on a menu in the main window, but can't find anywhere this dock menu is created. I figure if I can it's name, or a function to return a pointer to it, I can can add it to the menu I want. Any suggestions?

    I'm also looking for a way to close (delete) the dock when it has been unselected from this menu. I've tried connecting a slot to the visibilityChanged(bool) signal, but this seems to trigger false when moving the dock. Otherwise it works fine. If figure I can fix this problem once I find out how to use the dock menu.

  2. #2
    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: Docked Widget Menu

    Quote Originally Posted by Chuk View Post
    I'm trying to find a way to get this on a menu in the main window, but can't find anywhere this dock menu is created.
    QMainWindow::createPopupMenu()
    I'm also looking for a way to close (delete) the dock when it has been unselected from this menu. I've tried connecting a slot to the visibilityChanged(bool) signal, but this seems to trigger false when moving the dock. Otherwise it works fine. If figure I can fix this problem once I find out how to use the dock menu.
    QDockWidget::toggleViewAction()
    J-P Nurmi

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Docked Widget Menu

    I have an application with multiple docked widgets, opened from a menu. When I right click on a dock title bar, I get a checked menu of opened docks, which can be hidden/shown by selecting them. I'm trying to find a way to get this on a menu in the main window, but can't find anywhere this dock menu is created. I figure if I can it's name, or a function to return a pointer to it, I can can add it to the menu I want. Any suggestions?
    See QMainWindow::createPopupMenu() docs. Should be what you need.

    I'm also looking for a way to close (delete) the dock when it has been unselected from this menu. I've tried connecting a slot to the visibilityChanged(bool) signal, but this seems to trigger false when moving the dock. Otherwise it works fine. If figure I can fix this problem once I find out how to use the dock menu.
    See QDockWidget::toggleViewAction documentation.

    Regards

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Docked Widget Menu

    Damn, you're fast!...

  5. #5
    Join Date
    Jun 2007
    Posts
    19
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: Docked Widget Menu

    Quote Originally Posted by marcel View Post
    The popup menu is already there, seemingly auto-generated. I did not write code for it. I'm looking for a quick way to get a copy of it, for my menu. I could recreate it, but would then need to handle more docks added as well.

    I just realized the "Dock Widgets" example has what I want on the "View" menu. Thats the same as the right click menu on a dock title bar.

    Quote Originally Posted by marcel View Post
    The existing menu already handles the toggling of a view, I want to actually delete it with removeDockWidget(). Since the app has a number of dockable dialogs, I want to remove closed (hidden) ones. When the app closes, it saves the open docks. When the app opens, it restores the docks. Using isVisible() doesn't seem to work for docks that were hidden, it always returns true as long as the dock has been created. Right now I'm checking for a NULL pointer to the dialog and that seems to be the only thing that works right.

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Docked Widget Menu

    The popup menu is already there, seemingly auto-generated. I did not write code for it.
    yes it is auto generated unless u override it. Just override it, and add the dock widgets which are visible. It will solve ur purpose. Just try overriding the createPopupMenu() function. Read the docs to see more. It returns a pointer to menu.

  7. #7
    Join Date
    Apr 2013
    Posts
    63
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Docked Widget Menu

    I want to get a handle of that menu and display permanently on the min window menubar. How to do that?

Similar Threads

  1. Help with Docked Widget!
    By drake1983 in forum Newbie
    Replies: 8
    Last Post: 5th June 2007, 05:10
  2. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52
  3. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  4. Pin/Unpin Dock Widget
    By charlesD in forum Newbie
    Replies: 1
    Last Post: 21st June 2006, 06:57
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.