karm Library API Documentation

KAccelMenuWatch Class Reference

Easy updating of menu accels when changing a KAccel object. More...

#include <kaccelmenuwatch.h>

Inheritance diagram for KAccelMenuWatch:

QObject List of all members.

Public Slots

void updateMenus ()

Public Methods

 KAccelMenuWatch (KAccel *accel, QObject *parent=0)
virtual ~KAccelMenuWatch ()
void setMenu (QPopupMenu *menu)
QPopupMenucurrentMenu () const
void connectAccel (int itemId, const char *action)
void connectAccel (int itemId, KStdAccel::StdAccel)

Detailed Description

Easy updating of menu accels when changing a KAccel object.

Since a KAccel object does not keep track of menu items to which it is connected, we normally have to manually call KAccel::changeMenuAccel() again for each update of the KAccel object.

With KAccelMenuWatch you provide the kaccel object and the menu items to which it connects, and if you update the kaccel you just have to call KAccelMenuWatch::updateMenus() and the menu items will be updated.

It is safe to delete menus that have connections handled by this class. On deletion of a menu, all associated accelerators will be deleted.

Note that you _have_ to call KAccelMenuWatch::updateMenus() after you connect the * accelerators, as they are not activated till then.

Author:
Sirtaj Singh Kang (taj@kde.org)

Definition at line 35 of file kaccelmenuwatch.h.


Constructor & Destructor Documentation

KAccelMenuWatch::KAccelMenuWatch KAccel *    accel,
QObject   parent = 0
 

KAccelMenuWatch Constructor.

Definition at line 12 of file kaccelmenuwatch.cpp.

References QPtrList< QPopupMenu >::setAutoDelete(), and QPtrList< AccelItem >::setAutoDelete().

virtual KAccelMenuWatch::~KAccelMenuWatch   [inline, virtual]
 

KAccelMenuWatch Destructor.

Definition at line 71 of file kaccelmenuwatch.h.


Member Function Documentation

void KAccelMenuWatch::setMenu QPopupMenu   menu
 

Set the menu on which connectAccel calls will operate.

All subsequent calls to connectAccel will be associated with this menu. You can call this function any number of times, so multiple menus can be handled.

Definition at line 21 of file kaccelmenuwatch.cpp.

References QPtrList< QPopupMenu >::append(), QObject::connect(), QObject::destroyed(), and QPtrList< QPopupMenu >::findRef().

QPopupMenu* KAccelMenuWatch::currentMenu   const [inline]
 

Return the last menu set with KAccelMenuWatch::setMenu(QPopupMenu*), or 0 if none has been set.

Definition at line 85 of file kaccelmenuwatch.h.

void KAccelMenuWatch::connectAccel int    itemId,
const char *    action
 

Connect the menu item identified to currentMenu()/id to the accelerator action.

Definition at line 36 of file kaccelmenuwatch.cpp.

References QString::fromLocal8Bit().

void KAccelMenuWatch::connectAccel int    itemId,
KStdAccel::StdAccel   
 

Same as above, but connects to standard accelerators.

Definition at line 42 of file kaccelmenuwatch.cpp.

void KAccelMenuWatch::updateMenus   [slot]
 

Updates all menu accelerators.

Call this after all accelerators have been connected or the kaccel object has been updated.

Definition at line 48 of file kaccelmenuwatch.cpp.

References QPtrListIterator::current().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for karm Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:53 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003