The QAccel class handles keyboard accelerator keys. More...
#include <qaccel.h>
Inherits QObject.
A QAccel contains a list of accelerator items. Each accelerator item
consists of an identifier and a keyboard code combined with modifiers
(SHIFT, CTRL, ALT
or ASCII_ACCEL).
For example, CTRL + Key_P
could be a shortcut for printing
a document. The key codes are listed in qkeycode.h.
When pressed, an accelerator key sends out the signal activated() with a number that identifies this particular accelerator item. Accelerator items can also be individually connected, so that two different keys will activate two different slots (see connectItem()).
A QAccel object handles key events to its parent widget and all children of this parent widget.
Example:
QAccel *a = new QAccel( myWindow ); // create accels for myWindow a->connectItem( a->insertItem(Key_P+CTRL), // adds Ctrl+P accelerator myWindow, // connected to myWindow's SLOT(printDoc()) ); // printDoc() slot
Creates a QAccel object with a parent widget and a name.
Destroys the accelerator object.
[signal]
This signal is emitted when an accelerator key is pressed. id is a number that identifies this particular accelerator item.
Removes all accelerator items.
Connects an accelerator item to a slot/signal in another object.
Arguments:
a->connectItem( 201, mainView, SLOT(quit()) );
See also: disconnectItem().
Returns the number of accelerator items.
Disconnects an accelerator item from a function in another object.
See also: connectItem().
[virtual protected]
Processes accelerator events intended for the top level widget.
Reimplemented from QObject.
Returns the identifier of the accelerator item with the key code key, or -1 if the item cannot be found.
Inserts an accelerator item and returns the item's identifier.
Arguments:
QAccel *a = new QAccel( myWindow ); // create accels for myWindow a->insertItem( Key_P + CTRL, 200 ); // Ctrl+P to print document a->insertItem( Key_X + ALT , 201 ); // Alt+X to quit a->insertItem( ASCII_ACCEL + 'q', 202 ); // ASCII 'q' to quit a->insertItem( Key_D ); // gets id 2 a->insertItem( Key_P + CTRL + SHIFT ); // gets id 3
Returns TRUE if the accelerator is enabled, or FALSE if it is disabled.
See also: setEnabled() and isItemEnabled().
Returns TRUE if the accelerator item with the identifier id is enabled. Returns FALSE if the item is disabled or cannot be found.
See also: setItemEnabled() and isEnabled().
Returns the key code of the accelerator item with the identifier id, or zero if the id cannot be found.
Removes the accelerator item with the identifier id.
Enables the accelerator if enable is TRUE, or disables it if enable is FALSE.
Individual keys can also be enabled or disabled.
See also: isEnabled() and setItemEnabled().
Enables or disables an accelerator item.
Arguments:
See also: isItemEnabled() and isEnabled().
This file is part of the Qt toolkit, copyright © 1995-97 Troll Tech, all rights reserved.
It was generated from the following files: