Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 994

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QShortcut 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="index.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">QShortcut Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QShortcut class is used to create keyboard shortcuts.
<a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qshortcut.html#QShortcut">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>)</li><li><div class="fn" /><b><a href="qshortcut.html#QShortcut-2">__init__</a></b> (<i>self</i>, QKeySequence&#160;<i>key</i>, QWidget&#160;<i>parent</i>, SLOT()&#160;<i>member</i>&#160;=&#160;0, SLOT()&#160;<i>ambiguousMember</i>&#160;=&#160;0, Qt.ShortcutContext&#160;<i>context</i>&#160;=&#160;Qt.WindowShortcut)</li><li><div class="fn" />bool <b><a href="qshortcut.html#autoRepeat">autoRepeat</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.ShortcutContext <b><a href="qshortcut.html#context">context</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qshortcut.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />int <b><a href="qshortcut.html#id">id</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qshortcut.html#isEnabled">isEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QKeySequence <b><a href="qshortcut.html#key">key</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qshortcut.html#parentWidget">parentWidget</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qshortcut.html#setAutoRepeat">setAutoRepeat</a></b> (<i>self</i>, bool&#160;<i>on</i>)</li><li><div class="fn" /><b><a href="qshortcut.html#setContext">setContext</a></b> (<i>self</i>, Qt.ShortcutContext&#160;<i>context</i>)</li><li><div class="fn" /><b><a href="qshortcut.html#setEnabled">setEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qshortcut.html#setKey">setKey</a></b> (<i>self</i>, QKeySequence&#160;<i>key</i>)</li><li><div class="fn" /><b><a href="qshortcut.html#setWhatsThis">setWhatsThis</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QString <b><a href="qshortcut.html#whatsThis">whatsThis</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qshortcut.html#activated">activated</a></b> ()</li><li><div class="fn" />void <b><a href="qshortcut.html#activatedAmbiguously">activatedAmbiguously</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QShortcut class is used to create keyboard shortcuts.</p>
<p>The QShortcut class provides a way of connecting keyboard
shortcuts to Qt's <a href="signalsandslots.html#signals-and-slots">signals and slots</a>
mechanism, so that objects can be informed when a shortcut is
executed. The shortcut can be set up to contain all the key presses
necessary to describe a keyboard shortcut, including the states of
modifier keys such as <b>Shift</b>, <b>Ctrl</b>, and
<b>Alt</b>.</p>
<a id="mnemonic" name="mnemonic" />
<p>On certain widgets, using '&amp;' in front of a character will
automatically create a mnemonic (a shortcut) for that character,
e.g. "E&amp;xit" will create the shortcut <b>Alt+X</b> (use
'&amp;&amp;' to display an actual ampersand). The widget might
consume and perform an action on a given shortcut. On X11 the
ampersand will not be shown and the character will be underlined.
On Windows, shortcuts are normally not displayed until the user
presses the <b>Alt</b> key, but this is a setting the user can
change. On Mac, shortcuts are disabled by default. Call <a href="qtcore.html#qt_set_sequence_auto_mnemonic">qt_set_sequence_auto_mnemonic</a>()
to enable them. However, because mnemonic shortcuts do not fit in
with Aqua's guidelines, Qt will not show the shortcut character
underlined.</p>
<p>For applications that use menus, it may be more convenient to
use the convenience functions provided in the <a href="qmenu.html">QMenu</a> class to assign keyboard shortcuts to menu
items as they are created. Alternatively, shortcuts may be
associated with other types of actions in the <a href="qaction.html">QAction</a> class.</p>
<p>The simplest way to create a shortcut for a particular widget is
to construct the shortcut with a key sequence. For example:</p>
<pre class="cpp">
 shortcut <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QShortcut</span>(<span class="type"><a href="qkeysequence.html">QKeySequence</a></span>(tr(<span class="string">"Ctrl+O"</span><span class="operator">,</span> <span class="string">"File|Open"</span>))<span class="operator">,</span>
                          parent);
