1QKeySequence(3qt)                                            QKeySequence(3qt)
2
3
4

NAME

6       QKeySequence - Encapsulates a key sequence as used by accelerators
7

SYNOPSIS

9       #include <qkeysequence.h>
10
11       Inherits Qt.
12
13   Public Members
14       QKeySequence ()
15       QKeySequence ( const QString & key )
16       QKeySequence ( int key )
17       QKeySequence ( int k1, int k2, int k3 = 0, int k4 = 0 )
18       QKeySequence ( const QKeySequence & keysequence )
19       ~QKeySequence ()
20       uint count () const
21       bool isEmpty () const
22       Qt::SequenceMatch matches ( const QKeySequence & seq ) const
23       operator QString () const
24       operator int () const  (obsolete)
25       int operator[] ( uint index ) const
26       QKeySequence & operator= ( const QKeySequence & keysequence )
27       bool operator== ( const QKeySequence & keysequence ) const
28       bool operator!= ( const QKeySequence & keysequence ) const
29
31       QDataStream & operator<< ( QDataStream & s, const QKeySequence &
32           keysequence )
33       QDataStream & operator>> ( QDataStream & s, QKeySequence & keysequence
34           )
35

DESCRIPTION

37       The QKeySequence class encapsulates a key sequence as used by
38       accelerators.
39
40       A key sequence consists of up to four keyboard codes, each optionally
41       combined with modifiers, e.g. SHIFT, CTRL, ALT, META, or UNICODE_ACCEL.
42       For example, CTRL + Key_P might be a sequence used as a shortcut for
43       printing a document. The key codes are listed in qnamespace.h. As an
44       alternative, use UNICODE_ACCEL with the unicode code point of the
45       character. For example, UNICODE_ACCEL + 'A' gives the same key sequence
46       as Key_A.
47
48       Key sequences can be constructed either from an integer key code, or
49       from a human readable translatable string such as" Ctrl+X,Alt+Space". A
50       key sequence can be cast to a QString to obtain a human readable
51       translated version of the sequence. Translations are done in the
52       "QAccel" context.
53
54       See also QAccel and Miscellaneous Classes.
55

MEMBER FUNCTION DOCUMENTATION

QKeySequence::QKeySequence ()

58       Constructs an empty key sequence.
59

QKeySequence::QKeySequence ( const QString & key )

61       Creates a key sequence from the string key. For example" Ctrl+O" gives
62       CTRL+UNICODE_ACCEL+'O'. The strings "Ctrl"," Shift", "Alt" and "Meta"
63       are recognized, as well as their translated equivalents in the "QAccel"
64       context (using QObject::tr()).
65
66       Multiple key codes (up to four) may be entered by separating them with
67       commas, e.g. "Alt+X,Ctrl+S,Q".
68
69       This contructor is typically used with tr(), so that accelerator keys
70       can be replaced in translations:
71
72               QPopupMenu *file = new QPopupMenu( this );
73               file->insertItem( tr("&Open..."), this, SLOT(open()),
74                                 QKeySequence( tr("Ctrl+O", "File|Open") ) );
75
76       Note the "File|Open" translator comment. It is by no means necessary,
77       but it provides some context for the human translator.
78

QKeySequence::QKeySequence ( int key )

80       Constructs a key sequence that has a single key.
81
82       The key codes are listed in qnamespace.h and can be combined with
83       modifiers, e.g. with SHIFT, CTRL, ALT, META or UNICODE_ACCEL.
84

QKeySequence::QKeySequence ( int k1, int k2, int k3 = 0, int k4 = 0 )

86       Constructs a key sequence with up to 4 keys k1, k2, k3 and k4.
87
88       The key codes are listed in qnamespace.h and can be combined with
89       modifiers, e.g. with SHIFT, CTRL, ALT, META or UNICODE_ACCEL.
90

QKeySequence::QKeySequence ( const QKeySequence & keysequence )

92       Copy constructor. Makes a copy of keysequence.
93

QKeySequence::~QKeySequence ()

95       Destroys the key sequence.
96

uint QKeySequence::count () const

98       Returns the number of keys in the key sequence. The maximum is 4.
99

bool QKeySequence::isEmpty () const

101       Returns TRUE if the key sequence is empty; otherwise returns FALSE.
102

Qt::SequenceMatch QKeySequence::matches ( const QKeySequence & seq ) const

104       Matches the sequence with seq. Returns Qt::Identical if successful,
105       Qt::PartialMatch for matching but incomplete seq, and Qt::NoMatch if
106       the sequences have nothing in common. Returns Qt::NoMatch if seq is
107       shorter.
108

QKeySequence::operator QString () const

110       Creates an accelerator string for the key sequence. For instance
111       CTRL+Key_O gives "Ctrl+O". If the key sequence has multiple key codes
112       they are returned comma-separated, e.g." Alt+X, Ctrl+Y, Z". The
113       strings, "Ctrl", "Shift", etc. are translated (using QObject::tr()) in
114       the "QAccel" scope. If the key sequence has no keys, QString::null is
115       returned.
116
117       On Mac OS X, the string returned resembles the sequence that is shown
118       in the menubar.
119

QKeySequence::operator int () const

121       This function is obsolete. It is provided to keep old source working.
122       We strongly advise against using it in new code.
123
124       For backward compatibility: returns the first keycode as integer. If
125       the key sequence is empty, 0 is returned.
126

bool QKeySequence::operator!= ( const QKeySequence & keysequence ) const

128       Returns TRUE if keysequence is not equal to this key sequence;
129       otherwise returns FALSE.
130

QKeySequence & QKeySequence::operator= ( const QKeySequence & keysequence )

132       Assignment operator. Assigns keysequence to this object.
133

bool QKeySequence::operator== ( const QKeySequence & keysequence ) const

135       Returns TRUE if keysequence is equal to this key sequence; otherwise
136       returns FALSE.
137

int QKeySequence::operator[] ( uint index ) const

139       Returns a reference to the element at position index in the key
140       sequence. This can only be used to read an element.
141

QDataStream & operator<< ( QDataStream & s, const QKeySequence & keysequence )

144
145       Writes the key sequence keysequence to the stream s.
146
147       See also Format of the QDataStream operators.
148

QDataStream & operator>> ( QDataStream & s, QKeySequence & keysequence )

150       Reads a key sequence from the stream s into the key sequence
151       keysequence.
152
153       See also Format of the QDataStream operators.
154
155

SEE ALSO

157       http://doc.trolltech.com/qkeysequence.html
158       http://www.trolltech.com/faq/tech.html
159
161       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
162       license file included in the distribution for a complete license
163       statement.
164

AUTHOR

166       Generated automatically from the source code.
167

BUGS

169       If you find a bug in Qt, please report it as described in
170       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
171       help you. Thank you.
172
173       The definitive Qt documentation is provided in HTML format; it is
174       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
175       web browser. This man page is provided as a convenience for those users
176       who prefer man pages, although this format is not officially supported
177       by Trolltech.
178
179       If you find errors in this manual page, please report them to qt-
180       bugs@trolltech.com.  Please include the name of the manual page
181       (qkeysequence.3qt) and the Qt version (3.3.8).
182
183
184
185Trolltech AS                    2 February 2007              QKeySequence(3qt)
Impressum