1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qevent.cpp:679 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QKeyEvent Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <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>
|
---|
33 |
|
---|
34 | <p>The QKeyEvent class contains describes a key event.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qevent-h.html">qevent.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qevent.html">QEvent</a>.
|
---|
38 | <p><a href="qkeyevent-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <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>
|
---|
42 | <li class=fn>int <a href="#key"><b>key</b></a> () const</li>
|
---|
43 | <li class=fn>int <a href="#ascii"><b>ascii</b></a> () const</li>
|
---|
44 | <li class=fn>ButtonState <a href="#state"><b>state</b></a> () const</li>
|
---|
45 | <li class=fn>ButtonState <a href="#stateAfter"><b>stateAfter</b></a> () const</li>
|
---|
46 | <li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
|
---|
47 | <li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
---|
48 | <li class=fn>bool <a href="#isAutoRepeat"><b>isAutoRepeat</b></a> () const</li>
|
---|
49 | <li class=fn>int <a href="#count"><b>count</b></a> () const</li>
|
---|
50 | <li class=fn>void <a href="#accept"><b>accept</b></a> ()</li>
|
---|
51 | <li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
|
---|
52 | </ul>
|
---|
53 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
54 |
|
---|
55 |
|
---|
56 | The QKeyEvent class contains describes a key event.
|
---|
57 | <p>
|
---|
58 | <p> Key events occur when a key is pressed or released when a widget
|
---|
59 | has keyboard input focus.
|
---|
60 | <p> A key event contains a special accept flag that indicates whether the
|
---|
61 | receiver wants the key event. You should call <a href="#ignore">QKeyEvent::ignore</a>() if the
|
---|
62 | key press or release event is not handled by your widget. A key event is
|
---|
63 | propagated up the parent widget chain until a widget accepts it with
|
---|
64 | <a href="#accept">QKeyEvent::accept</a>() or an event filter consumes it.
|
---|
65 | Key events for multi media keys are ignored by default. You should call
|
---|
66 | QKeyEvent::accept() if your widget handles those events.
|
---|
67 | <p> The QWidget::setEnable() function can be used to enable or disable
|
---|
68 | mouse and keyboard events for a widget.
|
---|
69 | <p> The event handlers <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>() and
|
---|
70 | <a href="qwidget.html#keyReleaseEvent">QWidget::keyReleaseEvent</a>() receive key events.
|
---|
71 | <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>.
|
---|
72 |
|
---|
73 | <hr><h2>Member Function Documentation</h2>
|
---|
74 | <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 )
|
---|
75 | </h3>
|
---|
76 |
|
---|
77 | <p> Constructs a key event object.
|
---|
78 | <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
|
---|
79 | known key (e.g. it may be the result of a compose sequence or
|
---|
80 | keyboard macro). <em>ascii</em> is the ASCII code of the key that was
|
---|
81 | 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
|
---|
82 | TRUE, <a href="#isAutoRepeat">isAutoRepeat</a>() will be TRUE. <em>count</em> is the number of
|
---|
83 | single keys.
|
---|
84 | <p> The accept flag is set to TRUE.
|
---|
85 |
|
---|
86 | <h3 class=fn>void <a name="accept"></a>QKeyEvent::accept ()
|
---|
87 | </h3>
|
---|
88 |
|
---|
89 | <p> Sets the accept flag of the key event object.
|
---|
90 | <p> Setting the accept parameter indicates that the receiver of the
|
---|
91 | event wants the key event. Unwanted key events are sent to the
|
---|
92 | parent widget.
|
---|
93 | <p> The accept flag is set by default.
|
---|
94 | <p> <p>See also <a href="#ignore">ignore</a>().
|
---|
95 |
|
---|
96 | <h3 class=fn>int <a name="ascii"></a>QKeyEvent::ascii () const
|
---|
97 | </h3>
|
---|
98 |
|
---|
99 | <p> Returns the ASCII code of the key that was pressed or released. We
|
---|
100 | recommend using <a href="#text">text</a>() instead.
|
---|
101 | <p> <p>See also <a href="#text">text</a>().
|
---|
102 |
|
---|
103 | <p>Example: <a href="picture-example.html#x109">picture/picture.cpp</a>.
|
---|
104 | <h3 class=fn>int <a name="count"></a>QKeyEvent::count () const
|
---|
105 | </h3>
|
---|
106 |
|
---|
107 | <p> Returns the number of single keys for this event. If <a href="#text">text</a>() is not
|
---|
108 | empty, this is simply the length of the string.
|
---|
109 | <p> <p>See also <a href="qwidget.html#setKeyCompression">QWidget::setKeyCompression</a>().
|
---|
110 |
|
---|
111 | <h3 class=fn>void <a name="ignore"></a>QKeyEvent::ignore ()
|
---|
112 | </h3>
|
---|
113 |
|
---|
114 | <p> Clears the accept flag parameter of the key event object.
|
---|
115 | <p> Clearing the accept parameter indicates that the event receiver
|
---|
116 | does not want the key event. Unwanted key events are sent to the
|
---|
117 | parent widget.
|
---|
118 | <p> The accept flag is set by default.
|
---|
119 | <p> <p>See also <a href="#accept">accept</a>().
|
---|
120 |
|
---|
121 | <h3 class=fn>bool <a name="isAccepted"></a>QKeyEvent::isAccepted () const
|
---|
122 | </h3>
|
---|
123 |
|
---|
124 | <p> Returns TRUE if the receiver of the event wants to keep the key;
|
---|
125 | otherwise returns FALSE
|
---|
126 |
|
---|
127 | <h3 class=fn>bool <a name="isAutoRepeat"></a>QKeyEvent::isAutoRepeat () const
|
---|
128 | </h3>
|
---|
129 |
|
---|
130 | <p> Returns TRUE if this event comes from an auto-repeating key and
|
---|
131 | FALSE if it comes from an initial key press.
|
---|
132 | <p> Note that if the event is a multiple-key compressed event that is
|
---|
133 | partly due to auto-repeat, this function could return either TRUE
|
---|
134 | or FALSE indeterminately.
|
---|
135 |
|
---|
136 | <h3 class=fn>int <a name="key"></a>QKeyEvent::key () const
|
---|
137 | </h3>
|
---|
138 |
|
---|
139 | <p> Returns the code of the key that was pressed or released.
|
---|
140 | <p> See <a href="qt.html#Key-enum">Qt::Key</a> for the list of keyboard codes. These codes are
|
---|
141 | independent of the underlying window system.
|
---|
142 | <p> A value of either 0 or Key_unknown means that the event is not
|
---|
143 | the result of a known key (e.g. it may be the result of a compose
|
---|
144 | sequence or a keyboard macro, or due to key event compression).
|
---|
145 | <p> <p>See also <a href="qwidget.html#setKeyCompression">QWidget::setKeyCompression</a>().
|
---|
146 |
|
---|
147 | <p>Example: <a href="fileiconview-example.html#x853">fileiconview/qfileiconview.cpp</a>.
|
---|
148 | <h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="state"></a>QKeyEvent::state () const
|
---|
149 | </h3>
|
---|
150 |
|
---|
151 | <p> Returns the keyboard modifier flags that existed immediately
|
---|
152 | before the event occurred.
|
---|
153 | <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>
|
---|
154 | and <a href="qt.html#ButtonState-enum">MetaButton</a> OR'ed together.
|
---|
155 | <p> <p>See also <a href="#stateAfter">stateAfter</a>().
|
---|
156 |
|
---|
157 | <p>Example: <a href="fileiconview-example.html#x854">fileiconview/qfileiconview.cpp</a>.
|
---|
158 | <h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="stateAfter"></a>QKeyEvent::stateAfter () const
|
---|
159 | </h3>
|
---|
160 |
|
---|
161 | <p> Returns the keyboard modifier flags that existed immediately after
|
---|
162 | the event occurred.
|
---|
163 | <p> <b>Warning:</b> This function cannot be trusted.
|
---|
164 | <p> <p>See also <a href="#state">state</a>().
|
---|
165 |
|
---|
166 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QKeyEvent::text () const
|
---|
167 | </h3>
|
---|
168 |
|
---|
169 | <p> Returns the Unicode text that this key generated. The text returned
|
---|
170 | migth be empty, which is the case when pressing or
|
---|
171 | releasing modifying keys as Shift, Control, Alt and Meta. In these
|
---|
172 | cases <a href="#key">key</a>() will contain a valid value.
|
---|
173 | <p> <p>See also <a href="qwidget.html#setKeyCompression">QWidget::setKeyCompression</a>().
|
---|
174 |
|
---|
175 | <!-- eof -->
|
---|
176 | <hr><p>
|
---|
177 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
178 | Copyright © 1995-2007
|
---|
179 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
180 | <table width=100% cellspacing=0 border=0><tr>
|
---|
181 | <td>Copyright © 2007
|
---|
182 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
183 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
184 | </table></div></address></body>
|
---|
185 | </html>
|
---|