You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
8.8 KiB
186 lines
8.8 KiB
14 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qevent.cpp:679 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QKeyEvent Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QKeyEvent Class Reference</h1>
|
||
|
|
||
|
<p>The QKeyEvent class contains describes a key event.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qevent-h.html">qevent.h</a>></tt>
|
||
|
<p>Inherits <a href="qevent.html">QEvent</a>.
|
||
|
<p><a href="qkeyevent-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#QKeyEvent"><b>QKeyEvent</b></a> ( Type type, int key, int ascii, int state, const QString & text = QString::null, bool autorep = FALSE, ushort count = 1 )</li>
|
||
|
<li class=fn>int <a href="#key"><b>key</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#ascii"><b>ascii</b></a> () const</li>
|
||
|
<li class=fn>ButtonState <a href="#state"><b>state</b></a> () const</li>
|
||
|
<li class=fn>ButtonState <a href="#stateAfter"><b>stateAfter</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isAutoRepeat"><b>isAutoRepeat</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#accept"><b>accept</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The QKeyEvent class contains describes a key event.
|
||
|
<p>
|
||
|
<p> Key events occur when a key is pressed or released when a widget
|
||
|
has keyboard input focus.
|
||
|
<p> A key event contains a special accept flag that indicates whether the
|
||
|
receiver wants the key event. You should call <a href="#ignore">QKeyEvent::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="#accept">QKeyEvent::accept</a>() or an event filter consumes it.
|
||
|
Key events for multi media keys are ignored by default. You should call
|
||
|
QKeyEvent::accept() if your widget handles those events.
|
||
|
<p> The QWidget::setEnable() function can be used to enable or disable
|
||
|
mouse and keyboard events for a widget.
|
||
|
<p> The event handlers <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>() and
|
||
|
<a href="qwidget.html#keyReleaseEvent">QWidget::keyReleaseEvent</a>() receive key events.
|
||
|
<p> <p>See also <a href="qfocusevent.html">QFocusEvent</a>, <a href="qwidget.html#grabKeyboard">QWidget::grabKeyboard</a>(), and <a href="events.html">Event Classes</a>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="QKeyEvent"></a>QKeyEvent::QKeyEvent ( <a href="qevent.html#Type-enum">Type</a> type, int key, int ascii, int state, const <a href="qstring.html">QString</a> & text = QString::null, bool autorep = FALSE, ushort count = 1 )
|
||
|
</h3>
|
||
|
|
||
|
<p> Constructs a key event object.
|
||
|
<p> The <em>type</em> parameter must be <a href="qevent.html#Type-enum">QEvent::KeyPress</a> or <a href="qevent.html#Type-enum">QEvent::KeyRelease</a>. If <em>key</em> is 0 the event is not a result of a
|
||
|
known key (e.g. it may be the result of a compose sequence or
|
||
|
keyboard macro). <em>ascii</em> is the ASCII code of the key that was
|
||
|
pressed or released. <em>state</em> holds the keyboard modifiers. <em>text</em> is the Unicode text that the key generated. If <em>autorep</em> is
|
||
|
TRUE, <a href="#isAutoRepeat">isAutoRepeat</a>() will be TRUE. <em>count</em> is the number of
|
||
|
single keys.
|
||
|
<p> The accept flag is set to TRUE.
|
||
|
|
||
|
<h3 class=fn>void <a name="accept"></a>QKeyEvent::accept ()
|
||
|
</h3>
|
||
|
|
||
|
<p> Sets the accept flag of the key event object.
|
||
|
<p> Setting the accept parameter indicates that the receiver of the
|
||
|
event wants the key event. Unwanted key events are sent to the
|
||
|
parent widget.
|
||
|
<p> The accept flag is set by default.
|
||
|
<p> <p>See also <a href="#ignore">ignore</a>().
|
||
|
|
||
|
<h3 class=fn>int <a name="ascii"></a>QKeyEvent::ascii () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the ASCII code of the key that was pressed or released. We
|
||
|
recommend using <a href="#text">text</a>() instead.
|
||
|
<p> <p>See also <a href="#text">text</a>().
|
||
|
|
||
|
<p>Example: <a href="picture-example.html#x109">picture/picture.cpp</a>.
|
||
|
<h3 class=fn>int <a name="count"></a>QKeyEvent::count () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the number of single keys for this event. If <a href="#text">text</a>() is not
|
||
|
empty, this is simply the length of the string.
|
||
|
<p> <p>See also <a href="qwidget.html#setKeyCompression">QWidget::setKeyCompression</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="ignore"></a>QKeyEvent::ignore ()
|
||
|
</h3>
|
||
|
|
||
|
<p> Clears the accept flag parameter of the key event object.
|
||
|
<p> Clearing the accept parameter indicates that the event receiver
|
||
|
does not want the key event. Unwanted key events are sent to the
|
||
|
parent widget.
|
||
|
<p> The accept flag is set by default.
|
||
|
<p> <p>See also <a href="#accept">accept</a>().
|
||
|
|
||
|
<h3 class=fn>bool <a name="isAccepted"></a>QKeyEvent::isAccepted () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns TRUE if the receiver of the event wants to keep the key;
|
||
|
otherwise returns FALSE
|
||
|
|
||
|
<h3 class=fn>bool <a name="isAutoRepeat"></a>QKeyEvent::isAutoRepeat () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns TRUE if this event comes from an auto-repeating key and
|
||
|
FALSE if it comes from an initial key press.
|
||
|
<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.
|
||
|
|
||
|
<h3 class=fn>int <a name="key"></a>QKeyEvent::key () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the code of the key that was pressed or released.
|
||
|
<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.
|
||
|
<p> A value of either 0 or Key_unknown means that the event is not
|
||
|
the result of a known key (e.g. it may be the result of a compose
|
||
|
sequence or a keyboard macro, or due to key event compression).
|
||
|
<p> <p>See also <a href="qwidget.html#setKeyCompression">QWidget::setKeyCompression</a>().
|
||
|
|
||
|
<p>Example: <a href="fileiconview-example.html#x853">fileiconview/qfileiconview.cpp</a>.
|
||
|
<h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="state"></a>QKeyEvent::state () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the keyboard modifier flags that existed immediately
|
||
|
before the event occurred.
|
||
|
<p> The returned value is <a href="qt.html#ButtonState-enum">ShiftButton</a>, <a href="qt.html#ButtonState-enum">ControlButton</a>, <a href="qt.html#ButtonState-enum">AltButton</a>
|
||
|
and <a href="qt.html#ButtonState-enum">MetaButton</a> OR'ed together.
|
||
|
<p> <p>See also <a href="#stateAfter">stateAfter</a>().
|
||
|
|
||
|
<p>Example: <a href="fileiconview-example.html#x854">fileiconview/qfileiconview.cpp</a>.
|
||
|
<h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="stateAfter"></a>QKeyEvent::stateAfter () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the keyboard modifier flags that existed immediately after
|
||
|
the event occurred.
|
||
|
<p> <b>Warning:</b> This function cannot be trusted.
|
||
|
<p> <p>See also <a href="#state">state</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QKeyEvent::text () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the Unicode text that this key generated. The text returned
|
||
|
migth be empty, which is the case when pressing or
|
||
|
releasing modifying keys as Shift, Control, Alt and Meta. In these
|
||
|
cases <a href="#key">key</a>() will contain a valid value.
|
||
|
<p> <p>See also <a href="qwidget.html#setKeyCompression">QWidget::setKeyCompression</a>().
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">Qt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|