KToolbarButton popup delay (Re: Bug report and feature request)

Gunnar Schmi Dt gunnar at schmi-dt.de
Mon May 12 20:29:47 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Monday 12 May 2003 18:35, Waldo Bastian wrote:
> On Monday 12 May 2003 17:20, Gunnar Schmi Dt wrote:
> > In the meantime I did some additional testing. In KDE 3.1 the effect does
> > show up if you click long enough for the pop up to show but short enough
> > to have the mouse key released before the popup is on the screen. This
> > can either happen with some trying on delayed popup menus or with very
> > short mouse clicks on non-delayed popup menus.
>
> I guess you have the fade-in menu-effect enabled then? They tend to break
> this kind of stuff, see also BR49261
>
I do not have the fade-in menu-effect enabled. However, by looking in the 
code, I think I have found the error. It is based on the misuse of the toggle 
feature of the QToolbarButton class.

When showing the popup menu the method QToolbarButton::setToggle(true) gets 
called (ktoolbarbutton.cpp, line 682).  When releasing the mouse it is 
detected whether the feature is enabled. If not, the popup gets closed (line 
476). Additionally the feature gets disabled (line 479/485).

In all cases where the MouseButtonRelease-event is not distributed to 
KToolBarButton::eventFilter, the toggle feature stays enabled which leads to 
the effects of the bug.

The event might not be delivered if you:
1) release the mouse key before the popup is ready
2) choose an item in a sub menu without releasing the mouse while selecting
3) press Esc while you still press the mouse key

As a possible patch to disable these effects you can add code to the hide 
sequence which disables the toggle feature:

- --- ktoolbarbutton.cpp  2003-05-12 21:06:28.000000000 +0200
+++ ktoolbarbutton.cpp.new      2003-05-12 21:07:24.000000000 +0200
@@ -488,6 +488,8 @@
     case QEvent::Hide:
       on(false);
       setDown(false);
+      if ( d->m_isToggle )
+        setToggle( false );
       return false;
   default:
       break;

A better solution might be to change the KToolbarButton to not misuse the 
toggle feature (as there are some other side effects, too).

Gunnar Schmi Dt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+v/Y/sxZ93p+gHn4RAt+AAJ4rbeY+j2+iqdfEdP6vBs1XgkNEbwCdH/zf
gXlOTdW0reX5y+5Jt8n73ho=
=xR9P
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list