Results 1 to 6 of 6

Thread: Tear off QMenu

  1. #1

    Default Tear off QMenu

    Hi,

    is it possible to tear-off QMenu programatically?
    I need this functionality, when I switch to the fullscreen mode in my application (I have to
    have some menus still visible).

    Cheers,
    Sebastian

  2. #2
    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: Tear off QMenu

    What do you mean by tear-off QMenu programatically?

    If u want to hide the menu you mean, you can simply call QMainWindow::menuBar()->hide() function

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Tear off QMenu

    "tear-off" means to drag the menu out of its natural place and make it sticky (visible) even when the rest of the menu is closed (turning it into a kind of toolbar).

    Based on what I see it should be possible to tear the menu off programatically by triggering the action responsible for the effect. Quoting the docs:

    Quote Originally Posted by QMenu
    When true, QMenu has a special menu item (often shown as a dashed line at the top of the menu) that creates a copy of the menu when the tear-off menu item is triggered. This "torn-off" copy lives in a separate window. It contains the same menu items as the original menu, with the exception of the tear-off handle.

  4. #4

    Default Re: Tear off QMenu

    Hi,

    thanks for your reply.

    I think that the function:
    void setTearOffEnabled ( bool )

    only makes "tearing-off" possible (special menu item is visible, etc.)
    What I meant, actually, was to tear-off menu automatically (when I switch to the full screen mode). But probably there's no other way than generating some "mouse click"/"mouse move" events...?

    Cheers,
    Sebastian

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Tear off QMenu

    I said nothing about setTearOffEnabled. The docs say the tear-off item is a QAction and you can call trigger() on it to cause the tear-off. It's just a matter of accessing the item.

  6. #6

    Default Re: Tear off QMenu

    Sorry, I misunderstood you. It looked to me like you're quoting description of the
    void setTearOffEnabled( bool )/void isTearOffEnabled() function.

    Thanks once more.

Similar Threads

  1. Caption in QMenu
    By Lykurg in forum Newbie
    Replies: 4
    Last Post: 16th April 2014, 22:41
  2. QMenu and signals
    By mattia in forum Newbie
    Replies: 6
    Last Post: 20th December 2007, 09:09
  3. how to popup and close a QMenu
    By Placido Currò in forum Qt Programming
    Replies: 15
    Last Post: 14th May 2007, 16:41
  4. Shortcut for QMenu
    By Ryhel in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2007, 11:57
  5. Qmenu Stable close on QTableWidget
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2006, 10:03

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.