</pre>
<p>When the user types the <a href="qkeysequence.html">key
sequence</a> for a given shortcut, the shortcut's <a href="qshortcut.html#activated">activated</a>() signal is emitted. (In
the case of ambiguity, the <a href="qshortcut.html#activatedAmbiguously">activatedAmbiguously</a>()
signal is emitted.) A shortcut is "listened for" by Qt's event loop
when the shortcut's parent widget is receiving events.</p>
<p>A shortcut's key sequence can be set with <a href="qshortcut.html#key-prop">setKey</a>() and retrieved with <a href="qshortcut.html#key-prop">key</a>(). A shortcut can be enabled or
disabled with <a href="qshortcut.html#enabled-prop">setEnabled</a>(), and can have
"What's This?" help text set with <a href="qshortcut.html#whatsThis-prop">setWhatsThis</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QShortcut" />QShortcut.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qshortcut.html">QShortcut</a> object for
the <i>parent</i> widget. Since no shortcut key sequence is
specified, the shortcut will not emit any signals.</p>
<p><b>See also</b> <a href="qshortcut.html#key-prop">setKey</a>().</p>


<h3 class="fn"><a name="QShortcut-2" />QShortcut.__init__ (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>key</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, SLOT()&#160;<i>member</i>&#160;=&#160;0, SLOT()&#160;<i>ambiguousMember</i>&#160;=&#160;0, <a href="qt.html#ShortcutContext-enum">Qt.ShortcutContext</a>&#160;<i>context</i>&#160;=&#160;Qt.WindowShortcut)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qshortcut.html">QShortcut</a> object for
the <i>parent</i> widget. The shortcut operates on its parent,
listening for <a href="qshortcutevent.html">QShortcutEvent</a>s
that match the <i>key</i> sequence. Depending on the ambiguity of
the event, the shortcut will call the <i>member</i> function, or
the <i>ambiguousMember</i> function, if the key press was in the
shortcut's <i>context</i>.</p>


<h3 class="fn"><a name="autoRepeat" />bool QShortcut.autoRepeat (<i>self</i>)</h3><h3 class="fn"><a name="context" /><a href="qt.html#ShortcutContext-enum">Qt.ShortcutContext</a> QShortcut.context (<i>self</i>)</h3><h3 class="fn"><a name="event" />bool QShortcut.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><h3 class="fn"><a name="id" />int QShortcut.id (<i>self</i>)</h3><p>Returns the shortcut's ID.</p>
<p><b>See also</b> <a href="qshortcutevent.html#shortcutId">QShortcutEvent.shortcutId</a>().</p>


<h3 class="fn"><a name="isEnabled" />bool QShortcut.isEnabled (<i>self</i>)</h3><h3 class="fn"><a name="key" /><a href="qkeysequence.html">QKeySequence</a> QShortcut.key (<i>self</i>)</h3><h3 class="fn"><a name="parentWidget" /><a href="qwidget.html">QWidget</a> QShortcut.parentWidget (<i>self</i>)</h3><p>Returns the shortcut's parent widget.</p>
<h3 class="fn"><a name="setAutoRepeat" />QShortcut.setAutoRepeat (<i>self</i>, bool&#160;<i>on</i>)</h3><h3 class="fn"><a name="setContext" />QShortcut.setContext (<i>self</i>, <a href="qt.html#ShortcutContext-enum">Qt.ShortcutContext</a>&#160;<i>context</i>)</h3><h3 class="fn"><a name="setEnabled" />QShortcut.setEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="setKey" />QShortcut.setKey (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a>&#160;<i>key</i>)</h3><h3 class="fn"><a name="setWhatsThis" />QShortcut.setWhatsThis (<i>self</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="whatsThis" />QString QShortcut.whatsThis (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="activated" />void activated ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user types the shortcut's key
sequence.</p>
<p><b>See also</b> <a href="qshortcut.html#activatedAmbiguously">activatedAmbiguously</a>().</p>


<h3 class="fn"><a name="activatedAmbiguously" />void activatedAmbiguously ()</h3><p>This is the default overload of this signal.</p><p>When a key sequence is being typed at the keyboard, it is said
to be ambiguous as long as it matches the start of more than one
shortcut.</p>
<p>When a shortcut's key sequence is completed,
activatedAmbiguously() is emitted if the key sequence is still
ambiguous (i.e., it is the start of one or more other shortcuts).
The <a href="qshortcut.html#activated">activated</a>() signal is
not emitted in this case.</p>
<p><b>See also</b> <a href="qshortcut.html#activated">activated</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 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.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>