PDA

View Full Version : Tear off QMenu



sebastian
25th June 2008, 11:09
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

aamer4yu
25th June 2008, 18:46
What do you mean by tear-off QMenu programatically? :confused:

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

wysota
25th June 2008, 19:10
"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:


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.

sebastian
26th June 2008, 09:38
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

wysota
26th June 2008, 18:27
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.

sebastian
27th June 2008, 08:45
Sorry, I misunderstood you. It looked to me like you're quoting description of the
void setTearOffEnabled( bool )/void isTearOffEnabled() function.

Thanks once more.