Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QKeySequence Class Reference

List of all members.


Detailed Description

The QKeySequence class encapsulates a key sequence as used by shortcuts.

A key sequence consists of up to four keyboard codes, each optionally combined with modifiers, such as Qt::SHIFT, Qt::CTRL, Qt::ALT or Qt::META. For example, Qt::CTRL + Qt::Key_P might be a sequence used as a shortcut for printing a document. Valid codes for keys and modifiers are listed in Qt::Key and Qt::Modifier. As an alternative, use the unicode code point of the character; for example, 'A' gives the same key sequence as Qt::Key_A.

Key sequences can be constructed either from an integer key code, or from a human readable translatable string such as "Ctrl+X,Alt+Space". A key sequence can be cast to a QString to obtain a human readable translated version of the sequence. Translations are done in the "QShortcut" context.

{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control and Qt::ControlModifier correspond to the Command keys on the Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and Qt::MetaModifier correspond to the Control keys. Developers on Mac OS X can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on Mac OS X.

The toString() function produces human-readable strings for use in menus. On Mac OS X, the appropriate symbols are used to describe keyboard shortcuts using special keys on the Macintosh keyboard.

See also:
QShortcut

Definition at line 46 of file qkeysequence.h.


Public Types

enum  SequenceFormat { NativeText, PortableText }
enum  SequenceMatch { NoMatch, PartialMatch, ExactMatch }

Public Member Functions

uint count () const
bool isDetached () const
bool isEmpty () const
SequenceMatch matches (const QKeySequence &seq) const
 operator int () const
 operator QString () const
 operator QVariant () const
bool operator!= (const QKeySequence &other) const
bool operator< (const QKeySequence &ks) const
bool operator<= (const QKeySequence &other) const
QKeySequenceoperator= (const QKeySequence &other)
bool operator== (const QKeySequence &other) const
bool operator> (const QKeySequence &other) const
bool operator>= (const QKeySequence &other) const
int operator[] (uint i) const
 QKeySequence (const QKeySequence &ks)
 QKeySequence (int k1, int k2=0, int k3=0, int k4=0)
 QKeySequence (const QString &key)
 QKeySequence ()
QString toString (SequenceFormat format=PortableText) const
 ~QKeySequence ()

Static Public Member Functions

static QKeySequence fromString (const QString &str, SequenceFormat format=PortableText)
static QKeySequence mnemonic (const QString &text)

Private Member Functions

int assign (const QString &str)
void setKey (int key, int index)

Static Private Member Functions

static int decodeString (const QString &ks)
static QString encodeString (int key)

Private Attributes

QKeySequencePrivate * d

Friends

Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &in, const QKeySequence &ks)
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &in, QKeySequence &ks)
class Q3AccelManager
class QShortcut
class QShortcutMap

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index