# class KAccelMenu | Simplify the use of KAccel and KKeyDialog with menus. More...
Definition | `#include <kaccelmenu.h>`
Inherits | KPopupMenu [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KAccelMenu (KAccel *k, QWidget * parent=0, const char * name=0 )
- ~KAccelMenu ()
- int insItem (const QPixmap & pixmap, const char* text, const char * action, const QObject * receiver, const char * member, const char * accel = 0)
- int insItem (const char* text, const char * action, const QObject * receiver, const char * member, const char * accel = 0)
- int insItem ( const QPixmap & pixmap, const char * text, const char * action, const QObject * receiver, const char * member, KStdAccel::StdAccel accel )
- int insItem ( const char * text, const char * action, const QObject * receiver, const char * member, KStdAccel::StdAccel accel )

#### Protected Methods

- char * stripAnd (const char *str)
- void keyPressEvent ( QKeyEvent * )
- void popMsg ()

#### Protected Slots

- void highl (int)
- void aboutTS ()

#### Protected Members

- KAccel *keys
- int cid
- QIntDict<char> actions
- bool quote

## Detailed Description

Simplify the use of KAccel and KKeyDialog with menus.

It also provides for the changing of menu item shortcuts by typing the key when the menu item is selected.

The exact method of setting shortcuts is the subject of some debate, currently the ' key will put up a message indicating the next key hit will change the shortcut. The Delete key removes the accelerator associated with the menu item.

Previously: The quote key was required only for keys that are used for menu accelerators.

### Usage:

     keys = new KAccel(this);

     filemenu = new KAccelMenu(keys);
     filemenu->insItem(i18n("&Open"), "&Open", kp ,SLOT(fileOpen()),
                       KStdAccel::Open);
     filemenu->insItem(i18n("Open &URL"), "Open &URL", kp, SLOT(fileOpenUrl()),
                       "CTRL+X");

     keys->readSettings();

Calling the KKeyDialog:

     KKeyDialog::configureKeys( keys );

On exit you need:

     keys->writeSettings();

KAccelMenu (KAccel *k, QWidget * parent=0, const char * name=0 ) | ### KAccelMenu

KAccelMenu constructor.

Parameters:

k | The KAccel object associated with this menu

~KAccelMenu () | ### ~KAccelMenu

Destructor.

int insItem (const QPixmap & pixmap, const char* text, const char * action, const QObject * receiver, const char * member, const char * accel = 0) | ### insItem

Insert a menu item with accelerator.

Parameters:

pixmap | Image attached to menu item.
text | The interationalized version of the menu item text.
action | The untranslated version of the menu item text.
receiver | Object with action slot.
member | Menu item action slot.
accel | The accelerator in text format.

Returns: Id of the menu item.

int insItem (const char* text, const char * action, const QObject * receiver, const char * member, const char * accel = 0) | ### insItem

Insert a menu item with accelerator.

Parameters:

text | The interationalized version of the menu item text.
action | The untranslated version of the menu item text.
receiver | Object with action slot.
member | Menu item action slot.
accel | The accelerator in text format.

Returns: Id of the menu item.

int insItem ( const QPixmap & pixmap, const char * text, const char * action, const QObject * receiver, const char * member, KStdAccel::StdAccel accel ) | ### insItem

Insert a menu item with a standard accelerator

Parameters:

pixmap | Image attached to menu item.
text | The interationalized version of the menu item text.
action | The untranslated version of the menu item text.
receiver | Object with action slot.
member | Menu item action slot.
accel | Code for a standard accelerator

Returns: Id of the menu item.

int insItem ( const char * text, const char * action, const QObject * receiver, const char * member, KStdAccel::StdAccel accel ) | ### insItem

Insert a menu item with a standard accelerator

Parameters:

text | The interationalized version of the menu item text.
action | The untranslated version of the menu item text.
receiver | Object with action slot.
member | Menu item action slot.
accel | code for a standard accelerator

Returns: Id of the menu item.

char * stripAnd (const char *str) | ### stripAnd

[protected]

void keyPressEvent ( QKeyEvent * ) | ### keyPressEvent

[protected]

Reimplemented from QPopupMenu.

void popMsg () | ### popMsg

[protected]

KAccel * keys | ### keys

[protected]

int cid | ### cid

[protected]

QIntDict<char> actions | ### actions

[protected]

bool quote | ### quote

[protected]

void highl (int) | ### highl

[protected slots slot]

void aboutTS () | ### aboutTS

[protected slots slot]

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:24 2001, using kdoc 2.0a53.