[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Button + Popupmenu: adding support to make this combination behave well
From:       Wilco Greven <greven () kde ! org>
Date:       2001-08-23 12:38:29
[Download RAW message or body]

Hi,

Currently there is no code available in kdelibs to make a button popup a  
menu in the correct way. It should behave as follows IMO (identically to the 
menubar behaviour): 

 1) The button is pressed: menu pops up
 2) The button is pressed again: the menu disappears.

2) goes wrong most of the times, in that the menu disappears, but will 
immediately be popped up again.

A solution for this is implemented in kicker. I'd like to add it to kdeui so 
that other applications can take advantage of it as well. The solution 
consists of an eventfilter which is installed on the popupmenu. This filter 
checks if mouseevents occur in a certain rectangle (usually the button's 
rectangle). If a mousePress takes place inside the rectangle, it is 
discarded, so that the menu doesn't hide, instead the hide is delayed until 
the following mouseRelease event occurs. 

Now what would be the best place to put this code in? It can be added to 
KPopupMenu, which then would need an extra exec( QPoint*, QRect* ) method.
Another possibility would be to put it in a new class, say KPopupMonitor, 
which would have a constructor KPopupMonitor( QPopupMenu*, QRect* ).

Greetings,
Wilco

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic