File: qkeysequence.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (89 lines) | stat: -rw-r--r-- 14,612 bytes parent folder | download
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QKeySequence Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QKeySequence Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QKeySequence class encapsulates a key sequence as used by shortcuts. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qkeysequence.html#SequenceFormat-enum">SequenceFormat</a></b> { NativeText, PortableText }</li><li><div class="fn" />enum <b><a href="qkeysequence.html#SequenceMatch-enum">SequenceMatch</a></b> { NoMatch, PartialMatch, ExactMatch }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qkeysequence.html#QKeySequence">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qkeysequence.html#QKeySequence-2">__init__</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" /><b><a href="qkeysequence.html#QKeySequence-3">__init__</a></b> (<i>self</i>, int&#160;<i>k1</i>, int&#160;<i>k2</i>&#160;=&#160;0, int&#160;<i>k3</i>&#160;=&#160;0, int&#160;<i>k4</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qkeysequence.html#QKeySequence-4">__init__</a></b> (<i>self</i>, QVariant)</li><li><div class="fn" /><b><a href="qkeysequence.html#QKeySequence-5">__init__</a></b> (<i>self</i>, QKeySequence&#160;<i>ks</i>)</li><li><div class="fn" />unsigned long <b><a href="qkeysequence.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />SequenceMatch <b><a href="qkeysequence.html#matches">matches</a></b> (<i>self</i>, QKeySequence&#160;<i>seq</i>)</li><li><div class="fn" />QString <b><a href="qkeysequence.html#toString">toString</a></b> (<i>self</i>, SequenceFormat&#160;<i>format</i>&#160;=&#160;QKeySequence.PortableText)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QKeySequence <b><a href="qkeysequence.html#fromString">fromString</a></b> (QString&#160;<i>str</i>, SequenceFormat&#160;<i>format</i>&#160;=&#160;QKeySequence.PortableText)</li><li><div class="fn" />QKeySequence <b><a href="qkeysequence.html#mnemonic">mnemonic</a></b> (QString&#160;<i>text</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qkeysequence.html#__eq__">__eq__</a></b> (<i>self</i>, QKeySequence&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#__ge__">__ge__</a></b> (<i>self</i>, QKeySequence&#160;<i>other</i>)</li><li><div class="fn" />int <b><a href="qkeysequence.html#__getitem__">__getitem__</a></b> (<i>self</i>, unsigned long&#160;<i>i</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#__gt__">__gt__</a></b> (<i>self</i>, QKeySequence&#160;<i>other</i>)</li><li><div class="fn" />int <b><a href="qkeysequence.html#__int__">__int__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#__le__">__le__</a></b> (<i>self</i>, QKeySequence&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#__lt__">__lt__</a></b> (<i>self</i>, QKeySequence&#160;<i>ks</i>)</li><li><div class="fn" />bool <b><a href="qkeysequence.html#__ne__">__ne__</a></b> (<i>self</i>, QKeySequence&#160;<i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>A Python int object or a
    <a href="qstring.html">QString</a>
    may be used whenever a
    <a href="qkeysequence.html">QKeySequence</a>
    is expected.</p>
  <p>The QKeySequence class encapsulates a key sequence as used by shortcuts.</p>
<p>A key sequence consists of up to four keyboard codes, each optionally combined with modifiers, such as <a href="qt.html#Modifier-enum">Qt.SHIFT</a>, <a href="qt.html#Modifier-enum">Qt.CTRL</a>, <a href="qt.html#Modifier-enum">Qt.ALT</a> or <a href="qt.html#Modifier-enum">Qt.META</a>. For example, <a href="qt.html#Modifier-enum">Qt.CTRL</a> + <a href="qt.html#Key-enum">Qt.Key_P</a> might be a sequence used as a shortcut for printing a document. Valid codes for keys and modifiers are listed in <a href="qt.html#Key-enum">Qt.Key</a> and <a href="qt.html#Modifier-enum">Qt.Modifier</a>. As an alternative, use the unicode code point of the character; for example, 'A' gives the same key sequence as <a href="qt.html#Key-enum">Qt.Key_A</a>.</p>
<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 "<a href="qshortcut.html">QShortcut</a>" context.</p>
<p><b>Note:</b> On Mac OS X, references to "Ctrl", <a href="qt.html#Modifier-enum">Qt.CTRL</a>, Qt.Control and <a href="qt.html#KeyboardModifier-enum">Qt.ControlModifier</a> correspond to the Command keys on the Macintosh keyboard, and references to "Meta", <a href="qt.html#Modifier-enum">Qt.META</a>, Qt.Meta and <a href="qt.html#KeyboardModifier-enum">Qt.MetaModifier</a> 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.</p>
<p>The <a href="qkeysequence.html#toString">toString</a>() 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.</p>
<p>See also <a href="qshortcut.html">QShortcut</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="SequenceFormat-enum" />QKeySequence.SequenceFormat</h3><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QKeySequence.NativeText</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">The key sequence as a platform specific string. This means that it will be shown translated and on the Mac it will resemble a keysequence from the menu bar. This enum is best used when you want to display the string to the user.</td>
</tr>
<tr>
<td valign="top"><tt>QKeySequence.PortableText</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">The key sequence is given in a "portable" format, suitable for reading and writing to a file. In many cases, it will look similar to the native text on Windows and X11.</td>
</tr>
</table>
<br />
<br />
<h3 class="fn"><a name="SequenceMatch-enum" />QKeySequence.SequenceMatch</h3><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QKeySequence.NoMatch</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">The key sequences are different; not even partially matching.</td>
</tr>
<tr>
<td valign="top"><tt>QKeySequence.PartialMatch</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">The key sequences match partially, but are not the same.</td>
</tr>
<tr>
<td valign="top"><tt>QKeySequence.ExactMatch</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
<td valign="top">The key sequences are the same.</td>
</tr>
</table>
<br />
<br />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QKeySequence" />QKeySequence.__init__ (<i>self</i>)</h3><p>Constructs an empty key sequence.</p>
<h3 class="fn"><a name="QKeySequence-2" />QKeySequence.__init__ (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>key</i>)</h3><p>Creates a key sequence from the <i>key</i> string. For example "Ctrl+O" gives CTRL+'O'. The strings "Ctrl", "Shift", "Alt" and "Meta" are recognized, as well as their translated equivalents in the "<a href="qshortcut.html">QShortcut</a>" context (using <a href="qobject.html#tr">QObject.tr</a>()).</p>
<p>Up to four key codes may be entered by separating them with commas, e.g. "Alt+X,Ctrl+S,Q".</p>
<p>This contructor is typically used with <a href="qobject.html#tr">tr</a>(), so that shortcut keys can be replaced in translations:</p>
<pre>
    QMenu *file = new QMenu(this);
    file-&gt;addAction(tr("&amp;Open..."), this, SLOT(open()),
                      QKeySequence(tr("Ctrl+O", "File|Open")));
</pre>
<p>Note the "File|Open" translator comment. It is by no means necessary, but it provides some context for the human translator.</p>
<h3 class="fn"><a name="QKeySequence-3" />QKeySequence.__init__ (<i>self</i>, int&#160;<i>k1</i>, int&#160;<i>k2</i>&#160;=&#160;0, int&#160;<i>k3</i>&#160;=&#160;0, int&#160;<i>k4</i>&#160;=&#160;0)</h3><p>Constructs a key sequence with up to 4 keys <i>k1</i>, <i>k2</i>, <i>k3</i> and <i>k4</i>.</p>
<p>The key codes are listed in <a href="qt.html#Key-enum">Qt.Key</a> and can be combined with modifiers (see <a href="qt.html#Modifier-enum">Qt.Modifier</a>) such as <a href="qt.html#Modifier-enum">Qt.SHIFT</a>, <a href="qt.html#Modifier-enum">Qt.CTRL</a>, <a href="qt.html#Modifier-enum">Qt.ALT</a>, or <a href="qt.html#Modifier-enum">Qt.META</a>.</p>
<h3 class="fn"><a name="QKeySequence-4" />QKeySequence.__init__ (<i>self</i>, <a href="qvariant.html">QVariant</a>)</h3><p>Copy constructor. Makes a copy of <i>keysequence</i>.</p>
<h3 class="fn"><a name="QKeySequence-5" />QKeySequence.__init__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>ks</i>)</h3><h3 class="fn"><a name="count" />unsigned long QKeySequence.count (<i>self</i>)</h3><p>Returns the number of keys in the key sequence. The maximum is 4.</p>
<h3 class="fn"><a name="fromString" /><a href="qkeysequence.html">QKeySequence</a> QKeySequence.fromString (<a href="qstring.html">QString</a>&#160;<i>str</i>, <a href="qkeysequence.html#SequenceFormat-enum">SequenceFormat</a>&#160;<i>format</i>&#160;=&#160;QKeySequence.PortableText)</h3><p>Return a <a href="qkeysequence.html">QKeySequence</a> from the string <i>str</i> based on <i>format</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qkeysequence.html#toString">toString</a>().</p>
<h3 class="fn"><a name="isDetached" />bool QKeySequence.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isEmpty" />bool QKeySequence.isEmpty (<i>self</i>)</h3><p>Returns true if the key sequence is empty; otherwise returns false.</p>
<h3 class="fn"><a name="matches" /><a href="qkeysequence.html#SequenceMatch-enum">SequenceMatch</a> QKeySequence.matches (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>seq</i>)</h3><p>Matches the sequence with <i>seq</i>. Returns <a href="qkeysequence.html#SequenceMatch-enum">ExactMatch</a> if successful, <a href="qkeysequence.html#SequenceMatch-enum">PartialMatch</a> if <i>seq</i> matches incompletely, and <a href="qkeysequence.html#SequenceMatch-enum">NoMatch</a> if the sequences have nothing in common. Returns <a href="qkeysequence.html#SequenceMatch-enum">NoMatch</a> if <i>seq</i> is shorter.</p>
<h3 class="fn"><a name="mnemonic" /><a href="qkeysequence.html">QKeySequence</a> QKeySequence.mnemonic (<a href="qstring.html">QString</a>&#160;<i>text</i>)</h3><p>Returns the shortcut key sequence for the mnemonic in <i>text</i>, or an empty key sequence if no mnemonics are found.</p>
<p>For example, mnemonic("E&amp;xit") returns <tt>Qt.ALT+Qt.Key_X</tt>, mnemonic("&amp;Quit") returns <tt>ALT+Key_Q</tt>, and mnemonic("Quit") returns an empty <a href="qkeysequence.html">QKeySequence</a>.</p>
<p>We provide a <a href="accelerators.html">list of common mnemonics</a> in English. At the time of writing, Microsoft and Open Group do not appear to have issued equivalent recommendations for other languages.</p>
<h3 class="fn"><a name="toString" /><a href="qstring.html">QString</a> QKeySequence.toString (<i>self</i>, <a href="qkeysequence.html#SequenceFormat-enum">SequenceFormat</a>&#160;<i>format</i>&#160;=&#160;QKeySequence.PortableText)</h3><p>Return a string representation of the key sequence based on <i>format</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qkeysequence.html#fromString">fromString</a>().</p>
<h3 class="fn"><a name="__eq__" />bool QKeySequence.__eq__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ge__" />bool QKeySequence.__ge__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__getitem__" />int QKeySequence.__getitem__ (<i>self</i>, unsigned long&#160;<i>i</i>)</h3><h3 class="fn"><a name="__gt__" />bool QKeySequence.__gt__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__int__" />int QKeySequence.__int__ (<i>self</i>)</h3><h3 class="fn"><a name="__le__" />bool QKeySequence.__le__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__lt__" />bool QKeySequence.__lt__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>ks</i>)</h3><h3 class="fn"><a name="__ne__" />bool QKeySequence.__ne__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>