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

Olaf Jan Schmidt ojschmidt at kde.org
Tue May 13 09:22:02 BST 2003


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

Hi!

There are even more bugs to ktoolbarbutton.cpp then the one analyzed by 
Gunnar.

[Gunnar Schmi Dt]
> --- 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);

The "on(false);" leads to a bug in Konqueror: Whenever you open the menu 
of the radio button for changing the directory view (e.g. list view), and 
you close it without selecting anything, the status is set back to "not 
selected" by this "on (false)". It should be either removed or made 
conditional via "if ( d->m_isToggle )".

I think both "on(false);" and "setDown(false);" can be removed, as they 
are just a workaround against some effects of the bug now properly fixed 
by Gunnar. OTAH they shouldn't have any effect at all if the toggling is 
dealt with correctly.

> +      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).

Indeed. If the button is already a ToggleButton, then calling setPopup 
with "true" will cause the toggle attribute to be lost after the popup 
has been opened once. If you call it with "false", then it will behave as 
if it had been called with "true", but it at least it won't be buggy. 
This code needs to be completely reworked, or it should at least include 
a workaround for this bug using something like: 

- --- ktoolbarbutton.cpp	Tue May 13 09:55:10 2003
+++ ktoolbarbutton.cpp.new	Tue May 13 10:05:17 2003
@@ -352,7 +352,10 @@
 void KToolBarButton::setPopup(QPopupMenu *p, bool toggle)
 {
   d->m_popup = p;
- -  d->m_isToggle  = toggle;
+  if( isToggleButton() )
+    d->m_isToggle  = false;
+  else
+    d->m_isToggle  = toggle;
   p->installEventFilter(this);
 }

- -- 
Olaf Jan Schmidt, KDE Accessibility Project
KDEAP co-maintainer, maintainer of http://accessibility.kde.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj7AqzAACgkQoLYC8AehV8eNFQCg1w86yWP9ltau6/GecT8In8vQ
XqUAoOG6pq2VTaHgJFtaF+LDBncp7f/+
=+2tF
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list