Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, July 2001
Detecting when a menu is teared off


Message 1 in thread

Hello all,

the application I'm working on uses Qt 2.3.0 and tear-off menus (with
QPopupMenu::insertTearOffHandle). I'd like the tear-off windows to
appear in a windowlist menu of the application. I suppose I could do
this if I know when a menu is teared off and when the tearoff window
is closed, but there doesn't seem to be any signals for this.

QPopupMenu::aboutToShow() and QPopupMenu::abouToHide() are apparently
emitted only for the menu, not for the tearoff. Is there any way I can
do this ?

Thanks,

-- 
 [ signature omitted ] 

Message 2 in thread

> Hello all,
> 
> the application I'm working on uses Qt 2.3.0 and tear-off menus (with
> QPopupMenu::insertTearOffHandle). I'd like the tear-off windows to
> appear in a windowlist menu of the application. I suppose I could do
> this if I know when a menu is teared off and when the tearoff window
> is closed, but there doesn't seem to be any signals for this.
> 
> QPopupMenu::aboutToShow() and QPopupMenu::abouToHide() are apparently
> emitted only for the menu, not for the tearoff. Is there any way I can
> do this ?

The tear-off handle is like any other menu item, so the menu will 
send a activated signal with the id of the tear-off handle when it
has been clicked on. 
So gather the ids of your tear-off handles, connect your menus 
activated(int) signal to a slot, in that slot check if the id
is one of your tear-off handles and do your stuff...

This may not be the easiest way, but its doable...

Regards...
-- 
 [ signature omitted ]