Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 5614

qt-doc-4.8.5-10.fc18.noarch.rpm

<?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" />
<!-- qevent.cpp -->
  <title>Qt 4.8: QKeyEvent 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>QKeyEvent</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="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QKeyEvent Class Reference</h1>
<!-- $$$QKeyEvent-brief -->
<p>The QKeyEvent class describes a key event. <a href="#details">More...</a></p>
<!-- @@@QKeyEvent -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QKeyEvent&gt;</span></pre><p><b>Inherits: </b><a href="qinputevent.html">QInputEvent</a>.</p>
<ul>
<li><a href="qkeyevent-members.html">List of all members, including inherited members</a></li>
<li><a href="qkeyevent-qt3.html">Qt 3 support members</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="qkeyevent.html#QKeyEvent">QKeyEvent</a></b> ( Type <i>type</i>, int <i>key</i>, Qt::KeyboardModifiers <i>modifiers</i>, const QString &amp; <i>text</i> = QString(), bool <i>autorep</i> = false, ushort <i>count</i> = 1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#count">count</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#isAutoRepeat">isAutoRepeat</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#key">key</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#matches">matches</a></b> ( QKeySequence::StandardKey <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::KeyboardModifiers </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#modifiers">modifiers</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint32 </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#nativeModifiers">nativeModifiers</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint32 </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#nativeScanCode">nativeScanCode</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint32 </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#nativeVirtualKey">nativeVirtualKey</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#text">text</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">1 public function inherited from <a href="qinputevent.html#public-functions">QInputEvent</a></li>
<li class="fn">6 public functions inherited from <a href="qevent.html#public-functions">QEvent</a></li>
</ul>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#operator-eq-eq-87">operator==</a></b> ( QKeyEvent * <i>e</i>, QKeySequence::StandardKey <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qkeyevent.html#operator-eq-eq-88">operator==</a></b> ( QKeySequence::StandardKey <i>key</i>, QKeyEvent * <i>e</i> )</td></tr>
</table>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qevent.html#properties">QEvent</a></li>
<li class="fn">1 static public member inherited from <a href="qevent.html#static-public-members">QEvent</a></li>
</ul>
<a name="details"></a>
<!-- $$$QKeyEvent-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QKeyEvent class describes a key event.</p>
<p>Key events are sent to the widget with keyboard input focus when keys are pressed or released.</p>
<p>A key event contains a special accept flag that indicates whether the receiver will handle the key event. You should call <a href="qevent.html#ignore">ignore</a>() if the key press or release event is not handled by your widget. A key event is propagated up the parent widget chain until a widget accepts it with <a href="qevent.html#accept">accept</a>() or an event filter consumes it. Key events for multimedia keys are ignored by default. You should call <a href="qevent.html#accept">accept</a>() if your widget handles those events.</p>
<p>The QWidget::setEnable() function can be used to enable or disable mouse and keyboard events for a widget.</p>
<p>The event handlers <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>(), <a href="qwidget.html#keyReleaseEvent">QWidget::keyReleaseEvent</a>(), <a href="qgraphicsitem.html#keyPressEvent">QGraphicsItem::keyPressEvent</a>() and <a href="qgraphicsitem.html#keyReleaseEvent">QGraphicsItem::keyReleaseEvent</a>() receive key events.</p>
</div>
<p><b>See also </b><a href="qfocusevent.html">QFocusEvent</a> and <a href="qwidget.html#grabKeyboard">QWidget::grabKeyboard</a>().</p>
<!-- @@@QKeyEvent -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QKeyEvent[overload1]$$$QKeyEventTypeintQt::KeyboardModifiersconstQString&boolushort -->
<h3 class="fn"><a name="QKeyEvent"></a>QKeyEvent::<span class="name">QKeyEvent</span> ( <span class="type"><a href="qevent.html#Type-enum">Type</a></span> <i>type</i>, <span class="type">int</span> <i>key</i>, <span class="type"><a href="qt.html#KeyboardModifier-enum">Qt::KeyboardModifiers</a></span> <i>modifiers</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i> = QString(), <span class="type">bool</span> <i>autorep</i> = false, <span class="type"><a href="qtglobal.html#ushort-typedef">ushort</a></span> <i>count</i> = 1 )</h3>
<p>Constructs a key event object.</p>
<p>The <i>type</i> parameter must be <a href="qevent.html#Type-enum">QEvent::KeyPress</a>, <a href="qevent.html#Type-enum">QEvent::KeyRelease</a>, or <a href="qevent.html#Type-enum">QEvent::ShortcutOverride</a>.</p>
<p>Int <i>key</i> is the code for the <a href="qt.html#Key-enum">Qt::Key</a> that the event loop should listen for. If <i>key</i> is 0, the event is not a result of a known key; for example, it may be the result of a compose sequence or keyboard macro. The <i>modifiers</i> holds the keyboard modifiers, and the given <i>text</i> is the Unicode text that the key generated. If <i>autorep</i> is true, <a href="qkeyevent.html#isAutoRepeat">isAutoRepeat</a>() will be true. <i>count</i> is the number of keys involved in the event.</p>
<!-- @@@QKeyEvent -->
<!-- $$$count[overload1]$$$count -->
<h3 class="fn"><a name="count"></a><span class="type">int</span> QKeyEvent::<span class="name">count</span> () const</h3>
<p>Returns the number of keys involved in this event. If <a href="qkeyevent.html#text">text</a>() is not empty, this is simply the length of the string.</p>
<p><b>See also </b><a href="qt.html#WidgetAttribute-enum">Qt::WA_KeyCompression</a>.</p>
<!-- @@@count -->
<!-- $$$isAutoRepeat[overload1]$$$isAutoRepeat -->
<h3 class="fn"><a name="isAutoRepeat"></a><span class="type">bool</span> QKeyEvent::<span class="name">isAutoRepeat</span> () const</h3>
<p>Returns true if this event comes from an auto-repeating key; returns false if it comes from an initial key press.</p>
<p>Note that if the event is a multiple-key compressed event that is partly due to auto-repeat, this function could return either true or false indeterminately.</p>
<!-- @@@isAutoRepeat -->
<!-- $$$key[overload1]$$$key -->
<h3 class="fn"><a name="key"></a><span class="type">int</span> QKeyEvent::<span class="name">key</span> () const</h3>
<p>Returns the code of the key that was pressed or released.</p>
<p>See <a href="qt.html#Key-enum">Qt::Key</a> for the list of keyboard codes. These codes are independent of the underlying window system. Note that this function does not distinguish between capital and non-capital letters, use the <a href="qkeyevent.html#text">text</a>() function (returning the Unicode text the key generated) for this purpose.</p>
<p>A value of either 0 or <a href="qt.html#Key-enum">Qt::Key_unknown</a> means that the event is not the result of a known key; for example, it may be the result of a compose sequence, a keyboard macro, or due to key event compression.</p>
<p><b>See also </b><a href="qt.html#WidgetAttribute-enum">Qt::WA_KeyCompression</a>.</p>
<!-- @@@key -->
<!-- $$$matches[overload1]$$$matchesQKeySequence::StandardKey -->
<h3 class="fn"><a name="matches"></a><span class="type">bool</span> QKeyEvent::<span class="name">matches</span> ( <span class="type"><a href="qkeysequence.html#StandardKey-enum">QKeySequence::StandardKey</a></span> <i>key</i> ) const</h3>
<p>Returns true if the key event matches the given standard <i>key</i>; otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@matches -->
<!-- $$$modifiers[overload1]$$$modifiers -->
<h3 class="fn"><a name="modifiers"></a><span class="type"><a href="qt.html#KeyboardModifier-enum">Qt::KeyboardModifiers</a></span> QKeyEvent::<span class="name">modifiers</span> () const</h3>
<p>Returns the keyboard modifier flags that existed immediately after the event occurred.</p>
<p><b>Warning:</b> This function cannot always be trusted. The user can confuse it by pressing both <b>Shift</b> keys simultaneously and releasing one of them, for example.</p>
<p><b>See also </b><a href="qapplication.html#keyboardModifiers">QApplication::keyboardModifiers</a>().</p>
<!-- @@@modifiers -->
<!-- $$$nativeModifiers[overload1]$$$nativeModifiers -->
<h3 class="fn"><a name="nativeModifiers"></a><span class="type"><a href="qtglobal.html#quint32-typedef">quint32</a></span> QKeyEvent::<span class="name">nativeModifiers</span> () const</h3>
<p>Returns the native modifiers of a key event. If the key event does not contain this data 0 is returned.</p>
<p>Note: The native modifiers may be 0, even if the key event contains extended information.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@nativeModifiers -->
<!-- $$$nativeScanCode[overload1]$$$nativeScanCode -->
<h3 class="fn"><a name="nativeScanCode"></a><span class="type"><a href="qtglobal.html#quint32-typedef">quint32</a></span> QKeyEvent::<span class="name">nativeScanCode</span> () const</h3>
<p>Returns the native scan code of the key event. If the key event does not contain this data 0 is returned.</p>
<p>Note: The native scan code may be 0, even if the key event contains extended information.</p>
<p>Note: On Mac OS/X, this function is not useful, because there is no way to get the scan code from Carbon or Cocoa. The function always returns 1 (or 0 in the case explained above).</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@nativeScanCode -->
<!-- $$$nativeVirtualKey[overload1]$$$nativeVirtualKey -->
<h3 class="fn"><a name="nativeVirtualKey"></a><span class="type"><a href="qtglobal.html#quint32-typedef">quint32</a></span> QKeyEvent::<span class="name">nativeVirtualKey</span> () const</h3>
<p>Returns the native virtual key, or key sym of the key event. If the key event does not contain this data 0 is returned.</p>
<p>Note: The native virtual key may be 0, even if the key event contains extended information.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@nativeVirtualKey -->
<!-- $$$text[overload1]$$$text -->
<h3 class="fn"><a name="text"></a><span class="type"><a href="qstring.html">QString</a></span> QKeyEvent::<span class="name">text</span> () const</h3>
<p>Returns the Unicode text that this key generated. The text returned can be an empty string in cases where modifier keys, such as Shift, Control, Alt, and Meta, are being pressed or released. In such cases <a href="qkeyevent.html#key">key</a>() will contain a valid value.</p>
<p><b>See also </b><a href="qt.html#WidgetAttribute-enum">Qt::WA_KeyCompression</a>.</p>
<!-- @@@text -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator==$$$operator==QKeyEvent*QKeySequence::StandardKey -->
<h3 class="fn"><a name="operator-eq-eq-87"></a><span class="type">bool</span> <span class="name">operator==</span> ( <span class="type">QKeyEvent</span> * <i>e</i>, <span class="type"><a href="qkeysequence.html#StandardKey-enum">QKeySequence::StandardKey</a></span> <i>key</i> )</h3>
<p>Returns true if <i>key</i> is currently bound to the key combination specified by <i>e</i>.</p>
<p>Equivalent to <tt>e-&gt;matches(key)</tt>.</p>
<!-- @@@operator== -->
<!-- $$$operator==$$$operator==QKeySequence::StandardKeyQKeyEvent* -->
<h3 class="fn"><a name="operator-eq-eq-88"></a><span class="type">bool</span> <span class="name">operator==</span> ( <span class="type"><a href="qkeysequence.html#StandardKey-enum">QKeySequence::StandardKey</a></span> <i>key</i>, <span class="type">QKeyEvent</span> * <i>e</i> )</h3>
<p>Returns true if <i>key</i> is currently bound to the key combination specified by <i>e</i>.</p>
<p>Equivalent to <tt>e-&gt;matches(key)</tt>.</p>
<!-- @@@operator== -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. 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>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      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>