QKeySequence(3qt)

NAME
QKeySequence - Encapsulates a key sequence as used by accelerators

#include <qkeysequence.h>

Inherits Qt.

  Public Members
QKeySequence ()
QKeySequence ( const QString & key )
QKeySequence ( int key )
operator QString () const
operator int () const
QKeySequence ( const QKeySequence & keysequence )
QKeySequence & operator= ( const QKeySequence & keysequence )
~QKeySequence ()
bool operator== ( const QKeySequence & keysequence ) const
bool operator!= ( const QKeySequence & keysequence ) const

RELATED FUNCTION DOCUMENTATION
QDataStream & operator<< ( QDataStream & s, const QKeySequence & keysequence )
QDataStream & operator>> ( QDataStream & s, QKeySequence & keysequence )

DESCRIPTION
The QKeySequence class encapsulates a key sequence as used by accelerators.

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" scope.

See also QAccel and Miscellaneous Classes.

MEMBER FUNCTION DOCUMENTATION

QKeySequence::QKeySequence ()
Constructs an empty key sequence.

QKeySequence::QKeySequence ( const QString & key )
Creates a key sequence from the string key. For example "Ctrl+O" gives CTRL+UNICODE_ACCEL+'O'. The strings "Ctrl", "Shift" and "Alt" are recognized, as well as their translated equivalents in the" QAccel" scope (using QObject::tr()).

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.

QKeySequence::QKeySequence ( int key )
Constructs a key sequence from the keycode key.

The key codes are listed in qnamespace.h and can be combined with modifiers, e.g. with SHIFT, CTRL, ALT or UNICODE_ACCEL.

QKeySequence::QKeySequence ( const QKeySequence & keysequence )
Copy constructor. Makes a copy of keysequence.

QKeySequence::~QKeySequence ()
Destroys the key sequence.

QKeySequence::operator QString () const
Creates an accelerator string for the keysequence. For instance CTRL+Key_O gives "Ctrl+O". The strings, "Ctrl"," Shift", etc. are translated (using QObject::tr()) in the "QAccel" scope.

QKeySequence::operator int () const
For backward compatibility: returns the keycode as integer.

If QKeySequence ever supports more than one keycode, this function will return the first one.

bool QKeySequence::operator!= ( const QKeySequence & keysequence ) const
Returns TRUE if keysequence is not equal to this keysequence; otherwise returns FALSE.

QKeySequence & QKeySequence::operator= ( const QKeySequence & keysequence )
Assignment operator. Assigns keysequence to this object.

bool QKeySequence::operator== ( const QKeySequence & keysequence ) const
Returns TRUE if keysequence is equal to this keysequence; otherwise returns FALSE.

RELATED FUNCTION DOCUMENTATION

QDataStream & operator<< ( QDataStream & s, const QKeySequence & keysequence )
Writes the key sequence keysequence to the stream s.

Format of the QDataStream operators

QDataStream & operator>> ( QDataStream & s, QKeySequence & keysequence )
Reads a key sequence from the stream s into the keysequence keysequence.

SEE ALSO
http://doc.trolltech.com/qkeysequence.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qkeysequence.3qt) and the Qt version (3.0.0-beta6).