Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QKeySequence class encapsulates a key sequence as used by accelerators. More...
#include <qkeysequence.h>
Inherits Qt.
A key sequence consists of a keyboard code, optionally combined with modifiers, e.g. SHIFT, CTRL, ALT or UNICODE_ACCEL. For example, CTRL + Key_P might be a sequence used as a shortcut for printing a document. The key codes are listed in qnamespace.h. As an alternative, use UNICODE_ACCEL with the unicode code point of the character. For example, UNICODE_ACCEL + 'A' gives the same key sequence as Key_A.
Key sequences can be constructed either from an integer key code, or from a human readable translatable string. A key sequence can be cast to a QString to obtain a human readable translated version of the sequence. Translations are done in the "QAccel" context.
See also QAccel and Miscellaneous Classes.
This contructor is typically used with tr(), so that accelerator keys can be replaced in translations:
QPopupMenu *file = new QPopupMenu( this ); file->insertItem( tr("&Open..."), this, SLOT(open()), QKeySequence( tr("Ctrl+O", "File|Open") ) );
Note the "File|Open" translator comment. It is by no means necessary, but it provides some context for the human translator.
The key codes are listed in qnamespace.h and can be combined with modifiers, e.g. with SHIFT, CTRL, ALT or UNICODE_ACCEL.
If QKeySequence ever supports more than one keycode, this function will return the first one.
Writes the key sequence keysequence to the stream s.
See also Format of the QDataStream operators.
Reads a key sequence from the stream s into the key sequence keysequence.
See also Format of the QDataStream operators.
This file is part of the Qt toolkit. Copyright © 1995-2002 Trolltech. All Rights Reserved.
Copyright © 2002 Trolltech | Trademarks | Qt version 3.0.5
|