Files
qt4-x11/doc/html/qshortcut.html
2025-08-24 20:55:26 +08:00

392 lines
27 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qshortcut.cpp -->
<title>Qt 4.8: QShortcut Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<script src="scripts/jquery.js" type="text/javascript"></script>
<script src="scripts/functions.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style/superfish.css" />
<link rel="stylesheet" type="text/css" href="style/narrow.css" />
<!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->
<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>
</head>
<body class="" onload="CheckEmptyAndLoadList();">
<div class="header" id="qtdocheader">
<div class="content">
<div id="nav-logo">
<a href="index.html">Home</a></div>
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
<div id="narrowsearch"></div>
<div id="nav-topright">
<ul>
<li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
<li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
<li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
DOC</a></li>
<li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
</ul>
</div>
<div id="shortCut">
<ul>
<li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
<li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li>
</ul>
</div>
<ul class="sf-menu" id="narrowmenu">
<li><a href="#">API Lookup</a>
<ul>
<li><a href="classes.html">Class index</a></li>
<li><a href="functions.html">Function index</a></li>
<li><a href="modules.html">Modules</a></li>
<li><a href="namespaces.html">Namespaces</a></li>
<li><a href="qtglobal.html">Global Declarations</a></li>
<li><a href="qdeclarativeelements.html">QML elements</a></li>
</ul>
</li>
<li><a href="#">Qt Topics</a>
<ul>
<li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
<li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>
<li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
<li><a href="supported-platforms.html">Supported Platforms</a></li>
<li><a href="technology-apis.html">Qt and Key Technologies</a></li>
<li><a href="best-practices.html">How-To's and Best Practices</a></li>
</ul>
</li>
<li><a href="#">Examples</a>
<ul>
<li><a href="all-examples.html">Examples</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="demos.html">Demos</a></li>
<li><a href="qdeclarativeexamples.html">QML Examples</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="hd">
<span></span>
</div>
<div class="bd group">
<div class="sidebar">
<div class="searchlabel">
Search index:</div>
<div class="search" id="sidebarsearch">
<form id="qtdocsearch" action="" onsubmit="return false;">
<fieldset>
<input type="text" name="searchstring" id="pageType" value="" />
<div id="resultdialog">
<a href="#" id="resultclose">Close</a>
<p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p>
<p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p>
<ul id="resultlist" class="all">
</ul>
</div>
</fieldset>
</form>
</div>
<div class="box first bottombar" id="lookup">
<h2 title="API Lookup"><span></span>
API Lookup</h2>
<div id="list001" class="list">
<ul id="ul001" >
<li class="defaultLink"><a href="classes.html">Class index</a></li>
<li class="defaultLink"><a href="functions.html">Function index</a></li>
<li class="defaultLink"><a href="modules.html">Modules</a></li>
<li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
<li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
<li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
</ul>
</div>
</div>
<div class="box bottombar" id="topics">
<h2 title="Qt Topics"><span></span>
Qt Topics</h2>
<div id="list002" class="list">
<ul id="ul002" >
<li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li>
<li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>
<li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
<li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>
<li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li>
<li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li>
</ul>
</div>
</div>
<div class="box" id="examples">
<h2 title="Examples"><span></span>
Examples</h2>
<div id="list003" class="list">
<ul id="ul003">
<li class="defaultLink"><a href="all-examples.html">Examples</a></li>
<li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
<li class="defaultLink"><a href="demos.html">Demos</a></li>
<li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
</ul>
</div>
</div>
</div>
<div class="wrap">
<div class="toolbar">
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QShortcut</li>
</ul>
</div>
<div class="toolbuttons toolblock">
<ul>
<li id="smallA" class="t_button">A</li>
<li id="medA" class="t_button active">A</li>
<li id="bigA" class="t_button">A</li>
<li id="print" class="t_button"><a href="javascript:this.print();">
<span>Print</span></a></li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QShortcut Class Reference</h1>
<!-- $$$QShortcut-brief -->
<p>The QShortcut class is used to create keyboard shortcuts. <a href="#details">More...</a></p>
<!-- @@@QShortcut -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QShortcut&gt;</span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<ul>
<li><a href="qshortcut-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qshortcut.html#autoRepeat-prop">autoRepeat</a></b> : bool</li>
<li class="fn"><b><a href="qshortcut.html#context-prop">context</a></b> : Qt::ShortcutContext</li>
<li class="fn"><b><a href="qshortcut.html#enabled-prop">enabled</a></b> : bool</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qshortcut.html#key-prop">key</a></b> : QKeySequence</li>
<li class="fn"><b><a href="qshortcut.html#whatsThis-prop">whatsThis</a></b> : QString</li>
</ul>
</td></tr>
</table>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#QShortcut">QShortcut</a></b> ( QWidget * <i>parent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#QShortcut-2">QShortcut</a></b> ( const QKeySequence &amp; <i>key</i>, QWidget * <i>parent</i>, const char * <i>member</i> = 0, const char * <i>ambiguousMember</i> = 0, Qt::ShortcutContext <i>context</i> = Qt::WindowShortcut )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#dtor.QShortcut">~QShortcut</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#autoRepeat-prop">autoRepeat</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::ShortcutContext </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#context-prop">context</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#id">id</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#enabled-prop">isEnabled</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QKeySequence </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#key-prop">key</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#parentWidget">parentWidget</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#autoRepeat-prop">setAutoRepeat</a></b> ( bool <i>on</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#context-prop">setContext</a></b> ( Qt::ShortcutContext <i>context</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#enabled-prop">setEnabled</a></b> ( bool <i>enable</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#key-prop">setKey</a></b> ( const QKeySequence &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#whatsThis-prop">setWhatsThis</a></b> ( const QString &amp; <i>text</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#whatsThis-prop">whatsThis</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#activated">activated</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qshortcut.html#activatedAmbiguously">activatedAmbiguously</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QShortcut-description -->
<div class="descr">
<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 name="mnemonic"></a><p>On certain widgets, using '&amp;' in front of a character will automatically create a mnemonic (a shortcut) for that character, e.g&#x2e; &quot;E&amp;xit&quot; 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="qtglobal.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">&quot;Ctrl+O&quot;</span><span class="operator">,</span> <span class="string">&quot;File|Open&quot;</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 &quot;listened for&quot; 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 &quot;What's This?&quot; help text set with <a href="qshortcut.html#whatsThis-prop">setWhatsThis</a>().</p>
</div>
<p><b>See also </b><a href="qshortcutevent.html">QShortcutEvent</a>, <a href="qkeysequence.html">QKeySequence</a>, and <a href="qaction.html">QAction</a>.</p>
<!-- @@@QShortcut -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$autoRepeat-prop$$$autoRepeat$$$setAutoRepeatbool -->
<h3 class="fn"><a name="autoRepeat-prop"></a><span class="name">autoRepeat</span> : <span class="type">bool</span></h3>
<p>This property holds whether the shortcut can auto repeat.</p>
<p>If true, the shortcut will auto repeat when the keyboard shortcut combination is held down, provided that keyboard auto repeat is enabled on the system. The default value is true.</p>
<p>This property was introduced in Qt 4.2.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>autoRepeat</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAutoRepeat</b></span> ( bool <i>on</i> )</td></tr>
</table>
<!-- @@@autoRepeat -->
<!-- $$$context-prop$$$context$$$setContextQt::ShortcutContext -->
<h3 class="fn"><a name="context-prop"></a><span class="name">context</span> : <span class="type"><a href="qt.html#ShortcutContext-enum">Qt::ShortcutContext</a></span></h3>
<p>This property holds the context in which the shortcut is valid.</p>
<p>A shortcut's context decides in which circumstances a shortcut is allowed to be triggered. The normal context is <a href="qt.html#ShortcutContext-enum">Qt::WindowShortcut</a>, which allows the shortcut to trigger if the parent (the widget containing the shortcut) is a subwidget of the active top-level window.</p>
<p>By default, this property is set to <a href="qt.html#ShortcutContext-enum">Qt::WindowShortcut</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::ShortcutContext </td><td class="memItemRight bottomAlign"><span class="name"><b>context</b></span> ()</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setContext</b></span> ( Qt::ShortcutContext <i>context</i> )</td></tr>
</table>
<!-- @@@context -->
<!-- $$$enabled-prop$$$isEnabled$$$setEnabledbool -->
<h3 class="fn"><a name="enabled-prop"></a><span class="name">enabled</span> : <span class="type">bool</span></h3>
<p>This property holds whether the shortcut is enabled.</p>
<p>An enabled shortcut emits the <a href="qshortcut.html#activated">activated</a>() or <a href="qshortcut.html#activatedAmbiguously">activatedAmbiguously</a>() signal when a <a href="qshortcutevent.html">QShortcutEvent</a> occurs that matches the shortcut's <a href="qshortcut.html#key-prop">key</a>() sequence.</p>
<p>If the application is in <tt>WhatsThis</tt> mode the shortcut will not emit the signals, but will show the &quot;What's This?&quot; text instead.</p>
<p>By default, this property is true.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isEnabled</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setEnabled</b></span> ( bool <i>enable</i> )</td></tr>
</table>
<p><b>See also </b><a href="qshortcut.html#whatsThis-prop">whatsThis</a>.</p>
<!-- @@@enabled -->
<!-- $$$key-prop$$$key$$$setKeyconstQKeySequence& -->
<h3 class="fn"><a name="key-prop"></a><span class="name">key</span> : <span class="type"><a href="qkeysequence.html">QKeySequence</a></span></h3>
<p>This property holds the shortcut's key sequence.</p>
<p>This is a key sequence with an optional combination of Shift, Ctrl, and Alt. The key sequence may be supplied in a number of ways:</p>
<pre class="cpp"> setKey(<span class="number">0</span>); <span class="comment">// no signal emitted</span>
setKey(<span class="type"><a href="qkeysequence.html">QKeySequence</a></span>()); <span class="comment">// no signal emitted</span>
setKey(<span class="number">0x3b1</span>); <span class="comment">// Greek letter alpha</span>
setKey(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>Key_D); <span class="comment">// 'd', e.g. to delete</span>
setKey(<span class="char">'q'</span>); <span class="comment">// 'q', e.g. to quit</span>
setKey(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>CTRL <span class="operator">+</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>Key_P); <span class="comment">// Ctrl+P, e.g. to print document</span>
setKey(<span class="string">&quot;Ctrl+P&quot;</span>); <span class="comment">// Ctrl+P, e.g. to print document</span></pre>
<p>By default, this property contains an empty key sequence.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QKeySequence </td><td class="memItemRight bottomAlign"><span class="name"><b>key</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setKey</b></span> ( const QKeySequence &amp; <i>key</i> )</td></tr>
</table>
<!-- @@@key -->
<!-- $$$whatsThis-prop$$$whatsThis$$$setWhatsThisconstQString& -->
<h3 class="fn"><a name="whatsThis-prop"></a><span class="name">whatsThis</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the shortcut's "What's This?" help text.</p>
<p>The text will be shown when the application is in &quot;What's This?&quot; mode and the user types the shortcut <a href="qshortcut.html#key-prop">key</a>() sequence.</p>
<p>To set &quot;What's This?&quot; help on a menu item (with or without a shortcut key), set the help on the item's action.</p>
<p>By default, this property contains an empty string.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>whatsThis</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setWhatsThis</b></span> ( const QString &amp; <i>text</i> )</td></tr>
</table>
<p><b>See also </b><a href="qwhatsthis.html#inWhatsThisMode">QWhatsThis::inWhatsThisMode</a>() and <a href="qaction.html#whatsThis-prop">QAction::setWhatsThis</a>().</p>
<!-- @@@whatsThis -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QShortcut[overload1]$$$QShortcutQWidget* -->
<h3 class="fn"><a name="QShortcut"></a>QShortcut::<span class="name">QShortcut</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> )</h3>
<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>
<!-- @@@QShortcut -->
<!-- $$$QShortcut$$$QShortcutconstQKeySequence&QWidget*constchar*constchar*Qt::ShortcutContext -->
<h3 class="fn"><a name="QShortcut-2"></a>QShortcut::<span class="name">QShortcut</span> ( const <span class="type"><a href="qkeysequence.html">QKeySequence</a></span> &amp; <i>key</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type">char</span> * <i>member</i> = 0, const <span class="type">char</span> * <i>ambiguousMember</i> = 0, <span class="type"><a href="qt.html#ShortcutContext-enum">Qt::ShortcutContext</a></span> <i>context</i> = Qt::WindowShortcut )</h3>
<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>
<!-- @@@QShortcut -->
<!-- $$$~QShortcut[overload1]$$$~QShortcut -->
<h3 class="fn"><a name="dtor.QShortcut"></a>QShortcut::<span class="name">~QShortcut</span> ()</h3>
<p>Destroys the shortcut.</p>
<!-- @@@~QShortcut -->
<!-- $$$activated[overload1]$$$activated -->
<h3 class="fn"><a name="activated"></a><span class="type">void</span> QShortcut::<span class="name">activated</span> ()<tt> [signal]</tt></h3>
<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>
<!-- @@@activated -->
<!-- $$$activatedAmbiguously[overload1]$$$activatedAmbiguously -->
<h3 class="fn"><a name="activatedAmbiguously"></a><span class="type">void</span> QShortcut::<span class="name">activatedAmbiguously</span> ()<tt> [signal]</tt></h3>
<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&#x2e;, 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>
<!-- @@@activatedAmbiguously -->
<!-- $$$id[overload1]$$$id -->
<h3 class="fn"><a name="id"></a><span class="type">int</span> QShortcut::<span class="name">id</span> () const</h3>
<p>Returns the shortcut's ID.</p>
<p><b>See also </b><a href="qshortcutevent.html#shortcutId">QShortcutEvent::shortcutId</a>().</p>
<!-- @@@id -->
<!-- $$$parentWidget[overload1]$$$parentWidget -->
<h3 class="fn"><a name="parentWidget"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QShortcut::<span class="name">parentWidget</span> () const</h3>
<p>Returns the shortcut's parent widget.</p>
<!-- @@@parentWidget -->
</div>
</div>
</div>
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Qt and respective logos are trademarks of The Qt Company Ltd
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
<script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>