From kde-core-devel Wed Dec 01 21:05:24 1999 From: Sirtaj Singh Kang Date: Wed, 01 Dec 1999 21:05:24 +0000 To: kde-core-devel Subject: Re: KAction and KAccel X-MARC-Message: https://marc.info/?l=kde-core-devel&m=94408248822276 On Tue, Nov 30, 1999 at 05:56:41PM +0100, Waldo Bastian wrote: > > > Sirtaj Singh Kang wrote: > > > On Tue, Nov 30, 1999 at 08:05:29AM -0700, Kurt Granroth wrote: > > > > I'm investigating the possibility of hacking some code to let KAccel > > > > and KAction "know" about each other.. but I would have to convert > > > > KAccel to a QObject (and add a signal) and add quite a few new > > > > > > This seems like the wrong approach to me. A KAccel should simply be a special > > > case of an action, ie is not connected to any visual interface elements. > > > Are there any differences that I've missed? > > Yes. The accel should shown up in the menu. So the KAction should have > some knowledge about KAccels to be able to provide a menu-option with > the desired information. Well, this is what I meant. KAccel has the concept of actions too, but the information about them stored is only the related accelerator. A QAction/KAction has an accelerator too, so it is a superset of KAccel. The way my code worked was that if no menuitems were connected to the action, a QAccel was attached to the parent widget for the action. If one or more menuitems were attached, the accel was disabled, and the menuitem's accelerator was set to the action accelerator. So either way the accel was available to the user, and any change in the action's accel was immediately reflected in the UI. The "hard" part that I found was figuring out what the "parent widget" was; actions that worked in different widgets/contexts could not be grouped together. Looking at the QAction API, I think it solves this problem by adding "managed" widgets. Or am I out to sea again? :) Documentation on QAction and KAction would be greatly appreciated. -Taj. Sirtaj S. Kang taj@kde.org ssk@physics.unimelb.edu.au Univ of Melbourne The "gui" in "Penguin" is pronounced "K-D-E"