1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qkeysequence.cpp:56 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QKeySequence Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QKeySequence Class Reference</h1>
<p>The QKeySequence class encapsulates a key sequence as used
by accelerators.
<a href="#details">More...</a>
<p><tt>#include <<a href="qkeysequence-h.html">qkeysequence.h</a>></tt>
<p>Inherits <a href="qt.html">Qt</a>.
<p><a href="qkeysequence-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QKeySequence"><b>QKeySequence</b></a> ()</li>
<li class=fn><a href="#QKeySequence-2"><b>QKeySequence</b></a> ( const QString & key )</li>
<li class=fn><a href="#QKeySequence-3"><b>QKeySequence</b></a> ( int key )</li>
<li class=fn><a href="#QKeySequence-4"><b>QKeySequence</b></a> ( int k1, int k2, int k3 = 0, int k4 = 0 )</li>
<li class=fn><a href="#QKeySequence-5"><b>QKeySequence</b></a> ( const QKeySequence & keysequence )</li>
<li class=fn><a href="#~QKeySequence"><b>~QKeySequence</b></a> ()</li>
<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
<li class=fn>Qt::SequenceMatch <a href="#matches"><b>matches</b></a> ( const QKeySequence & seq ) const</li>
<li class=fn><a href="#operator-QString"><b>operator QString</b></a> () const</li>
<li class=fn>operator int () const <em>(obsolete)</em></li>
<li class=fn>int <a href="#operator[]"><b>operator[]</b></a> ( uint index ) const</li>
<li class=fn>QKeySequence & <a href="#operator-eq"><b>operator=</b></a> ( const QKeySequence & keysequence )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QKeySequence & keysequence ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QKeySequence & keysequence ) const</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QKeySequence & keysequence )</li>
<li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QKeySequence & keysequence )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QKeySequence class encapsulates a key sequence as used
by accelerators.
<p>
<p> A key sequence consists of up to four keyboard codes, each
optionally combined with modifiers, e.g. <a href="qt.html#Modifier-enum">SHIFT</a>, <a href="qt.html#Modifier-enum">CTRL</a>, <a href="qt.html#Modifier-enum">ALT</a>, <a href="qt.html#Modifier-enum">META</a>, or <a href="qt.html#Modifier-enum">UNICODE_ACCEL</a>. For example, <tt>CTRL + Key_P</tt>
might be a sequence used as a shortcut for printing a document.
The key codes are listed in <a href="qnamespace-h.html">qnamespace.h</a>. As an alternative,
use <a href="qt.html#Modifier-enum">UNICODE_ACCEL</a> with the unicode code point of the character.
For example, <tt>UNICODE_ACCEL + 'A'</tt> gives the same key sequence
as <a href="qt.html#Key-enum">Key_A</a>.
<p> 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 <a href="qstring.html">QString</a> to
obtain a human readable translated version of the sequence.
Translations are done in the "QAccel" context.
<p> <p>See also <a href="qaccel.html">QAccel</a> and <a href="misc.html">Miscellaneous Classes</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QKeySequence"></a>QKeySequence::QKeySequence ()
</h3>
Constructs an empty key sequence.
<h3 class=fn><a name="QKeySequence-2"></a>QKeySequence::QKeySequence ( const <a href="qstring.html">QString</a> & key )
</h3>
Creates a key sequence from the string <em>key</em>. For example
"Ctrl+O" gives CTRL+UNICODE_ACCEL+'O'. The strings "Ctrl",
"Shift", "Alt" and "Meta" are recognized, as well as their
translated equivalents in the "QAccel" context (using
<a href="qobject.html#tr">QObject::tr</a>()).
<p> Multiple key codes (up to four) may be entered by separating them
with commas, e.g. "Alt+X,Ctrl+S,Q".
<p> This contructor is typically used with <a href="qobject.html#tr">tr</a>(), so that accelerator keys can be replaced in
translations:
<p> <pre>
<a href="qpopupmenu.html">QPopupMenu</a> *file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
file-><a href="qmenudata.html#insertItem">insertItem</a>( tr("&Open..."), this, SLOT(open()),
<a href="#QKeySequence">QKeySequence</a>( tr("Ctrl+O", "File|Open") ) );
</pre>
<p> Note the <tt>"File|Open"</tt> translator comment. It is by no means
necessary, but it provides some context for the human translator.
<h3 class=fn><a name="QKeySequence-3"></a>QKeySequence::QKeySequence ( int key )
</h3>
Constructs a key sequence that has a single <em>key</em>.
<p> The key codes are listed in <a href="qnamespace-h.html">qnamespace.h</a> and can be
combined with modifiers, e.g. with <a href="qt.html#Modifier-enum">SHIFT</a>, <a href="qt.html#Modifier-enum">CTRL</a>, <a href="qt.html#Modifier-enum">ALT</a>, <a href="qt.html#Modifier-enum">META</a> or <a href="qt.html#Modifier-enum">UNICODE_ACCEL</a>.
<h3 class=fn><a name="QKeySequence-4"></a>QKeySequence::QKeySequence ( int k1, int k2, int k3 = 0, int k4 = 0 )
</h3>
Constructs a key sequence with up to 4 keys <em>k1</em>, <em>k2</em>,
<em>k3</em> and <em>k4</em>.
<p> The key codes are listed in <a href="qnamespace-h.html">qnamespace.h</a> and can be
combined with modifiers, e.g. with <a href="qt.html#Modifier-enum">SHIFT</a>, <a href="qt.html#Modifier-enum">CTRL</a>, <a href="qt.html#Modifier-enum">ALT</a>, <a href="qt.html#Modifier-enum">META</a> or <a href="qt.html#Modifier-enum">UNICODE_ACCEL</a>.
<h3 class=fn><a name="QKeySequence-5"></a>QKeySequence::QKeySequence ( const <a href="qkeysequence.html">QKeySequence</a> & keysequence )
</h3>
Copy constructor. Makes a copy of <em>keysequence</em>.
<h3 class=fn><a name="~QKeySequence"></a>QKeySequence::~QKeySequence ()
</h3>
Destroys the key sequence.
<h3 class=fn>uint <a name="count"></a>QKeySequence::count () const
</h3>
Returns the number of keys in the key sequence.
The maximum is 4.
<h3 class=fn>bool <a name="isEmpty"></a>QKeySequence::isEmpty () const
</h3>
Returns TRUE if the key sequence is empty; otherwise returns
FALSE.
<h3 class=fn><a href="qt.html#SequenceMatch-enum">Qt::SequenceMatch</a> <a name="matches"></a>QKeySequence::matches ( const <a href="qkeysequence.html">QKeySequence</a> & seq ) const
</h3>
Matches the sequence with <em>seq</em>. Returns <a href="qt.html#SequenceMatch-enum">Qt::Identical</a> if
successful, <a href="qt.html#SequenceMatch-enum">Qt::PartialMatch</a> for matching but incomplete <em>seq</em>,
and <a href="qt.html#SequenceMatch-enum">Qt::NoMatch</a> if the sequences have nothing in common.
Returns <a href="qt.html#SequenceMatch-enum">Qt::NoMatch</a> if <em>seq</em> is shorter.
<h3 class=fn><a name="operator-QString"></a>QKeySequence::operator QString () const
</h3>
Creates an accelerator string for the key sequence.
For instance CTRL+Key_O gives "Ctrl+O". If the key sequence has
multiple key codes they are returned comma-separated, e.g.
"Alt+X, Ctrl+Y, Z". The strings, "Ctrl", "Shift", etc. are
translated (using <a href="qobject.html#tr">QObject::tr</a>()) in the "QAccel" scope. If the key
sequence has no keys, <a href="qstring.html#QString-null">QString::null</a> is returned.
<p> On Mac OS X, the string returned resembles the sequence that is shown in
the menubar.
<h3 class=fn><a name="operator-int"></a>QKeySequence::operator int () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> For backward compatibility: returns the first keycode
as integer. If the key sequence is empty, 0 is returned.
<h3 class=fn>bool <a name="operator!-eq"></a>QKeySequence::operator!= ( const <a href="qkeysequence.html">QKeySequence</a> & keysequence ) const
</h3>
Returns TRUE if <em>keysequence</em> is not equal to this key sequence;
otherwise returns FALSE.
<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> & <a name="operator-eq"></a>QKeySequence::operator= ( const <a href="qkeysequence.html">QKeySequence</a> & keysequence )
</h3>
Assignment operator. Assigns <em>keysequence</em> to this
object.
<h3 class=fn>bool <a name="operator-eq-eq"></a>QKeySequence::operator== ( const <a href="qkeysequence.html">QKeySequence</a> & keysequence ) const
</h3>
Returns TRUE if <em>keysequence</em> is equal to this key
sequence; otherwise returns FALSE.
<h3 class=fn>int <a name="operator[]"></a>QKeySequence::operator[] ( uint index ) const
</h3>
Returns a reference to the element at position <em>index</em> in the key
sequence. This can only be used to read an element.
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qkeysequence.html">QKeySequence</a> & keysequence )
</h3>
<p> Writes the key sequence <em>keysequence</em> to the stream <em>s</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qkeysequence.html">QKeySequence</a> & keysequence )
</h3>
<p> Reads a key sequence from the stream <em>s</em> into the key sequence <em>keysequence</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|