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