1QKeyEvent(3qt)                                                  QKeyEvent(3qt)
2
3
4

NAME

6       QKeyEvent - Describes a key event
7

SYNOPSIS

9       #include <qevent.h>
10
11       Inherits QEvent.
12
13   Public Members
14       QKeyEvent ( Type type, int key, int ascii, int state, const QString &
15           text = QString::null, bool autorep = FALSE, ushort count = 1 )
16       int key () const
17       int ascii () const
18       ButtonState state () const
19       ButtonState stateAfter () const
20       bool isAccepted () const
21       QString text () const
22       bool isAutoRepeat () const
23       int count () const
24       void accept ()
25       void ignore ()
26

DESCRIPTION

28       The QKeyEvent class contains describes a key event.
29
30       Key events occur when a key is pressed or released when a widget has
31       keyboard input focus.
32
33       A key event contains a special accept flag that indicates whether the
34       receiver wants the key event. You should call QKeyEvent::ignore() if
35       the key press or release event is not handled by your widget. A key
36       event is propagated up the parent widget chain until a widget accepts
37       it with QKeyEvent::accept() or an event filter consumes it. Key events
38       for multi media keys are ignored by default. You should call
39       QKeyEvent::accept() if your widget handles those events.
40
41       The QWidget::setEnable() function can be used to enable or disable
42       mouse and keyboard events for a widget.
43
44       The event handlers QWidget::keyPressEvent() and
45       QWidget::keyReleaseEvent() receive key events.
46
47       See also QFocusEvent, QWidget::grabKeyboard(), and Event Classes.
48

MEMBER FUNCTION DOCUMENTATION

QKeyEvent::QKeyEvent ( Type type, int key, int ascii, int state, const QString

51       & text = QString::null, bool autorep = FALSE, ushort count = 1 )
52       Constructs a key event object.
53
54       The type parameter must be QEvent::KeyPress or QEvent::KeyRelease. If
55       key is 0 the event is not a result of a known key (e.g. it may be the
56       result of a compose sequence or keyboard macro). ascii is the ASCII
57       code of the key that was pressed or released. state holds the keyboard
58       modifiers. text is the Unicode text that the key generated. If autorep
59       is TRUE, isAutoRepeat() will be TRUE. count is the number of single
60       keys.
61
62       The accept flag is set to TRUE.
63

void QKeyEvent::accept ()

65       Sets the accept flag of the key event object.
66
67       Setting the accept parameter indicates that the receiver of the event
68       wants the key event. Unwanted key events are sent to the parent widget.
69
70       The accept flag is set by default.
71
72       See also ignore().
73

int QKeyEvent::ascii () const

75       Returns the ASCII code of the key that was pressed or released. We
76       recommend using text() instead.
77
78       See also text().
79
80       Example: picture/picture.cpp.
81

int QKeyEvent::count () const

83       Returns the number of single keys for this event. If text() is not
84       empty, this is simply the length of the string.
85
86       See also QWidget::setKeyCompression().
87

void QKeyEvent::ignore ()

89       Clears the accept flag parameter of the key event object.
90
91       Clearing the accept parameter indicates that the event receiver does
92       not want the key event. Unwanted key events are sent to the parent
93       widget.
94
95       The accept flag is set by default.
96
97       See also accept().
98

bool QKeyEvent::isAccepted () const

100       Returns TRUE if the receiver of the event wants to keep the key;
101       otherwise returns FALSE
102

bool QKeyEvent::isAutoRepeat () const

104       Returns TRUE if this event comes from an auto-repeating key and FALSE
105       if it comes from an initial key press.
106
107       Note that if the event is a multiple-key compressed event that is
108       partly due to auto-repeat, this function could return either TRUE or
109       FALSE indeterminately.
110

int QKeyEvent::key () const

112       Returns the code of the key that was pressed or released.
113
114       See Qt::Key for the list of keyboard codes. These codes are independent
115       of the underlying window system.
116
117       A value of either 0 or Key_unknown means that the event is not the
118       result of a known key (e.g. it may be the result of a compose sequence
119       or a keyboard macro, or due to key event compression).
120
121       See also QWidget::setKeyCompression().
122
123       Example: fileiconview/qfileiconview.cpp.
124

ButtonState QKeyEvent::state () const

126       Returns the keyboard modifier flags that existed immediately before the
127       event occurred.
128
129       The returned value is ShiftButton, ControlButton, AltButton and
130       MetaButton OR'ed together.
131
132       See also stateAfter().
133
134       Example: fileiconview/qfileiconview.cpp.
135

ButtonState QKeyEvent::stateAfter () const

137       Returns the keyboard modifier flags that existed immediately after the
138       event occurred.
139
140       Warning: This function cannot be trusted.
141
142       See also state().
143

QString QKeyEvent::text () const

145       Returns the Unicode text that this key generated. The text returned
146       migth be empty, which is the case when pressing or releasing modifying
147       keys as Shift, Control, Alt and Meta. In these cases key() will contain
148       a valid value.
149
150       See also QWidget::setKeyCompression().
151
152

SEE ALSO

154       http://doc.trolltech.com/qkeyevent.html
155       http://www.trolltech.com/faq/tech.html
156
158       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
159       license file included in the distribution for a complete license
160       statement.
161

AUTHOR

163       Generated automatically from the source code.
164

BUGS

166       If you find a bug in Qt, please report it as described in
167       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
168       help you. Thank you.
169
170       The definitive Qt documentation is provided in HTML format; it is
171       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
172       web browser. This man page is provided as a convenience for those users
173       who prefer man pages, although this format is not officially supported
174       by Trolltech.
175
176       If you find errors in this manual page, please report them to qt-
177       bugs@trolltech.com.  Please include the name of the manual page
178       (qkeyevent.3qt) and the Qt version (3.3.8).
179
180
181
182Trolltech AS                    2 February 2007                 QKeyEvent(3qt)
Impressum