| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: qevent.cpp 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Implementation of event classes
|
|---|
| 5 | **
|
|---|
| 6 | ** Created : 931029
|
|---|
| 7 | **
|
|---|
| 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
|
|---|
| 9 | **
|
|---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
|---|
| 11 | **
|
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License
|
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file.
|
|---|
| 15 | **
|
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 19 | ** packaging of this file.
|
|---|
| 20 | **
|
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License
|
|---|
| 23 | ** Agreement provided with the Software.
|
|---|
| 24 | **
|
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 27 | **
|
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 29 | ** information about Qt Commercial License Agreements.
|
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 32 | **
|
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 34 | ** not clear to you.
|
|---|
| 35 | **
|
|---|
| 36 | **********************************************************************/
|
|---|
| 37 |
|
|---|
| 38 | #include "qevent.h"
|
|---|
| 39 | #include "qcursor.h"
|
|---|
| 40 | #include "qapplication.h"
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | /*!
|
|---|
| 44 | \class QEvent qevent.h
|
|---|
| 45 | \brief The QEvent class is the base class of all
|
|---|
| 46 | event classes. Event objects contain event parameters.
|
|---|
| 47 |
|
|---|
| 48 | \ingroup events
|
|---|
| 49 | \ingroup environment
|
|---|
| 50 |
|
|---|
| 51 | Qt's main event loop (QApplication::exec()) fetches native window
|
|---|
| 52 | system events from the event queue, translates them into QEvents
|
|---|
| 53 | and sends the translated events to QObjects.
|
|---|
| 54 |
|
|---|
| 55 | In general, events come from the underlying window system
|
|---|
| 56 | (spontaneous() returns TRUE) but it is also possible to manually
|
|---|
| 57 | send events using QApplication::sendEvent() and
|
|---|
| 58 | QApplication::postEvent() (spontaneous() returns FALSE).
|
|---|
| 59 |
|
|---|
| 60 | QObjects receive events by having their QObject::event() function
|
|---|
| 61 | called. The function can be reimplemented in subclasses to
|
|---|
| 62 | customize event handling and add additional event types;
|
|---|
| 63 | QWidget::event() is a notable example. By default, events are
|
|---|
| 64 | dispatched to event handlers like QObject::timerEvent() and
|
|---|
| 65 | QWidget::mouseMoveEvent(). QObject::installEventFilter() allows an
|
|---|
| 66 | object to intercept events destined for another object.
|
|---|
| 67 |
|
|---|
| 68 | The basic QEvent contains only an event type parameter.
|
|---|
| 69 | Subclasses of QEvent contain additional parameters that describe
|
|---|
| 70 | the particular event.
|
|---|
| 71 |
|
|---|
| 72 | \sa QObject::event() QObject::installEventFilter()
|
|---|
| 73 | QWidget::event() QApplication::sendEvent()
|
|---|
| 74 | QApplication::postEvent() QApplication::processEvents()
|
|---|
| 75 | */
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | /*!
|
|---|
| 79 | \enum Qt::ButtonState
|
|---|
| 80 |
|
|---|
| 81 | This enum type describes the state of the mouse and the modifier
|
|---|
| 82 | buttons.
|
|---|
| 83 |
|
|---|
| 84 | \value NoButton used when the button state does not refer to any
|
|---|
| 85 | button (see QMouseEvent::button()).
|
|---|
| 86 | \value LeftButton set if the left button is pressed, or if this
|
|---|
| 87 | event refers to the left button. (The left button may be
|
|---|
| 88 | the right button on left-handed mice.)
|
|---|
| 89 | \value RightButton the right button.
|
|---|
| 90 | \value MidButton the middle button.
|
|---|
| 91 | \value ShiftButton a Shift key on the keyboard is also pressed.
|
|---|
| 92 | \value ControlButton a Ctrl key on the keyboard is also pressed.
|
|---|
| 93 | \value AltButton an Alt key on the keyboard is also pressed.
|
|---|
| 94 | \value MetaButton a Meta key on the keyboard is also pressed.
|
|---|
| 95 | \value Keypad a keypad button is pressed.
|
|---|
| 96 | \value KeyButtonMask a mask for ShiftButton, ControlButton,
|
|---|
| 97 | AltButton and MetaButton.
|
|---|
| 98 | \value MouseButtonMask a mask for LeftButton, RightButton and MidButton.
|
|---|
| 99 | */
|
|---|
| 100 |
|
|---|
| 101 | /*!
|
|---|
| 102 | \enum QEvent::Type
|
|---|
| 103 |
|
|---|
| 104 | This enum type defines the valid event types in Qt. The event
|
|---|
| 105 | types and the specialized classes for each type are these:
|
|---|
| 106 |
|
|---|
| 107 | \value None Not an event.
|
|---|
| 108 | \value Accessibility Accessibility information is requested
|
|---|
| 109 | \value Timer Regular timer events, \l{QTimerEvent}.
|
|---|
| 110 | \value MouseButtonPress Mouse press, \l{QMouseEvent}.
|
|---|
| 111 | \value MouseButtonRelease Mouse release, \l{QMouseEvent}.
|
|---|
| 112 | \value MouseButtonDblClick Mouse press again, \l{QMouseEvent}.
|
|---|
| 113 | \value MouseMove Mouse move, \l{QMouseEvent}.
|
|---|
| 114 | \value KeyPress Key press (including Shift, for example), \l{QKeyEvent}.
|
|---|
| 115 | \value KeyRelease Key release, \l{QKeyEvent}.
|
|---|
| 116 | \value IMStart The start of input method composition.
|
|---|
| 117 | \value IMCompose Input method composition is taking place.
|
|---|
| 118 | \value IMEnd The end of input method composition.
|
|---|
| 119 | \value FocusIn Widget gains keyboard focus, \l{QFocusEvent}.
|
|---|
| 120 | \value FocusOut Widget loses keyboard focus, \l{QFocusEvent}.
|
|---|
| 121 | \value Enter Mouse enters widget's boundaries.
|
|---|
| 122 | \value Leave Mouse leaves widget's boundaries.
|
|---|
| 123 | \value Paint Screen update necessary, \l{QPaintEvent}.
|
|---|
| 124 | \value Move Widget's position changed, \l{QMoveEvent}.
|
|---|
| 125 | \value Resize Widget's size changed, \l{QResizeEvent}.
|
|---|
| 126 | \value Show Widget was shown on screen, \l{QShowEvent}.
|
|---|
| 127 | \value Hide Widget was hidden, \l{QHideEvent}.
|
|---|
| 128 | \value ShowToParent A child widget has been shown.
|
|---|
| 129 | \value HideToParent A child widget has been hidden.
|
|---|
| 130 | \value Close Widget was closed (permanently), \l{QCloseEvent}.
|
|---|
| 131 | \value ShowNormal Widget should be shown normally (obsolete).
|
|---|
| 132 | \value ShowMaximized Widget should be shown maximized (obsolete).
|
|---|
| 133 | \value ShowMinimized Widget should be shown minimized (obsolete).
|
|---|
| 134 | \value ShowFullScreen Widget should be shown full-screen (obsolete).
|
|---|
| 135 | \value ShowWindowRequest Widget's window should be shown (obsolete).
|
|---|
| 136 | \value DeferredDelete The object will be deleted after it has
|
|---|
| 137 | cleaned up.
|
|---|
| 138 | \value Accel Key press in child for shortcut key handling, \l{QKeyEvent}.
|
|---|
| 139 | \value Wheel Mouse wheel rolled, \l{QWheelEvent}.
|
|---|
| 140 | \value ContextMenu Context popup menu, \l{QContextMenuEvent}
|
|---|
| 141 | \value AccelOverride Key press in child, for overriding shortcut key handling, \l{QKeyEvent}.
|
|---|
| 142 | \value AccelAvailable internal.
|
|---|
| 143 | \value WindowActivate Window was activated.
|
|---|
| 144 | \value WindowDeactivate Window was deactivated.
|
|---|
| 145 | \value CaptionChange Widget's caption changed.
|
|---|
| 146 | \value IconChange Widget's icon changed.
|
|---|
| 147 | \value ParentFontChange Font of the parent widget changed.
|
|---|
| 148 | \value ApplicationFontChange Default application font changed.
|
|---|
| 149 | \value PaletteChange Palette of the widget changed.
|
|---|
| 150 | \value ParentPaletteChange Palette of the parent widget changed.
|
|---|
| 151 | \value ApplicationPaletteChange Default application palette changed.
|
|---|
| 152 | \value Clipboard Clipboard contents have changed.
|
|---|
| 153 | \value SockAct Socket activated, used to implement \l{QSocketNotifier}.
|
|---|
| 154 | \value DragEnter A drag-and-drop enters widget, \l{QDragEnterEvent}.
|
|---|
| 155 | \value DragMove A drag-and-drop is in progress, \l{QDragMoveEvent}.
|
|---|
| 156 | \value DragLeave A drag-and-drop leaves widget, \l{QDragLeaveEvent}.
|
|---|
| 157 | \value Drop A drag-and-drop is completed, \l{QDropEvent}.
|
|---|
| 158 | \value DragResponse Internal event used by Qt on some platforms.
|
|---|
| 159 | \value ChildInserted Object gets a child, \l{QChildEvent}.
|
|---|
| 160 | \value ChildRemoved Object loses a child, \l{QChildEvent}.
|
|---|
| 161 | \value LayoutHint Widget child has changed layout properties.
|
|---|
| 162 | \value ActivateControl Internal event used by Qt on some platforms.
|
|---|
| 163 | \value DeactivateControl Internal event used by Qt on some platforms.
|
|---|
| 164 | \value LanguageChange The application translation changed, \l{QTranslator}
|
|---|
| 165 | \value LayoutDirectionChange The direction of layouts changed
|
|---|
| 166 | \value LocaleChange The system locale changed
|
|---|
| 167 | \value Quit Reserved.
|
|---|
| 168 | \value Create Reserved.
|
|---|
| 169 | \value Destroy Reserved.
|
|---|
| 170 | \value Reparent Reserved.
|
|---|
| 171 | \value Speech Reserved for speech input.
|
|---|
| 172 | \value TabletMove A Wacom Tablet Move Event.
|
|---|
| 173 | \value Style Internal use only
|
|---|
| 174 | \value TabletPress A Wacom Tablet Press Event
|
|---|
| 175 | \value TabletRelease A Wacom Tablet Release Event
|
|---|
| 176 | \value OkRequest Internal event used by Qt on some platforms.
|
|---|
| 177 | \value HelpRequest Internal event used by Qt on some platforms.
|
|---|
| 178 | \value IconDrag Internal event used by Qt on some platforms when proxy icon is dragged.
|
|---|
| 179 | \value WindowStateChange The window's state, i.e. minimized,
|
|---|
| 180 | maximized or full-screen, has changed. See \l{QWidget::windowState()}.
|
|---|
| 181 | \value WindowBlocked The window is modally blocked
|
|---|
| 182 | \value WindowUnblocked The window leaves modal blocking
|
|---|
| 183 |
|
|---|
| 184 | \value User User defined event.
|
|---|
| 185 | \value MaxUser Last user event id.
|
|---|
| 186 |
|
|---|
| 187 | User events should have values between User and MaxUser inclusive.
|
|---|
| 188 | */
|
|---|
| 189 | /*!
|
|---|
| 190 | \fn QEvent::QEvent( Type type )
|
|---|
| 191 |
|
|---|
| 192 | Contructs an event object of type \a type.
|
|---|
| 193 | */
|
|---|
| 194 |
|
|---|
| 195 | /*!
|
|---|
| 196 | \fn QEvent::Type QEvent::type() const
|
|---|
| 197 |
|
|---|
| 198 | Returns the event type.
|
|---|
| 199 | */
|
|---|
| 200 |
|
|---|
| 201 | /*!
|
|---|
| 202 | \fn bool QEvent::spontaneous() const
|
|---|
| 203 |
|
|---|
| 204 | Returns TRUE if the event originated outside the application, i.e.
|
|---|
| 205 | it is a system event; otherwise returns FALSE.
|
|---|
| 206 | */
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 | /*!
|
|---|
| 210 | \class QTimerEvent qevent.h
|
|---|
| 211 | \brief The QTimerEvent class contains parameters that describe a
|
|---|
| 212 | timer event.
|
|---|
| 213 |
|
|---|
| 214 | \ingroup events
|
|---|
| 215 |
|
|---|
| 216 | Timer events are sent at regular intervals to objects that have
|
|---|
| 217 | started one or more timers. Each timer has a unique identifier. A
|
|---|
| 218 | timer is started with QObject::startTimer().
|
|---|
| 219 |
|
|---|
| 220 | The QTimer class provides a high-level programming interface that
|
|---|
| 221 | uses signals instead of events. It also provides one-shot timers.
|
|---|
| 222 |
|
|---|
| 223 | The event handler QObject::timerEvent() receives timer events.
|
|---|
| 224 |
|
|---|
| 225 | \sa QTimer, QObject::timerEvent(), QObject::startTimer(),
|
|---|
| 226 | QObject::killTimer(), QObject::killTimers()
|
|---|
| 227 | */
|
|---|
| 228 |
|
|---|
| 229 | /*!
|
|---|
| 230 | \fn QTimerEvent::QTimerEvent( int timerId )
|
|---|
| 231 |
|
|---|
| 232 | Constructs a timer event object with the timer identifier set to
|
|---|
| 233 | \a timerId.
|
|---|
| 234 | */
|
|---|
| 235 |
|
|---|
| 236 | /*!
|
|---|
| 237 | \fn int QTimerEvent::timerId() const
|
|---|
| 238 |
|
|---|
| 239 | Returns the unique timer identifier, which is the same identifier
|
|---|
| 240 | as returned from QObject::startTimer().
|
|---|
| 241 | */
|
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 | /*!
|
|---|
| 245 | \class QMouseEvent qevent.h
|
|---|
| 246 | \ingroup events
|
|---|
| 247 |
|
|---|
| 248 | \brief The QMouseEvent class contains parameters that describe a mouse event.
|
|---|
| 249 |
|
|---|
| 250 | Mouse events occur when a mouse button is pressed or released
|
|---|
| 251 | inside a widget or when the mouse cursor is moved.
|
|---|
| 252 |
|
|---|
| 253 | Mouse move events will occur only when a mouse button is pressed
|
|---|
| 254 | down, unless mouse tracking has been enabled with
|
|---|
| 255 | QWidget::setMouseTracking().
|
|---|
| 256 |
|
|---|
| 257 | Qt automatically grabs the mouse when a mouse button is pressed
|
|---|
| 258 | inside a widget; the widget will continue to receive mouse events
|
|---|
| 259 | until the last mouse button is released.
|
|---|
| 260 |
|
|---|
| 261 | A mouse event contains a special accept flag that indicates
|
|---|
| 262 | whether the receiver wants the event. You should call
|
|---|
| 263 | QMouseEvent::ignore() if the mouse event is not handled by your
|
|---|
| 264 | widget. A mouse event is propagated up the parent widget chain
|
|---|
| 265 | until a widget accepts it with QMouseEvent::accept() or an event
|
|---|
| 266 | filter consumes it.
|
|---|
| 267 |
|
|---|
| 268 | The functions pos(), x() and y() give the cursor position relative
|
|---|
| 269 | to the widget that receives the mouse event. If you move the
|
|---|
| 270 | widget as a result of the mouse event, use the global position
|
|---|
| 271 | returned by globalPos() to avoid a shaking motion.
|
|---|
| 272 |
|
|---|
| 273 | The QWidget::setEnabled() function can be used to enable or
|
|---|
| 274 | disable mouse and keyboard events for a widget.
|
|---|
| 275 |
|
|---|
| 276 | The event handlers QWidget::mousePressEvent(),
|
|---|
| 277 | QWidget::mouseReleaseEvent(), QWidget::mouseDoubleClickEvent() and
|
|---|
| 278 | QWidget::mouseMoveEvent() receive mouse events.
|
|---|
| 279 |
|
|---|
| 280 | \sa QWidget::setMouseTracking(), QWidget::grabMouse(),
|
|---|
| 281 | QCursor::pos()
|
|---|
| 282 | */
|
|---|
| 283 |
|
|---|
| 284 | /*!
|
|---|
| 285 | \fn QMouseEvent::QMouseEvent( Type type, const QPoint &pos, int button, int state )
|
|---|
| 286 |
|
|---|
| 287 | Constructs a mouse event object.
|
|---|
| 288 |
|
|---|
| 289 | The \a type parameter must be one of \c QEvent::MouseButtonPress,
|
|---|
| 290 | \c QEvent::MouseButtonRelease, \c QEvent::MouseButtonDblClick or
|
|---|
| 291 | \c QEvent::MouseMove.
|
|---|
| 292 |
|
|---|
| 293 | The \a pos parameter specifies the position relative to the
|
|---|
| 294 | receiving widget. \a button specifies the \link Qt::ButtonState
|
|---|
| 295 | button\endlink that caused the event, which should be \c
|
|---|
| 296 | Qt::NoButton (0), if \a type is \c MouseMove. \a state is the
|
|---|
| 297 | \link Qt::ButtonState ButtonState\endlink at the time of the
|
|---|
| 298 | event.
|
|---|
| 299 |
|
|---|
| 300 | The globalPos() is initialized to QCursor::pos(), which may not be
|
|---|
| 301 | appropriate. Use the other constructor to specify the global
|
|---|
| 302 | position explicitly.
|
|---|
| 303 | */
|
|---|
| 304 |
|
|---|
| 305 | QMouseEvent::QMouseEvent( Type type, const QPoint &pos, int button, int state )
|
|---|
| 306 | : QEvent(type), p(pos), b(button),s((ushort)state), accpt(TRUE){
|
|---|
| 307 | g = QCursor::pos();
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 | /*!
|
|---|
| 312 | \fn QMouseEvent::QMouseEvent( Type type, const QPoint &pos, const QPoint &globalPos, int button, int state )
|
|---|
| 313 |
|
|---|
| 314 | Constructs a mouse event object.
|
|---|
| 315 |
|
|---|
| 316 | The \a type parameter must be \c QEvent::MouseButtonPress, \c
|
|---|
| 317 | QEvent::MouseButtonRelease, \c QEvent::MouseButtonDblClick or \c
|
|---|
| 318 | QEvent::MouseMove.
|
|---|
| 319 |
|
|---|
| 320 | The \a pos parameter specifies the position relative to the
|
|---|
| 321 | receiving widget. \a globalPos is the position in absolute
|
|---|
| 322 | coordinates. \a button specifies the \link Qt::ButtonState
|
|---|
| 323 | button\endlink that caused the event, which should be \c
|
|---|
| 324 | Qt::NoButton (0), if \a type is \c MouseMove. \a state is the
|
|---|
| 325 | \link Qt::ButtonState ButtonState\endlink at the time of the
|
|---|
| 326 | event.
|
|---|
| 327 |
|
|---|
| 328 | */
|
|---|
| 329 |
|
|---|
| 330 | /*!
|
|---|
| 331 | \fn const QPoint &QMouseEvent::pos() const
|
|---|
| 332 |
|
|---|
| 333 | Returns the position of the mouse pointer relative to the widget
|
|---|
| 334 | that received the event.
|
|---|
| 335 |
|
|---|
| 336 | If you move the widget as a result of the mouse event, use the
|
|---|
| 337 | global position returned by globalPos() to avoid a shaking motion.
|
|---|
| 338 |
|
|---|
| 339 | \sa x(), y(), globalPos()
|
|---|
| 340 | */
|
|---|
| 341 |
|
|---|
| 342 | /*!
|
|---|
| 343 | \fn const QPoint &QMouseEvent::globalPos() const
|
|---|
| 344 |
|
|---|
| 345 | Returns the global position of the mouse pointer \e{at the time
|
|---|
| 346 | of the event}. This is important on asynchronous window systems
|
|---|
| 347 | like X11. Whenever you move your widgets around in response to
|
|---|
| 348 | mouse events, globalPos() may differ a lot from the current
|
|---|
| 349 | pointer position QCursor::pos(), and from QWidget::mapToGlobal(
|
|---|
| 350 | pos() ).
|
|---|
| 351 |
|
|---|
| 352 | \sa globalX(), globalY()
|
|---|
| 353 | */
|
|---|
| 354 |
|
|---|
| 355 | /*!
|
|---|
| 356 | \fn int QMouseEvent::x() const
|
|---|
| 357 |
|
|---|
| 358 | Returns the x-position of the mouse pointer, relative to the
|
|---|
| 359 | widget that received the event.
|
|---|
| 360 |
|
|---|
| 361 | \sa y(), pos()
|
|---|
| 362 | */
|
|---|
| 363 |
|
|---|
| 364 | /*!
|
|---|
| 365 | \fn int QMouseEvent::y() const
|
|---|
| 366 |
|
|---|
| 367 | Returns the y-position of the mouse pointer, relative to the
|
|---|
| 368 | widget that received the event.
|
|---|
| 369 |
|
|---|
| 370 | \sa x(), pos()
|
|---|
| 371 | */
|
|---|
| 372 |
|
|---|
| 373 | /*!
|
|---|
| 374 | \fn int QMouseEvent::globalX() const
|
|---|
| 375 |
|
|---|
| 376 | Returns the global x-position of the mouse pointer at the time of
|
|---|
| 377 | the event.
|
|---|
| 378 |
|
|---|
| 379 | \sa globalY(), globalPos()
|
|---|
| 380 | */
|
|---|
| 381 |
|
|---|
| 382 | /*!
|
|---|
| 383 | \fn int QMouseEvent::globalY() const
|
|---|
| 384 |
|
|---|
| 385 | Returns the global y-position of the mouse pointer at the time of
|
|---|
| 386 | the event.
|
|---|
| 387 |
|
|---|
| 388 | \sa globalX(), globalPos()
|
|---|
| 389 | */
|
|---|
| 390 |
|
|---|
| 391 | /*!
|
|---|
| 392 | \fn ButtonState QMouseEvent::button() const
|
|---|
| 393 |
|
|---|
| 394 | Returns the button that caused the event.
|
|---|
| 395 |
|
|---|
| 396 | Possible return values are \c LeftButton, \c RightButton, \c
|
|---|
| 397 | MidButton and \c NoButton.
|
|---|
| 398 |
|
|---|
| 399 | Note that the returned value is always \c NoButton for mouse move
|
|---|
| 400 | events.
|
|---|
| 401 |
|
|---|
| 402 | \sa state() Qt::ButtonState
|
|---|
| 403 | */
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 | /*!
|
|---|
| 407 | \fn ButtonState QMouseEvent::state() const
|
|---|
| 408 |
|
|---|
| 409 | Returns the button state (a combination of mouse buttons and
|
|---|
| 410 | keyboard modifiers), i.e. what buttons and keys were being pressed
|
|---|
| 411 | immediately before the event was generated.
|
|---|
| 412 |
|
|---|
| 413 | This means that if you have a \c QEvent::MouseButtonPress or a \c
|
|---|
| 414 | QEvent::MouseButtonDblClick state() will \e not include the mouse
|
|---|
| 415 | button that's pressed. But once the mouse button has been
|
|---|
| 416 | released, the \c QEvent::MouseButtonRelease event will have the
|
|---|
| 417 | button() that was pressed.
|
|---|
| 418 |
|
|---|
| 419 | This value is mainly interesting for \c QEvent::MouseMove; for the
|
|---|
| 420 | other cases, button() is more useful.
|
|---|
| 421 |
|
|---|
| 422 | The returned value is \c LeftButton, \c RightButton, \c MidButton,
|
|---|
| 423 | \c ShiftButton, \c ControlButton and \c AltButton OR'ed together.
|
|---|
| 424 |
|
|---|
| 425 | \sa button() stateAfter() Qt::ButtonState
|
|---|
| 426 | */
|
|---|
| 427 |
|
|---|
| 428 | /*!
|
|---|
| 429 | \fn ButtonState QMouseEvent::stateAfter() const
|
|---|
| 430 |
|
|---|
| 431 | Returns the state of buttons after the event.
|
|---|
| 432 |
|
|---|
| 433 | \sa state() Qt::ButtonState
|
|---|
| 434 | */
|
|---|
| 435 | Qt::ButtonState QMouseEvent::stateAfter() const
|
|---|
| 436 | {
|
|---|
| 437 | return Qt::ButtonState(state()^button());
|
|---|
| 438 | }
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 | /*!
|
|---|
| 443 | \fn bool QMouseEvent::isAccepted() const
|
|---|
| 444 |
|
|---|
| 445 | Returns TRUE if the receiver of the event wants to keep the key;
|
|---|
| 446 | otherwise returns FALSE.
|
|---|
| 447 | */
|
|---|
| 448 |
|
|---|
| 449 | /*!
|
|---|
| 450 | \fn void QMouseEvent::accept()
|
|---|
| 451 |
|
|---|
| 452 | Sets the accept flag of the mouse event object.
|
|---|
| 453 |
|
|---|
| 454 | Setting the accept parameter indicates that the receiver of the
|
|---|
| 455 | event wants the mouse event. Unwanted mouse events are sent to the
|
|---|
| 456 | parent widget.
|
|---|
| 457 |
|
|---|
| 458 | The accept flag is set by default.
|
|---|
| 459 |
|
|---|
| 460 | \sa ignore()
|
|---|
| 461 | */
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 | /*!
|
|---|
| 465 | \fn void QMouseEvent::ignore()
|
|---|
| 466 |
|
|---|
| 467 | Clears the accept flag parameter of the mouse event object.
|
|---|
| 468 |
|
|---|
| 469 | Clearing the accept parameter indicates that the event receiver
|
|---|
| 470 | does not want the mouse event. Unwanted mouse events are sent to
|
|---|
| 471 | the parent widget.
|
|---|
| 472 |
|
|---|
| 473 | The accept flag is set by default.
|
|---|
| 474 |
|
|---|
| 475 | \sa accept()
|
|---|
| 476 | */
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 | /*!
|
|---|
| 480 | \class QWheelEvent qevent.h
|
|---|
| 481 | \brief The QWheelEvent class contains parameters that describe a wheel event.
|
|---|
| 482 |
|
|---|
| 483 | \ingroup events
|
|---|
| 484 |
|
|---|
| 485 | Wheel events are sent to the widget under the mouse, and if that widget
|
|---|
| 486 | does not handle the event they are sent to the focus widget. The rotation
|
|---|
| 487 | distance is provided by delta(). The functions pos() and globalPos() return
|
|---|
| 488 | the mouse pointer location at the time of the event.
|
|---|
| 489 |
|
|---|
| 490 | A wheel event contains a special accept flag that indicates
|
|---|
| 491 | whether the receiver wants the event. You should call
|
|---|
| 492 | QWheelEvent::accept() if you handle the wheel event; otherwise it
|
|---|
| 493 | will be sent to the parent widget.
|
|---|
| 494 |
|
|---|
| 495 | The QWidget::setEnable() function can be used to enable or disable
|
|---|
| 496 | mouse and keyboard events for a widget.
|
|---|
| 497 |
|
|---|
| 498 | The event handler QWidget::wheelEvent() receives wheel events.
|
|---|
| 499 |
|
|---|
| 500 | \sa QMouseEvent, QWidget::grabMouse()
|
|---|
| 501 | */
|
|---|
| 502 |
|
|---|
| 503 | /*!
|
|---|
| 504 | \fn Orientation QWheelEvent::orientation() const
|
|---|
| 505 |
|
|---|
| 506 | Returns the wheel's orientation.
|
|---|
| 507 | */
|
|---|
| 508 |
|
|---|
| 509 | /*!
|
|---|
| 510 | \fn QWheelEvent::QWheelEvent( const QPoint &pos, int delta, int state, Orientation orient = Vertical );
|
|---|
| 511 |
|
|---|
| 512 | Constructs a wheel event object.
|
|---|
| 513 |
|
|---|
| 514 | The globalPos() is initialized to QCursor::pos(), i.e. \a pos,
|
|---|
| 515 | which is usually (but not always) right. Use the other constructor
|
|---|
| 516 | if you need to specify the global position explicitly. \a delta
|
|---|
| 517 | contains the rotation distance, \a state holds the keyboard
|
|---|
| 518 | modifier flags at the time of the event and \a orient holds the
|
|---|
| 519 | wheel's orientation.
|
|---|
| 520 |
|
|---|
| 521 | \sa pos(), delta(), state()
|
|---|
| 522 | */
|
|---|
| 523 | #ifndef QT_NO_WHEELEVENT
|
|---|
| 524 | QWheelEvent::QWheelEvent( const QPoint &pos, int delta, int state, Orientation orient )
|
|---|
| 525 | : QEvent(Wheel), p(pos), d(delta), s((ushort)state),
|
|---|
| 526 | accpt(TRUE), o(orient)
|
|---|
| 527 | {
|
|---|
| 528 | g = QCursor::pos();
|
|---|
| 529 | }
|
|---|
| 530 | #endif
|
|---|
| 531 | /*!
|
|---|
| 532 | \fn QWheelEvent::QWheelEvent( const QPoint &pos, const QPoint& globalPos, int delta, int state, Orientation orient = Vertical )
|
|---|
| 533 |
|
|---|
| 534 | Constructs a wheel event object. The position when the event
|
|---|
| 535 | occurred is given in \a pos and \a globalPos. \a delta contains
|
|---|
| 536 | the rotation distance, \a state holds the keyboard modifier flags
|
|---|
| 537 | at the time of the event and \a orient holds the wheel's
|
|---|
| 538 | orientation.
|
|---|
| 539 |
|
|---|
| 540 | \sa pos(), globalPos(), delta(), state()
|
|---|
| 541 | */
|
|---|
| 542 |
|
|---|
| 543 | /*!
|
|---|
| 544 | \fn int QWheelEvent::delta() const
|
|---|
| 545 |
|
|---|
| 546 | Returns the distance that the wheel is rotated expressed in
|
|---|
| 547 | multiples or divisions of \c WHEEL_DELTA, which is currently set
|
|---|
| 548 | at 120. A positive value indicates that the wheel was rotated
|
|---|
| 549 | forwards away from the user; a negative value indicates that the
|
|---|
| 550 | wheel was rotated backwards toward the user.
|
|---|
| 551 |
|
|---|
| 552 | The \c WHEEL_DELTA constant was set to 120 by the wheel mouse
|
|---|
| 553 | vendors to allow building finer-resolution wheels in the future,
|
|---|
| 554 | including perhaps a freely rotating wheel with no notches. The
|
|---|
| 555 | expectation is that such a device would send more messages per
|
|---|
| 556 | rotation but with a smaller value in each message.
|
|---|
| 557 | */
|
|---|
| 558 |
|
|---|
| 559 | /*!
|
|---|
| 560 | \fn const QPoint &QWheelEvent::pos() const
|
|---|
| 561 |
|
|---|
| 562 | Returns the position of the mouse pointer, relative to the widget
|
|---|
| 563 | that received the event.
|
|---|
| 564 |
|
|---|
| 565 | If you move your widgets around in response to mouse
|
|---|
| 566 | events, use globalPos() instead of this function.
|
|---|
| 567 |
|
|---|
| 568 | \sa x(), y(), globalPos()
|
|---|
| 569 | */
|
|---|
| 570 |
|
|---|
| 571 | /*!
|
|---|
| 572 | \fn int QWheelEvent::x() const
|
|---|
| 573 |
|
|---|
| 574 | Returns the x-position of the mouse pointer, relative to the
|
|---|
| 575 | widget that received the event.
|
|---|
| 576 |
|
|---|
| 577 | \sa y(), pos()
|
|---|
| 578 | */
|
|---|
| 579 |
|
|---|
| 580 | /*!
|
|---|
| 581 | \fn int QWheelEvent::y() const
|
|---|
| 582 |
|
|---|
| 583 | Returns the y-position of the mouse pointer, relative to the
|
|---|
| 584 | widget that received the event.
|
|---|
| 585 |
|
|---|
| 586 | \sa x(), pos()
|
|---|
| 587 | */
|
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 | /*!
|
|---|
| 591 | \fn const QPoint &QWheelEvent::globalPos() const
|
|---|
| 592 |
|
|---|
| 593 | Returns the global position of the mouse pointer \e{at the time
|
|---|
| 594 | of the event}. This is important on asynchronous window systems
|
|---|
| 595 | such as X11; whenever you move your widgets around in response to
|
|---|
| 596 | mouse events, globalPos() can differ a lot from the current
|
|---|
| 597 | pointer position QCursor::pos().
|
|---|
| 598 |
|
|---|
| 599 | \sa globalX(), globalY()
|
|---|
| 600 | */
|
|---|
| 601 |
|
|---|
| 602 | /*!
|
|---|
| 603 | \fn int QWheelEvent::globalX() const
|
|---|
| 604 |
|
|---|
| 605 | Returns the global x-position of the mouse pointer at the time of
|
|---|
| 606 | the event.
|
|---|
| 607 |
|
|---|
| 608 | \sa globalY(), globalPos()
|
|---|
| 609 | */
|
|---|
| 610 |
|
|---|
| 611 | /*!
|
|---|
| 612 | \fn int QWheelEvent::globalY() const
|
|---|
| 613 |
|
|---|
| 614 | Returns the global y-position of the mouse pointer at the time of
|
|---|
| 615 | the event.
|
|---|
| 616 |
|
|---|
| 617 | \sa globalX(), globalPos()
|
|---|
| 618 | */
|
|---|
| 619 |
|
|---|
| 620 |
|
|---|
| 621 | /*!
|
|---|
| 622 | \fn ButtonState QWheelEvent::state() const
|
|---|
| 623 |
|
|---|
| 624 | Returns the keyboard modifier flags of the event.
|
|---|
| 625 |
|
|---|
| 626 | The returned value is \c ShiftButton, \c ControlButton, and \c
|
|---|
| 627 | AltButton OR'ed together.
|
|---|
| 628 | */
|
|---|
| 629 |
|
|---|
| 630 | /*!
|
|---|
| 631 | \fn bool QWheelEvent::isAccepted() const
|
|---|
| 632 |
|
|---|
| 633 | Returns TRUE if the receiver of the event handles the wheel event;
|
|---|
| 634 | otherwise returns FALSE.
|
|---|
| 635 | */
|
|---|
| 636 |
|
|---|
| 637 | /*!
|
|---|
| 638 | \fn void QWheelEvent::accept()
|
|---|
| 639 |
|
|---|
| 640 | Sets the accept flag of the wheel event object.
|
|---|
| 641 |
|
|---|
| 642 | Setting the accept parameter indicates that the receiver of the
|
|---|
| 643 | event wants the wheel event. Unwanted wheel events are sent to the
|
|---|
| 644 | parent widget.
|
|---|
| 645 |
|
|---|
| 646 | The accept flag is set by default.
|
|---|
| 647 |
|
|---|
| 648 | \sa ignore()
|
|---|
| 649 | */
|
|---|
| 650 |
|
|---|
| 651 | /*!
|
|---|
| 652 | \fn void QWheelEvent::ignore()
|
|---|
| 653 |
|
|---|
| 654 | Clears the accept flag parameter of the wheel event object.
|
|---|
| 655 |
|
|---|
| 656 | Clearing the accept parameter indicates that the event receiver
|
|---|
| 657 | does not want the wheel event. Unwanted wheel events are sent to
|
|---|
| 658 | the parent widget. The accept flag is set by default.
|
|---|
| 659 |
|
|---|
| 660 | \sa accept()
|
|---|
| 661 | */
|
|---|
| 662 |
|
|---|
| 663 |
|
|---|
| 664 | /*!
|
|---|
| 665 | \enum Qt::Modifier
|
|---|
| 666 |
|
|---|
| 667 | This enum type describes the keyboard modifier keys supported by
|
|---|
| 668 | Qt.
|
|---|
| 669 |
|
|---|
| 670 | \value SHIFT the Shift keys provided on all standard keyboards.
|
|---|
| 671 | \value META the Meta keys.
|
|---|
| 672 | \value CTRL the Ctrl keys.
|
|---|
| 673 | \value ALT the normal Alt keys, but not e.g. AltGr.
|
|---|
| 674 | \value MODIFIER_MASK is a mask of Shift, Ctrl, Alt and Meta.
|
|---|
| 675 | \value UNICODE_ACCEL the accelerator is specified as a Unicode code
|
|---|
| 676 | point, not as a Qt Key.
|
|---|
| 677 | */
|
|---|
| 678 |
|
|---|
| 679 | /*!
|
|---|
| 680 | \class QKeyEvent qevent.h
|
|---|
| 681 | \brief The QKeyEvent class contains describes a key event.
|
|---|
| 682 |
|
|---|
| 683 | \ingroup events
|
|---|
| 684 |
|
|---|
| 685 | Key events occur when a key is pressed or released when a widget
|
|---|
| 686 | has keyboard input focus.
|
|---|
| 687 |
|
|---|
| 688 | A key event contains a special accept flag that indicates whether the
|
|---|
| 689 | receiver wants the key event. You should call QKeyEvent::ignore() if the
|
|---|
| 690 | key press or release event is not handled by your widget. A key event is
|
|---|
| 691 | propagated up the parent widget chain until a widget accepts it with
|
|---|
| 692 | QKeyEvent::accept() or an event filter consumes it.
|
|---|
| 693 | Key events for multi media keys are ignored by default. You should call
|
|---|
| 694 | QKeyEvent::accept() if your widget handles those events.
|
|---|
| 695 |
|
|---|
| 696 | The QWidget::setEnable() function can be used to enable or disable
|
|---|
| 697 | mouse and keyboard events for a widget.
|
|---|
| 698 |
|
|---|
| 699 | The event handlers QWidget::keyPressEvent() and
|
|---|
| 700 | QWidget::keyReleaseEvent() receive key events.
|
|---|
| 701 |
|
|---|
| 702 | \sa QFocusEvent, QWidget::grabKeyboard()
|
|---|
| 703 | */
|
|---|
| 704 |
|
|---|
| 705 | /*!
|
|---|
| 706 | \fn QKeyEvent::QKeyEvent( Type type, int key, int ascii, int state,
|
|---|
| 707 | const QString& text, bool autorep, ushort count )
|
|---|
| 708 |
|
|---|
| 709 | Constructs a key event object.
|
|---|
| 710 |
|
|---|
| 711 | The \a type parameter must be \c QEvent::KeyPress or \c
|
|---|
| 712 | QEvent::KeyRelease. If \a key is 0 the event is not a result of a
|
|---|
| 713 | known key (e.g. it may be the result of a compose sequence or
|
|---|
| 714 | keyboard macro). \a ascii is the ASCII code of the key that was
|
|---|
| 715 | pressed or released. \a state holds the keyboard modifiers. \a
|
|---|
| 716 | text is the Unicode text that the key generated. If \a autorep is
|
|---|
| 717 | TRUE, isAutoRepeat() will be TRUE. \a count is the number of
|
|---|
| 718 | single keys.
|
|---|
| 719 |
|
|---|
| 720 | The accept flag is set to TRUE.
|
|---|
| 721 | */
|
|---|
| 722 |
|
|---|
| 723 | /*!
|
|---|
| 724 | \fn int QKeyEvent::key() const
|
|---|
| 725 |
|
|---|
| 726 | Returns the code of the key that was pressed or released.
|
|---|
| 727 |
|
|---|
| 728 | See \l Qt::Key for the list of keyboard codes. These codes are
|
|---|
| 729 | independent of the underlying window system.
|
|---|
| 730 |
|
|---|
| 731 | A value of either 0 or Key_unknown means that the event is not
|
|---|
| 732 | the result of a known key (e.g. it may be the result of a compose
|
|---|
| 733 | sequence or a keyboard macro, or due to key event compression).
|
|---|
| 734 |
|
|---|
| 735 | \sa QWidget::setKeyCompression()
|
|---|
| 736 | */
|
|---|
| 737 |
|
|---|
| 738 | /*!
|
|---|
| 739 | \fn int QKeyEvent::ascii() const
|
|---|
| 740 |
|
|---|
| 741 | Returns the ASCII code of the key that was pressed or released. We
|
|---|
| 742 | recommend using text() instead.
|
|---|
| 743 |
|
|---|
| 744 | \sa text()
|
|---|
| 745 | */
|
|---|
| 746 |
|
|---|
| 747 | /*!
|
|---|
| 748 | \fn QString QKeyEvent::text() const
|
|---|
| 749 |
|
|---|
| 750 | Returns the Unicode text that this key generated. The text returned
|
|---|
| 751 | migth be text().isNull == TRUE, which is the case when pressing or
|
|---|
| 752 | releasing modifying keys as Shift, Control, Alt and Meta. In these
|
|---|
| 753 | cases key() will contain a valid value.
|
|---|
| 754 |
|
|---|
| 755 | \sa QWidget::setKeyCompression()
|
|---|
| 756 | */
|
|---|
| 757 |
|
|---|
| 758 | /*!
|
|---|
| 759 | \fn ButtonState QKeyEvent::state() const
|
|---|
| 760 |
|
|---|
| 761 | Returns the keyboard modifier flags that existed immediately
|
|---|
| 762 | before the event occurred.
|
|---|
| 763 |
|
|---|
| 764 | The returned value is \c ShiftButton, \c ControlButton, \c AltButton
|
|---|
| 765 | and \c MetaButton OR'ed together.
|
|---|
| 766 |
|
|---|
| 767 | \sa stateAfter()
|
|---|
| 768 | */
|
|---|
| 769 |
|
|---|
| 770 | /*!
|
|---|
| 771 | \fn ButtonState QKeyEvent::stateAfter() const
|
|---|
| 772 |
|
|---|
| 773 | Returns the keyboard modifier flags that existed immediately after
|
|---|
| 774 | the event occurred.
|
|---|
| 775 |
|
|---|
| 776 | \warning This function cannot be trusted.
|
|---|
| 777 |
|
|---|
| 778 | \sa state()
|
|---|
| 779 | */
|
|---|
| 780 | //###### We must check with XGetModifierMapping
|
|---|
| 781 | Qt::ButtonState QKeyEvent::stateAfter() const
|
|---|
| 782 | {
|
|---|
| 783 | if ( key() == Key_Shift )
|
|---|
| 784 | return Qt::ButtonState(state()^ShiftButton);
|
|---|
| 785 | if ( key() == Key_Control )
|
|---|
| 786 | return Qt::ButtonState(state()^ControlButton);
|
|---|
| 787 | if ( key() == Key_Alt )
|
|---|
| 788 | return Qt::ButtonState(state()^AltButton);
|
|---|
| 789 | if ( key() == Key_Meta )
|
|---|
| 790 | return Qt::ButtonState(state()^MetaButton);
|
|---|
| 791 | return state();
|
|---|
| 792 | }
|
|---|
| 793 |
|
|---|
| 794 | /*!
|
|---|
| 795 | \fn bool QKeyEvent::isAccepted() const
|
|---|
| 796 |
|
|---|
| 797 | Returns TRUE if the receiver of the event wants to keep the key;
|
|---|
| 798 | otherwise returns FALSE
|
|---|
| 799 | */
|
|---|
| 800 |
|
|---|
| 801 | /*!
|
|---|
| 802 | \fn void QKeyEvent::accept()
|
|---|
| 803 |
|
|---|
| 804 | Sets the accept flag of the key event object.
|
|---|
| 805 |
|
|---|
| 806 | Setting the accept parameter indicates that the receiver of the
|
|---|
| 807 | event wants the key event. Unwanted key events are sent to the
|
|---|
| 808 | parent widget.
|
|---|
| 809 |
|
|---|
| 810 | The accept flag is set by default.
|
|---|
| 811 |
|
|---|
| 812 | \sa ignore()
|
|---|
| 813 | */
|
|---|
| 814 |
|
|---|
| 815 | /*!
|
|---|
| 816 | \fn bool QKeyEvent::isAutoRepeat() const
|
|---|
| 817 |
|
|---|
| 818 | Returns TRUE if this event comes from an auto-repeating key and
|
|---|
| 819 | FALSE if it comes from an initial key press.
|
|---|
| 820 |
|
|---|
| 821 | Note that if the event is a multiple-key compressed event that is
|
|---|
| 822 | partly due to auto-repeat, this function could return either TRUE
|
|---|
| 823 | or FALSE indeterminately.
|
|---|
| 824 | */
|
|---|
| 825 |
|
|---|
| 826 | /*!
|
|---|
| 827 | \fn int QKeyEvent::count() const
|
|---|
| 828 |
|
|---|
| 829 | Returns the number of single keys for this event. If text() is not
|
|---|
| 830 | empty, this is simply the length of the string.
|
|---|
| 831 |
|
|---|
| 832 | \sa QWidget::setKeyCompression()
|
|---|
| 833 | */
|
|---|
| 834 |
|
|---|
| 835 | /*!
|
|---|
| 836 | \fn void QKeyEvent::ignore()
|
|---|
| 837 |
|
|---|
| 838 | Clears the accept flag parameter of the key event object.
|
|---|
| 839 |
|
|---|
| 840 | Clearing the accept parameter indicates that the event receiver
|
|---|
| 841 | does not want the key event. Unwanted key events are sent to the
|
|---|
| 842 | parent widget.
|
|---|
| 843 |
|
|---|
| 844 | The accept flag is set by default.
|
|---|
| 845 |
|
|---|
| 846 | \sa accept()
|
|---|
| 847 | */
|
|---|
| 848 |
|
|---|
| 849 | /*!
|
|---|
| 850 | \enum Qt::Key
|
|---|
| 851 |
|
|---|
| 852 | The key names used by Qt.
|
|---|
| 853 |
|
|---|
| 854 | \value Key_Escape
|
|---|
| 855 | \value Key_Tab
|
|---|
| 856 | \value Key_Backtab
|
|---|
| 857 | \value Key_Backspace
|
|---|
| 858 | \value Key_Return
|
|---|
| 859 | \value Key_Enter
|
|---|
| 860 | \value Key_Insert
|
|---|
| 861 | \value Key_Delete
|
|---|
| 862 | \value Key_Pause
|
|---|
| 863 | \value Key_Print
|
|---|
| 864 | \value Key_SysReq
|
|---|
| 865 | \value Key_Home
|
|---|
| 866 | \value Key_End
|
|---|
| 867 | \value Key_Left
|
|---|
| 868 | \value Key_Up
|
|---|
| 869 | \value Key_Right
|
|---|
| 870 | \value Key_Down
|
|---|
| 871 | \value Key_Prior
|
|---|
| 872 | \value Key_Next
|
|---|
| 873 | \value Key_Shift
|
|---|
| 874 | \value Key_Control
|
|---|
| 875 | \value Key_Meta
|
|---|
| 876 | \value Key_Alt
|
|---|
| 877 | \value Key_CapsLock
|
|---|
| 878 | \value Key_NumLock
|
|---|
| 879 | \value Key_ScrollLock
|
|---|
| 880 | \value Key_Clear
|
|---|
| 881 | \value Key_F1
|
|---|
| 882 | \value Key_F2
|
|---|
| 883 | \value Key_F3
|
|---|
| 884 | \value Key_F4
|
|---|
| 885 | \value Key_F5
|
|---|
| 886 | \value Key_F6
|
|---|
| 887 | \value Key_F7
|
|---|
| 888 | \value Key_F8
|
|---|
| 889 | \value Key_F9
|
|---|
| 890 | \value Key_F10
|
|---|
| 891 | \value Key_F11
|
|---|
| 892 | \value Key_F12
|
|---|
| 893 | \value Key_F13
|
|---|
| 894 | \value Key_F14
|
|---|
| 895 | \value Key_F15
|
|---|
| 896 | \value Key_F16
|
|---|
| 897 | \value Key_F17
|
|---|
| 898 | \value Key_F18
|
|---|
| 899 | \value Key_F19
|
|---|
| 900 | \value Key_F20
|
|---|
| 901 | \value Key_F21
|
|---|
| 902 | \value Key_F22
|
|---|
| 903 | \value Key_F23
|
|---|
| 904 | \value Key_F24
|
|---|
| 905 | \value Key_F25
|
|---|
| 906 | \value Key_F26
|
|---|
| 907 | \value Key_F27
|
|---|
| 908 | \value Key_F28
|
|---|
| 909 | \value Key_F29
|
|---|
| 910 | \value Key_F30
|
|---|
| 911 | \value Key_F31
|
|---|
| 912 | \value Key_F32
|
|---|
| 913 | \value Key_F33
|
|---|
| 914 | \value Key_F34
|
|---|
| 915 | \value Key_F35
|
|---|
| 916 | \value Key_Super_L
|
|---|
| 917 | \value Key_Super_R
|
|---|
| 918 | \value Key_Menu
|
|---|
| 919 | \value Key_Hyper_L
|
|---|
| 920 | \value Key_Hyper_R
|
|---|
| 921 | \value Key_Help
|
|---|
| 922 | \value Key_Space
|
|---|
| 923 | \value Key_Any
|
|---|
| 924 | \value Key_Exclam
|
|---|
| 925 | \value Key_QuoteDbl
|
|---|
| 926 | \value Key_NumberSign
|
|---|
| 927 | \value Key_Dollar
|
|---|
| 928 | \value Key_Percent
|
|---|
| 929 | \value Key_Ampersand
|
|---|
| 930 | \value Key_Apostrophe
|
|---|
| 931 | \value Key_ParenLeft
|
|---|
| 932 | \value Key_ParenRight
|
|---|
| 933 | \value Key_Asterisk
|
|---|
| 934 | \value Key_Plus
|
|---|
| 935 | \value Key_Comma
|
|---|
| 936 | \value Key_Minus
|
|---|
| 937 | \value Key_Period
|
|---|
| 938 | \value Key_Slash
|
|---|
| 939 | \value Key_0
|
|---|
| 940 | \value Key_1
|
|---|
| 941 | \value Key_2
|
|---|
| 942 | \value Key_3
|
|---|
| 943 | \value Key_4
|
|---|
| 944 | \value Key_5
|
|---|
| 945 | \value Key_6
|
|---|
| 946 | \value Key_7
|
|---|
| 947 | \value Key_8
|
|---|
| 948 | \value Key_9
|
|---|
| 949 | \value Key_Colon
|
|---|
| 950 | \value Key_Semicolon
|
|---|
| 951 | \value Key_Less
|
|---|
| 952 | \value Key_Equal
|
|---|
| 953 | \value Key_Greater
|
|---|
| 954 | \value Key_Question
|
|---|
| 955 | \value Key_At
|
|---|
| 956 | \value Key_A
|
|---|
| 957 | \value Key_B
|
|---|
| 958 | \value Key_C
|
|---|
| 959 | \value Key_D
|
|---|
| 960 | \value Key_E
|
|---|
| 961 | \value Key_F
|
|---|
| 962 | \value Key_G
|
|---|
| 963 | \value Key_H
|
|---|
| 964 | \value Key_I
|
|---|
| 965 | \value Key_J
|
|---|
| 966 | \value Key_K
|
|---|
| 967 | \value Key_L
|
|---|
| 968 | \value Key_M
|
|---|
| 969 | \value Key_N
|
|---|
| 970 | \value Key_O
|
|---|
| 971 | \value Key_P
|
|---|
| 972 | \value Key_Q
|
|---|
| 973 | \value Key_R
|
|---|
| 974 | \value Key_S
|
|---|
| 975 | \value Key_T
|
|---|
| 976 | \value Key_U
|
|---|
| 977 | \value Key_V
|
|---|
| 978 | \value Key_W
|
|---|
| 979 | \value Key_X
|
|---|
| 980 | \value Key_Y
|
|---|
| 981 | \value Key_Z
|
|---|
| 982 | \value Key_BracketLeft
|
|---|
| 983 | \value Key_Backslash
|
|---|
| 984 | \value Key_BracketRight
|
|---|
| 985 | \value Key_AsciiCircum
|
|---|
| 986 | \value Key_Underscore
|
|---|
| 987 | \value Key_QuoteLeft
|
|---|
| 988 | \value Key_BraceLeft
|
|---|
| 989 | \value Key_Bar
|
|---|
| 990 | \value Key_BraceRight
|
|---|
| 991 | \value Key_AsciiTilde
|
|---|
| 992 |
|
|---|
| 993 | \value Key_nobreakspace
|
|---|
| 994 | \value Key_exclamdown
|
|---|
| 995 | \value Key_cent
|
|---|
| 996 | \value Key_sterling
|
|---|
| 997 | \value Key_currency
|
|---|
| 998 | \value Key_yen
|
|---|
| 999 | \value Key_brokenbar
|
|---|
| 1000 | \value Key_section
|
|---|
| 1001 | \value Key_diaeresis
|
|---|
| 1002 | \value Key_copyright
|
|---|
| 1003 | \value Key_ordfeminine
|
|---|
| 1004 | \value Key_guillemotleft
|
|---|
| 1005 | \value Key_notsign
|
|---|
| 1006 | \value Key_hyphen
|
|---|
| 1007 | \value Key_registered
|
|---|
| 1008 | \value Key_macron
|
|---|
| 1009 | \value Key_degree
|
|---|
| 1010 | \value Key_plusminus
|
|---|
| 1011 | \value Key_twosuperior
|
|---|
| 1012 | \value Key_threesuperior
|
|---|
| 1013 | \value Key_acute
|
|---|
| 1014 | \value Key_mu
|
|---|
| 1015 | \value Key_paragraph
|
|---|
| 1016 | \value Key_periodcentered
|
|---|
| 1017 | \value Key_cedilla
|
|---|
| 1018 | \value Key_onesuperior
|
|---|
| 1019 | \value Key_masculine
|
|---|
| 1020 | \value Key_guillemotright
|
|---|
| 1021 | \value Key_onequarter
|
|---|
| 1022 | \value Key_onehalf
|
|---|
| 1023 | \value Key_threequarters
|
|---|
| 1024 | \value Key_questiondown
|
|---|
| 1025 | \value Key_Agrave
|
|---|
| 1026 | \value Key_Aacute
|
|---|
| 1027 | \value Key_Acircumflex
|
|---|
| 1028 | \value Key_Atilde
|
|---|
| 1029 | \value Key_Adiaeresis
|
|---|
| 1030 | \value Key_Aring
|
|---|
| 1031 | \value Key_AE
|
|---|
| 1032 | \value Key_Ccedilla
|
|---|
| 1033 | \value Key_Egrave
|
|---|
| 1034 | \value Key_Eacute
|
|---|
| 1035 | \value Key_Ecircumflex
|
|---|
| 1036 | \value Key_Ediaeresis
|
|---|
| 1037 | \value Key_Igrave
|
|---|
| 1038 | \value Key_Iacute
|
|---|
| 1039 | \value Key_Icircumflex
|
|---|
| 1040 | \value Key_Idiaeresis
|
|---|
| 1041 | \value Key_ETH
|
|---|
| 1042 | \value Key_Ntilde
|
|---|
| 1043 | \value Key_Ograve
|
|---|
| 1044 | \value Key_Oacute
|
|---|
| 1045 | \value Key_Ocircumflex
|
|---|
| 1046 | \value Key_Otilde
|
|---|
| 1047 | \value Key_Odiaeresis
|
|---|
| 1048 | \value Key_multiply
|
|---|
| 1049 | \value Key_Ooblique
|
|---|
| 1050 | \value Key_Ugrave
|
|---|
| 1051 | \value Key_Uacute
|
|---|
| 1052 | \value Key_Ucircumflex
|
|---|
| 1053 | \value Key_Udiaeresis
|
|---|
| 1054 | \value Key_Yacute
|
|---|
| 1055 | \value Key_THORN
|
|---|
| 1056 | \value Key_ssharp
|
|---|
| 1057 | \value Key_agrave
|
|---|
| 1058 | \value Key_aacute
|
|---|
| 1059 | \value Key_acircumflex
|
|---|
| 1060 | \value Key_atilde
|
|---|
| 1061 | \value Key_adiaeresis
|
|---|
| 1062 | \value Key_aring
|
|---|
| 1063 | \value Key_ae
|
|---|
| 1064 | \value Key_ccedilla
|
|---|
| 1065 | \value Key_egrave
|
|---|
| 1066 | \value Key_eacute
|
|---|
| 1067 | \value Key_ecircumflex
|
|---|
| 1068 | \value Key_ediaeresis
|
|---|
| 1069 | \value Key_igrave
|
|---|
| 1070 | \value Key_iacute
|
|---|
| 1071 | \value Key_icircumflex
|
|---|
| 1072 | \value Key_idiaeresis
|
|---|
| 1073 | \value Key_eth
|
|---|
| 1074 | \value Key_ntilde
|
|---|
| 1075 | \value Key_ograve
|
|---|
| 1076 | \value Key_oacute
|
|---|
| 1077 | \value Key_ocircumflex
|
|---|
| 1078 | \value Key_otilde
|
|---|
| 1079 | \value Key_odiaeresis
|
|---|
| 1080 | \value Key_division
|
|---|
| 1081 | \value Key_oslash
|
|---|
| 1082 | \value Key_ugrave
|
|---|
| 1083 | \value Key_uacute
|
|---|
| 1084 | \value Key_ucircumflex
|
|---|
| 1085 | \value Key_udiaeresis
|
|---|
| 1086 | \value Key_yacute
|
|---|
| 1087 | \value Key_thorn
|
|---|
| 1088 | \value Key_ydiaeresis
|
|---|
| 1089 |
|
|---|
| 1090 | Multimedia keys
|
|---|
| 1091 |
|
|---|
| 1092 | \value Key_Back
|
|---|
| 1093 | \value Key_Forward
|
|---|
| 1094 | \value Key_Stop
|
|---|
| 1095 | \value Key_Refresh
|
|---|
| 1096 |
|
|---|
| 1097 | \value Key_VolumeDown
|
|---|
| 1098 | \value Key_VolumeMute
|
|---|
| 1099 | \value Key_VolumeUp
|
|---|
| 1100 | \value Key_BassBoost
|
|---|
| 1101 | \value Key_BassUp
|
|---|
| 1102 | \value Key_BassDown
|
|---|
| 1103 | \value Key_TrebleUp
|
|---|
| 1104 | \value Key_TrebleDown
|
|---|
| 1105 |
|
|---|
| 1106 | \value Key_MediaPlay
|
|---|
| 1107 | \value Key_MediaStop
|
|---|
| 1108 | \value Key_MediaPrev
|
|---|
| 1109 | \value Key_MediaNext
|
|---|
| 1110 | \value Key_MediaRecord
|
|---|
| 1111 |
|
|---|
| 1112 | \value Key_HomePage
|
|---|
| 1113 | \value Key_Favorites
|
|---|
| 1114 | \value Key_Search
|
|---|
| 1115 | \value Key_Standby
|
|---|
| 1116 | \value Key_OpenUrl
|
|---|
| 1117 |
|
|---|
| 1118 | \value Key_LaunchMail
|
|---|
| 1119 | \value Key_LaunchMedia
|
|---|
| 1120 | \value Key_Launch0
|
|---|
| 1121 | \value Key_Launch1
|
|---|
| 1122 | \value Key_Launch2
|
|---|
| 1123 | \value Key_Launch3
|
|---|
| 1124 | \value Key_Launch4
|
|---|
| 1125 | \value Key_Launch5
|
|---|
| 1126 | \value Key_Launch6
|
|---|
| 1127 | \value Key_Launch7
|
|---|
| 1128 | \value Key_Launch8
|
|---|
| 1129 | \value Key_Launch9
|
|---|
| 1130 | \value Key_LaunchA
|
|---|
| 1131 | \value Key_LaunchB
|
|---|
| 1132 | \value Key_LaunchC
|
|---|
| 1133 | \value Key_LaunchD
|
|---|
| 1134 | \value Key_LaunchE
|
|---|
| 1135 | \value Key_LaunchF
|
|---|
| 1136 |
|
|---|
| 1137 | \value Key_MediaLast
|
|---|
| 1138 |
|
|---|
| 1139 | \value Key_unknown
|
|---|
| 1140 |
|
|---|
| 1141 | \value Key_Direction_L internal use only
|
|---|
| 1142 | \value Key_Direction_R internal use only
|
|---|
| 1143 |
|
|---|
| 1144 | */
|
|---|
| 1145 |
|
|---|
| 1146 |
|
|---|
| 1147 | /*!
|
|---|
| 1148 | \class QFocusEvent qevent.h
|
|---|
| 1149 | \brief The QFocusEvent class contains event parameters for widget focus
|
|---|
| 1150 | events.
|
|---|
| 1151 |
|
|---|
| 1152 | \ingroup events
|
|---|
| 1153 |
|
|---|
| 1154 | Focus events are sent to widgets when the keyboard input focus
|
|---|
| 1155 | changes. Focus events occur due to mouse actions, keypresses (e.g.
|
|---|
| 1156 | Tab or Backtab), the window system, popup menus, keyboard
|
|---|
| 1157 | shortcuts or other application specific reasons. The reason for a
|
|---|
| 1158 | particular focus event is returned by reason() in the appropriate
|
|---|
| 1159 | event handler.
|
|---|
| 1160 |
|
|---|
| 1161 | The event handlers QWidget::focusInEvent() and
|
|---|
| 1162 | QWidget::focusOutEvent() receive focus events.
|
|---|
| 1163 |
|
|---|
| 1164 | Use setReason() to set the reason for all focus events, and
|
|---|
| 1165 | resetReason() to set the reason for all focus events to the reason
|
|---|
| 1166 | in force before the last setReason() call.
|
|---|
| 1167 |
|
|---|
| 1168 | \sa QWidget::setFocus(), QWidget::setFocusPolicy()
|
|---|
| 1169 | */
|
|---|
| 1170 |
|
|---|
| 1171 | /*!
|
|---|
| 1172 | \fn QFocusEvent::QFocusEvent( Type type )
|
|---|
| 1173 |
|
|---|
| 1174 | Constructs a focus event object.
|
|---|
| 1175 |
|
|---|
| 1176 | The \a type parameter must be either \c QEvent::FocusIn or \c
|
|---|
| 1177 | QEvent::FocusOut.
|
|---|
| 1178 | */
|
|---|
| 1179 |
|
|---|
| 1180 |
|
|---|
| 1181 |
|
|---|
| 1182 | QFocusEvent::Reason QFocusEvent::m_reason = QFocusEvent::Other;
|
|---|
| 1183 | QFocusEvent::Reason QFocusEvent::prev_reason = QFocusEvent::Other;
|
|---|
| 1184 |
|
|---|
| 1185 |
|
|---|
| 1186 | /*!
|
|---|
| 1187 | \enum QFocusEvent::Reason
|
|---|
| 1188 |
|
|---|
| 1189 | This enum specifies why the focus changed.
|
|---|
| 1190 |
|
|---|
| 1191 | \value Mouse because of a mouse action.
|
|---|
| 1192 | \value Tab because of a Tab press.
|
|---|
| 1193 | \value Backtab because of a Backtab press
|
|---|
| 1194 | (possibly including Shift/Control, e.g. Shift+Tab).
|
|---|
| 1195 | \value ActiveWindow because the window system made this window (in)active.
|
|---|
| 1196 | \value Popup because the application opened/closed a popup that grabbed/released focus.
|
|---|
| 1197 | \value Shortcut because of a keyboard shortcut.
|
|---|
| 1198 | \value Other any other reason, usually application-specific.
|
|---|
| 1199 |
|
|---|
| 1200 | See the \link focus.html keyboard focus overview\endlink for more
|
|---|
| 1201 | about focus.
|
|---|
| 1202 | */
|
|---|
| 1203 |
|
|---|
| 1204 | /*!
|
|---|
| 1205 | Returns the reason for this focus event.
|
|---|
| 1206 |
|
|---|
| 1207 | \sa setReason()
|
|---|
| 1208 | */
|
|---|
| 1209 | QFocusEvent::Reason QFocusEvent::reason()
|
|---|
| 1210 | {
|
|---|
| 1211 | return m_reason;
|
|---|
| 1212 | }
|
|---|
| 1213 |
|
|---|
| 1214 | /*!
|
|---|
| 1215 | Sets the reason for all future focus events to \a reason.
|
|---|
| 1216 |
|
|---|
| 1217 | \sa reason(), resetReason()
|
|---|
| 1218 | */
|
|---|
| 1219 | void QFocusEvent::setReason( Reason reason )
|
|---|
| 1220 | {
|
|---|
| 1221 | prev_reason = m_reason;
|
|---|
| 1222 | m_reason = reason;
|
|---|
| 1223 | }
|
|---|
| 1224 |
|
|---|
| 1225 | /*!
|
|---|
| 1226 | Resets the reason for all future focus events to the value before
|
|---|
| 1227 | the last setReason() call.
|
|---|
| 1228 |
|
|---|
| 1229 | \sa reason(), setReason()
|
|---|
| 1230 | */
|
|---|
| 1231 | void QFocusEvent::resetReason()
|
|---|
| 1232 | {
|
|---|
| 1233 | m_reason = prev_reason;
|
|---|
| 1234 | }
|
|---|
| 1235 |
|
|---|
| 1236 | /*!
|
|---|
| 1237 | \fn bool QFocusEvent::gotFocus() const
|
|---|
| 1238 |
|
|---|
| 1239 | Returns TRUE if the widget received the text input focus;
|
|---|
| 1240 | otherwise returns FALSE.
|
|---|
| 1241 | */
|
|---|
| 1242 |
|
|---|
| 1243 | /*!
|
|---|
| 1244 | \fn bool QFocusEvent::lostFocus() const
|
|---|
| 1245 |
|
|---|
| 1246 | Returns TRUE if the widget lost the text input focus; otherwise
|
|---|
| 1247 | returns FALSE.
|
|---|
| 1248 | */
|
|---|
| 1249 |
|
|---|
| 1250 |
|
|---|
| 1251 | /*!
|
|---|
| 1252 | \class QPaintEvent qevent.h
|
|---|
| 1253 | \brief The QPaintEvent class contains event parameters for paint events.
|
|---|
| 1254 |
|
|---|
| 1255 | \ingroup events
|
|---|
| 1256 |
|
|---|
| 1257 | Paint events are sent to widgets that need to update themselves,
|
|---|
| 1258 | for instance when part of a widget is exposed because a covering
|
|---|
| 1259 | widget is moved.
|
|---|
| 1260 |
|
|---|
| 1261 | The event contains a region() that needs to be updated, and a
|
|---|
| 1262 | rect() that is the bounding rectangle of that region. Both are
|
|---|
| 1263 | provided because many widgets can't make much use of region(), and
|
|---|
| 1264 | rect() can be much faster than region().boundingRect(). Painting
|
|---|
| 1265 | is clipped to region() during processing of a paint event.
|
|---|
| 1266 |
|
|---|
| 1267 | The erased() function returns TRUE if the region() has been
|
|---|
| 1268 | cleared to the widget's background (see
|
|---|
| 1269 | QWidget::backgroundMode()), and FALSE if the region's contents are
|
|---|
| 1270 | arbitrary.
|
|---|
| 1271 |
|
|---|
| 1272 | \sa QPainter QWidget::update() QWidget::repaint()
|
|---|
| 1273 | QWidget::paintEvent() QWidget::backgroundMode() QRegion
|
|---|
| 1274 | */
|
|---|
| 1275 |
|
|---|
| 1276 | /*!
|
|---|
| 1277 | \fn QPaintEvent::QPaintEvent( const QRegion &paintRegion, bool erased=TRUE )
|
|---|
| 1278 |
|
|---|
| 1279 | Constructs a paint event object with the region that should be
|
|---|
| 1280 | updated. The region is given by \a paintRegion. If \a erased is
|
|---|
| 1281 | TRUE the region will be cleared before repainting.
|
|---|
| 1282 | */
|
|---|
| 1283 |
|
|---|
| 1284 | /*!
|
|---|
| 1285 | \fn QPaintEvent::QPaintEvent( const QRect &paintRect, bool erased=TRUE )
|
|---|
| 1286 |
|
|---|
| 1287 | Constructs a paint event object with the rectangle that should be
|
|---|
| 1288 | updated. The region is also given by \a paintRect. If \a erased is
|
|---|
| 1289 | TRUE the region will be cleared before repainting.
|
|---|
| 1290 | */
|
|---|
| 1291 |
|
|---|
| 1292 | /*!
|
|---|
| 1293 | \fn QPaintEvent::QPaintEvent( const QRegion &paintRegion, const QRect &paintRect, bool erased=TRUE )
|
|---|
| 1294 |
|
|---|
| 1295 | Constructs a paint event object with the rectangle \a paintRect
|
|---|
| 1296 | that should be updated. The region is given by \a paintRegion. If
|
|---|
| 1297 | \a erased is TRUE the region will be cleared before repainting.
|
|---|
| 1298 | */
|
|---|
| 1299 |
|
|---|
| 1300 | /*!
|
|---|
| 1301 | \fn const QRect &QPaintEvent::rect() const
|
|---|
| 1302 |
|
|---|
| 1303 | Returns the rectangle that should be updated.
|
|---|
| 1304 |
|
|---|
| 1305 | \sa region(), QPainter::setClipRect()
|
|---|
| 1306 | */
|
|---|
| 1307 |
|
|---|
| 1308 | /*!
|
|---|
| 1309 | \fn const QRegion &QPaintEvent::region() const
|
|---|
| 1310 |
|
|---|
| 1311 | Returns the region that should be updated.
|
|---|
| 1312 |
|
|---|
| 1313 | \sa rect(), QPainter::setClipRegion()
|
|---|
| 1314 | */
|
|---|
| 1315 |
|
|---|
| 1316 | /*!
|
|---|
| 1317 | \fn bool QPaintEvent::erased() const
|
|---|
| 1318 |
|
|---|
| 1319 | Returns TRUE if the paint event region (or rectangle) has been
|
|---|
| 1320 | erased with the widget's background; otherwise returns FALSE.
|
|---|
| 1321 | */
|
|---|
| 1322 |
|
|---|
| 1323 | /*!
|
|---|
| 1324 | \class QMoveEvent qevent.h
|
|---|
| 1325 | \brief The QMoveEvent class contains event parameters for move events.
|
|---|
| 1326 |
|
|---|
| 1327 | \ingroup events
|
|---|
| 1328 |
|
|---|
| 1329 | Move events are sent to widgets that have been moved to a new position
|
|---|
| 1330 | relative to their parent.
|
|---|
| 1331 |
|
|---|
| 1332 | The event handler QWidget::moveEvent() receives move events.
|
|---|
| 1333 |
|
|---|
| 1334 | \sa QWidget::move(), QWidget::setGeometry()
|
|---|
| 1335 | */
|
|---|
| 1336 |
|
|---|
| 1337 | /*!
|
|---|
| 1338 | \fn QMoveEvent::QMoveEvent( const QPoint &pos, const QPoint &oldPos )
|
|---|
| 1339 |
|
|---|
| 1340 | Constructs a move event with the new and old widget positions, \a
|
|---|
| 1341 | pos and \a oldPos respectively.
|
|---|
| 1342 | */
|
|---|
| 1343 |
|
|---|
| 1344 | /*!
|
|---|
| 1345 | \fn const QPoint &QMoveEvent::pos() const
|
|---|
| 1346 |
|
|---|
| 1347 | Returns the new position of the widget. This excludes the window
|
|---|
| 1348 | frame for top level widgets.
|
|---|
| 1349 | */
|
|---|
| 1350 |
|
|---|
| 1351 | /*!
|
|---|
| 1352 | \fn const QPoint &QMoveEvent::oldPos() const
|
|---|
| 1353 |
|
|---|
| 1354 | Returns the old position of the widget.
|
|---|
| 1355 | */
|
|---|
| 1356 |
|
|---|
| 1357 |
|
|---|
| 1358 | /*!
|
|---|
| 1359 | \class QResizeEvent qevent.h
|
|---|
| 1360 | \brief The QResizeEvent class contains event parameters for resize events.
|
|---|
| 1361 |
|
|---|
| 1362 | \ingroup events
|
|---|
| 1363 |
|
|---|
| 1364 | Resize events are sent to widgets that have been resized.
|
|---|
| 1365 |
|
|---|
| 1366 | The event handler QWidget::resizeEvent() receives resize events.
|
|---|
| 1367 |
|
|---|
| 1368 | \sa QWidget::resize(), QWidget::setGeometry()
|
|---|
| 1369 | */
|
|---|
| 1370 |
|
|---|
| 1371 | /*!
|
|---|
| 1372 | \fn QResizeEvent::QResizeEvent( const QSize &size, const QSize &oldSize )
|
|---|
| 1373 |
|
|---|
| 1374 | Constructs a resize event with the new and old widget sizes, \a
|
|---|
| 1375 | size and \a oldSize respectively.
|
|---|
| 1376 | */
|
|---|
| 1377 |
|
|---|
| 1378 | /*!
|
|---|
| 1379 | \fn const QSize &QResizeEvent::size() const
|
|---|
| 1380 |
|
|---|
| 1381 | Returns the new size of the widget, which is the same as
|
|---|
| 1382 | QWidget::size().
|
|---|
| 1383 | */
|
|---|
| 1384 |
|
|---|
| 1385 | /*!
|
|---|
| 1386 | \fn const QSize &QResizeEvent::oldSize() const
|
|---|
| 1387 |
|
|---|
| 1388 | Returns the old size of the widget.
|
|---|
| 1389 | */
|
|---|
| 1390 |
|
|---|
| 1391 |
|
|---|
| 1392 | /*!
|
|---|
| 1393 | \class QCloseEvent qevent.h
|
|---|
| 1394 | \brief The QCloseEvent class contains parameters that describe a close event.
|
|---|
| 1395 |
|
|---|
| 1396 | \ingroup events
|
|---|
| 1397 |
|
|---|
| 1398 | Close events are sent to widgets that the user wants to close,
|
|---|
| 1399 | usually by choosing "Close" from the window menu, or by clicking
|
|---|
| 1400 | the `X' titlebar button. They are also sent when you call
|
|---|
| 1401 | QWidget::close() to close a widget programmatically.
|
|---|
| 1402 |
|
|---|
| 1403 | Close events contain a flag that indicates whether the receiver
|
|---|
| 1404 | wants the widget to be closed or not. When a widget accepts the
|
|---|
| 1405 | close event, it is hidden (and destroyed if it was created with
|
|---|
| 1406 | the \c WDestructiveClose flag). If it refuses to accept the close
|
|---|
| 1407 | event nothing happens. (Under X11 it is possible that the window
|
|---|
| 1408 | manager will forcibly close the window; but at the time of writing
|
|---|
| 1409 | we are not aware of any window manager that does this.)
|
|---|
| 1410 |
|
|---|
| 1411 | The application's main widget -- QApplication::mainWidget() --
|
|---|
| 1412 | is a special case. When it accepts the close event, Qt leaves the
|
|---|
| 1413 | main event loop and the application is immediately terminated
|
|---|
| 1414 | (i.e. it returns from the call to QApplication::exec() in the
|
|---|
| 1415 | main() function).
|
|---|
| 1416 |
|
|---|
| 1417 | The event handler QWidget::closeEvent() receives close events. The
|
|---|
| 1418 | default implementation of this event handler accepts the close
|
|---|
| 1419 | event. If you do not want your widget to be hidden, or want some
|
|---|
| 1420 | special handing, you should reimplement the event handler.
|
|---|
| 1421 |
|
|---|
| 1422 | The \link simple-application.html#closeEvent closeEvent() in the
|
|---|
| 1423 | Application Walkthrough\endlink shows a close event handler that
|
|---|
| 1424 | asks whether to save a document before closing.
|
|---|
| 1425 |
|
|---|
| 1426 | If you want the widget to be deleted when it is closed, create it
|
|---|
| 1427 | with the \c WDestructiveClose widget flag. This is very useful for
|
|---|
| 1428 | independent top-level windows in a multi-window application.
|
|---|
| 1429 |
|
|---|
| 1430 | \l{QObject}s emits the \link QObject::destroyed()
|
|---|
| 1431 | destroyed()\endlink signal when they are deleted.
|
|---|
| 1432 |
|
|---|
| 1433 | If the last top-level window is closed, the
|
|---|
| 1434 | QApplication::lastWindowClosed() signal is emitted.
|
|---|
| 1435 |
|
|---|
| 1436 | The isAccepted() function returns TRUE if the event's receiver has
|
|---|
| 1437 | agreed to close the widget; call accept() to agree to close the
|
|---|
| 1438 | widget and call ignore() if the receiver of this event does not
|
|---|
| 1439 | want the widget to be closed.
|
|---|
| 1440 |
|
|---|
| 1441 | \sa QWidget::close(), QWidget::hide(), QObject::destroyed(),
|
|---|
| 1442 | QApplication::setMainWidget(), QApplication::lastWindowClosed(),
|
|---|
| 1443 | QApplication::exec(), QApplication::quit()
|
|---|
| 1444 | */
|
|---|
| 1445 |
|
|---|
| 1446 | /*!
|
|---|
| 1447 | \fn QCloseEvent::QCloseEvent()
|
|---|
| 1448 |
|
|---|
| 1449 | Constructs a close event object with the accept parameter flag set
|
|---|
| 1450 | to FALSE.
|
|---|
| 1451 |
|
|---|
| 1452 | \sa accept()
|
|---|
| 1453 | */
|
|---|
| 1454 |
|
|---|
| 1455 | /*!
|
|---|
| 1456 | \fn bool QCloseEvent::isAccepted() const
|
|---|
| 1457 |
|
|---|
| 1458 | Returns TRUE if the receiver of the event has agreed to close the
|
|---|
| 1459 | widget; otherwise returns FALSE.
|
|---|
| 1460 |
|
|---|
| 1461 | \sa accept(), ignore()
|
|---|
| 1462 | */
|
|---|
| 1463 |
|
|---|
| 1464 | /*!
|
|---|
| 1465 | \fn void QCloseEvent::accept()
|
|---|
| 1466 |
|
|---|
| 1467 | Sets the accept flag of the close event object.
|
|---|
| 1468 |
|
|---|
| 1469 | Setting the accept flag indicates that the receiver of this event
|
|---|
| 1470 | agrees to close the widget.
|
|---|
| 1471 |
|
|---|
| 1472 | The accept flag is \e not set by default.
|
|---|
| 1473 |
|
|---|
| 1474 | If you choose to accept in QWidget::closeEvent(), the widget will
|
|---|
| 1475 | be hidden. If the widget's \c WDestructiveClose flag is set, it
|
|---|
| 1476 | will also be destroyed.
|
|---|
| 1477 |
|
|---|
| 1478 | \sa ignore(), QWidget::hide()
|
|---|
| 1479 | */
|
|---|
| 1480 |
|
|---|
| 1481 | /*!
|
|---|
| 1482 | \fn void QCloseEvent::ignore()
|
|---|
| 1483 |
|
|---|
| 1484 | Clears the accept flag of the close event object.
|
|---|
| 1485 |
|
|---|
| 1486 | Clearing the accept flag indicates that the receiver of this event
|
|---|
| 1487 | does not want the widget to be closed.
|
|---|
| 1488 |
|
|---|
| 1489 | The close event is constructed with the accept flag cleared.
|
|---|
| 1490 |
|
|---|
| 1491 | \sa accept()
|
|---|
| 1492 | */
|
|---|
| 1493 |
|
|---|
| 1494 | /*!
|
|---|
| 1495 | \class QIconDragEvent qevent.h
|
|---|
| 1496 | \brief The QIconDragEvent class signals that a main icon drag has begun.
|
|---|
| 1497 |
|
|---|
| 1498 | \ingroup events
|
|---|
| 1499 |
|
|---|
| 1500 | Icon drag events are sent to widgets when the main icon of a window has been dragged away.
|
|---|
| 1501 | On Mac OS X this is fired when the proxy icon of a window is dragged off titlebar, in response to
|
|---|
| 1502 | this event is is normal to begin using drag and drop.
|
|---|
| 1503 | */
|
|---|
| 1504 |
|
|---|
| 1505 | /*!
|
|---|
| 1506 | \fn QIconDragEvent::QIconDragEvent()
|
|---|
| 1507 |
|
|---|
| 1508 | Constructs an icon drag event object with the accept parameter
|
|---|
| 1509 | flag set to FALSE.
|
|---|
| 1510 |
|
|---|
| 1511 | \sa accept()
|
|---|
| 1512 | */
|
|---|
| 1513 |
|
|---|
| 1514 | /*!
|
|---|
| 1515 | \fn bool QIconDragEvent::isAccepted() const
|
|---|
| 1516 |
|
|---|
| 1517 | Returns TRUE if the receiver of the event has started a drag and
|
|---|
| 1518 | drop operation; otherwise returns FALSE.
|
|---|
| 1519 |
|
|---|
| 1520 | \sa accept(), ignore()
|
|---|
| 1521 | */
|
|---|
| 1522 |
|
|---|
| 1523 | /*!
|
|---|
| 1524 | \fn void QIconDragEvent::accept()
|
|---|
| 1525 |
|
|---|
| 1526 | Sets the accept flag of the icon drag event object.
|
|---|
| 1527 |
|
|---|
| 1528 | Setting the accept flag indicates that the receiver of this event
|
|---|
| 1529 | has started a drag and drop oeration.
|
|---|
| 1530 |
|
|---|
| 1531 | The accept flag is \e not set by default.
|
|---|
| 1532 |
|
|---|
| 1533 | \sa ignore(), QWidget::hide()
|
|---|
| 1534 | */
|
|---|
| 1535 |
|
|---|
| 1536 | /*!
|
|---|
| 1537 | \fn void QIconDragEvent::ignore()
|
|---|
| 1538 |
|
|---|
| 1539 | Clears the accept flag of the icon drag object.
|
|---|
| 1540 |
|
|---|
| 1541 | Clearing the accept flag indicates that the receiver of this event
|
|---|
| 1542 | has not handled the icon drag as a result other events can be sent.
|
|---|
| 1543 |
|
|---|
| 1544 | The icon drag event is constructed with the accept flag cleared.
|
|---|
| 1545 |
|
|---|
| 1546 | \sa accept()
|
|---|
| 1547 | */
|
|---|
| 1548 |
|
|---|
| 1549 | /*!
|
|---|
| 1550 | \class QContextMenuEvent qevent.h
|
|---|
| 1551 | \brief The QContextMenuEvent class contains parameters that describe a context menu event.
|
|---|
| 1552 |
|
|---|
| 1553 | \ingroup events
|
|---|
| 1554 |
|
|---|
| 1555 | Context menu events are sent to widgets when a user triggers a
|
|---|
| 1556 | context menu. What triggers this is platform dependent. For
|
|---|
| 1557 | example, on Windows, pressing the menu button or releasing the
|
|---|
| 1558 | right mouse button will cause this event to be sent.
|
|---|
| 1559 |
|
|---|
| 1560 | When this event occurs it is customary to show a QPopupMenu with a
|
|---|
| 1561 | context menu, if this is relevant to the context.
|
|---|
| 1562 |
|
|---|
| 1563 | Context menu events contain a special accept flag that indicates
|
|---|
| 1564 | whether the receiver accepted the event. If the event handler does
|
|---|
| 1565 | not accept the event, then whatever triggered the event will be
|
|---|
| 1566 | handled as a regular input event if possible.
|
|---|
| 1567 |
|
|---|
| 1568 | \sa QPopupMenu
|
|---|
| 1569 | */
|
|---|
| 1570 |
|
|---|
| 1571 | /*!
|
|---|
| 1572 | \fn QContextMenuEvent::QContextMenuEvent( Reason reason, const QPoint &pos, const QPoint &globalPos, int state )
|
|---|
| 1573 |
|
|---|
| 1574 | Constructs a context menu event object with the accept parameter
|
|---|
| 1575 | flag set to FALSE.
|
|---|
| 1576 |
|
|---|
| 1577 | The \a reason parameter must be \c QContextMenuEvent::Mouse or \c
|
|---|
| 1578 | QContextMenuEvent::Keyboard.
|
|---|
| 1579 |
|
|---|
| 1580 | The \a pos parameter specifies the mouse position relative to the
|
|---|
| 1581 | receiving widget. \a globalPos is the mouse position in absolute
|
|---|
| 1582 | coordinates. \a state is the ButtonState at the time of the event.
|
|---|
| 1583 | */
|
|---|
| 1584 |
|
|---|
| 1585 |
|
|---|
| 1586 | /*!
|
|---|
| 1587 | \fn QContextMenuEvent::QContextMenuEvent( Reason reason, const QPoint &pos, int state )
|
|---|
| 1588 |
|
|---|
| 1589 | Constructs a context menu event object with the accept parameter
|
|---|
| 1590 | flag set to FALSE.
|
|---|
| 1591 |
|
|---|
| 1592 | The \a reason parameter must be \c QContextMenuEvent::Mouse or \c
|
|---|
| 1593 | QContextMenuEvent::Keyboard.
|
|---|
| 1594 |
|
|---|
| 1595 | The \a pos parameter specifies the mouse position relative to the
|
|---|
| 1596 | receiving widget. \a state is the ButtonState at the time of the
|
|---|
| 1597 | event.
|
|---|
| 1598 |
|
|---|
| 1599 | The globalPos() is initialized to QCursor::pos(), which may not be
|
|---|
| 1600 | appropriate. Use the other constructor to specify the global
|
|---|
| 1601 | position explicitly.
|
|---|
| 1602 | */
|
|---|
| 1603 |
|
|---|
| 1604 | QContextMenuEvent::QContextMenuEvent( Reason reason, const QPoint &pos, int state )
|
|---|
| 1605 | : QEvent( ContextMenu ), p( pos ), accpt(TRUE), consum(TRUE),
|
|---|
| 1606 | reas( reason ), s((ushort)state)
|
|---|
| 1607 | {
|
|---|
| 1608 | gp = QCursor::pos();
|
|---|
| 1609 | }
|
|---|
| 1610 |
|
|---|
| 1611 | /*!
|
|---|
| 1612 | \fn const QPoint &QContextMenuEvent::pos() const
|
|---|
| 1613 |
|
|---|
| 1614 | Returns the position of the mouse pointer relative to the widget
|
|---|
| 1615 | that received the event.
|
|---|
| 1616 |
|
|---|
| 1617 | \sa x(), y(), globalPos()
|
|---|
| 1618 | */
|
|---|
| 1619 |
|
|---|
| 1620 | /*!
|
|---|
| 1621 | \fn int QContextMenuEvent::x() const
|
|---|
| 1622 |
|
|---|
| 1623 | Returns the x-position of the mouse pointer, relative to the
|
|---|
| 1624 | widget that received the event.
|
|---|
| 1625 |
|
|---|
| 1626 | \sa y(), pos()
|
|---|
| 1627 | */
|
|---|
| 1628 |
|
|---|
| 1629 | /*!
|
|---|
| 1630 | \fn int QContextMenuEvent::y() const
|
|---|
| 1631 |
|
|---|
| 1632 | Returns the y-position of the mouse pointer, relative to the
|
|---|
| 1633 | widget that received the event.
|
|---|
| 1634 |
|
|---|
| 1635 | \sa x(), pos()
|
|---|
| 1636 | */
|
|---|
| 1637 |
|
|---|
| 1638 | /*!
|
|---|
| 1639 | \fn const QPoint &QContextMenuEvent::globalPos() const
|
|---|
| 1640 |
|
|---|
| 1641 | Returns the global position of the mouse pointer at the time of
|
|---|
| 1642 | the event.
|
|---|
| 1643 |
|
|---|
| 1644 | \sa x(), y(), pos()
|
|---|
| 1645 | */
|
|---|
| 1646 |
|
|---|
| 1647 | /*!
|
|---|
| 1648 | \fn int QContextMenuEvent::globalX() const
|
|---|
| 1649 |
|
|---|
| 1650 | Returns the global x-position of the mouse pointer at the time of
|
|---|
| 1651 | the event.
|
|---|
| 1652 |
|
|---|
| 1653 | \sa globalY(), globalPos()
|
|---|
| 1654 | */
|
|---|
| 1655 |
|
|---|
| 1656 | /*!
|
|---|
| 1657 | \fn int QContextMenuEvent::globalY() const
|
|---|
| 1658 |
|
|---|
| 1659 | Returns the global y-position of the mouse pointer at the time of
|
|---|
| 1660 | the event.
|
|---|
| 1661 |
|
|---|
| 1662 | \sa globalX(), globalPos()
|
|---|
| 1663 | */
|
|---|
| 1664 |
|
|---|
| 1665 | /*!
|
|---|
| 1666 | \fn ButtonState QContextMenuEvent::state() const
|
|---|
| 1667 |
|
|---|
| 1668 | Returns the button state (a combination of mouse buttons and
|
|---|
| 1669 | keyboard modifiers), i.e. what buttons and keys were being
|
|---|
| 1670 | pressed immediately before the event was generated.
|
|---|
| 1671 |
|
|---|
| 1672 | The returned value is \c LeftButton, \c RightButton, \c MidButton,
|
|---|
| 1673 | \c ShiftButton, \c ControlButton and \c AltButton OR'ed together.
|
|---|
| 1674 | */
|
|---|
| 1675 |
|
|---|
| 1676 | /*!
|
|---|
| 1677 | \fn bool QContextMenuEvent::isConsumed() const
|
|---|
| 1678 |
|
|---|
| 1679 | Returns TRUE (which stops propagation of the event) if the
|
|---|
| 1680 | receiver has blocked the event; otherwise returns FALSE.
|
|---|
| 1681 |
|
|---|
| 1682 | \sa accept(), ignore(), consume()
|
|---|
| 1683 | */
|
|---|
| 1684 |
|
|---|
| 1685 | /*!
|
|---|
| 1686 | \fn void QContextMenuEvent::consume()
|
|---|
| 1687 |
|
|---|
| 1688 | Sets the consume flag of the context event object.
|
|---|
| 1689 |
|
|---|
| 1690 | Setting the consume flag indicates that the receiver of this event
|
|---|
| 1691 | does not want the event to be propagated further (i.e. not sent to
|
|---|
| 1692 | parent classes.)
|
|---|
| 1693 |
|
|---|
| 1694 | The consumed flag is not set by default.
|
|---|
| 1695 |
|
|---|
| 1696 | \sa ignore() accept()
|
|---|
| 1697 | */
|
|---|
| 1698 |
|
|---|
| 1699 | /*!
|
|---|
| 1700 | \fn bool QContextMenuEvent::isAccepted() const
|
|---|
| 1701 |
|
|---|
| 1702 | Returns TRUE if the receiver has processed the event; otherwise
|
|---|
| 1703 | returns FALSE.
|
|---|
| 1704 |
|
|---|
| 1705 | \sa accept(), ignore(), consume()
|
|---|
| 1706 | */
|
|---|
| 1707 |
|
|---|
| 1708 | /*!
|
|---|
| 1709 | \fn void QContextMenuEvent::accept()
|
|---|
| 1710 |
|
|---|
| 1711 | Sets the accept flag of the context event object.
|
|---|
| 1712 |
|
|---|
| 1713 | Setting the accept flag indicates that the receiver of this event
|
|---|
| 1714 | has processed the event. Processing the event means you did
|
|---|
| 1715 | something with it and it will be implicitly consumed.
|
|---|
| 1716 |
|
|---|
| 1717 | The accept flag is not set by default.
|
|---|
| 1718 |
|
|---|
| 1719 | \sa ignore() consume()
|
|---|
| 1720 | */
|
|---|
| 1721 |
|
|---|
| 1722 | /*!
|
|---|
| 1723 | \fn void QContextMenuEvent::ignore()
|
|---|
| 1724 |
|
|---|
| 1725 | Clears the accept flag of the context event object.
|
|---|
| 1726 |
|
|---|
| 1727 | Clearing the accept flag indicates that the receiver of this event
|
|---|
| 1728 | does not need to show a context menu. This will implicitly remove
|
|---|
| 1729 | the consumed flag as well.
|
|---|
| 1730 |
|
|---|
| 1731 | The accept flag is not set by default.
|
|---|
| 1732 |
|
|---|
| 1733 | \sa accept() consume()
|
|---|
| 1734 | */
|
|---|
| 1735 |
|
|---|
| 1736 | /*!
|
|---|
| 1737 | \enum QContextMenuEvent::Reason
|
|---|
| 1738 |
|
|---|
| 1739 | This enum describes the reason the ContextMenuEvent was sent. The
|
|---|
| 1740 | values are:
|
|---|
| 1741 |
|
|---|
| 1742 | \value Mouse The mouse caused the event to be sent. Normally this
|
|---|
| 1743 | means the right mouse button was clicked, but this is platform
|
|---|
| 1744 | specific.
|
|---|
| 1745 |
|
|---|
| 1746 | \value Keyboard The keyboard caused this event to be sent. On
|
|---|
| 1747 | Windows this means the menu button was pressed.
|
|---|
| 1748 |
|
|---|
| 1749 | \value Other The event was sent by some other means (i.e. not by
|
|---|
| 1750 | the mouse or keyboard).
|
|---|
| 1751 | */
|
|---|
| 1752 |
|
|---|
| 1753 |
|
|---|
| 1754 | /*!
|
|---|
| 1755 | \fn QContextMenuEvent::Reason QContextMenuEvent::reason() const
|
|---|
| 1756 |
|
|---|
| 1757 | Returns the reason for this context event.
|
|---|
| 1758 | */
|
|---|
| 1759 |
|
|---|
| 1760 |
|
|---|
| 1761 | /*!
|
|---|
| 1762 | \class QIMEvent qevent.h
|
|---|
| 1763 | \brief The QIMEvent class provides parameters for input method events.
|
|---|
| 1764 |
|
|---|
| 1765 | \ingroup events
|
|---|
| 1766 |
|
|---|
| 1767 | Input method events are sent to widgets when an input method is
|
|---|
| 1768 | used to enter text into a widget. Input methods are widely used to
|
|---|
| 1769 | enter text in Asian and other complex languages.
|
|---|
| 1770 |
|
|---|
| 1771 | The events are of interest to widgets that accept keyboard input
|
|---|
| 1772 | and want to be able to correctly handle complex languages. Text
|
|---|
| 1773 | input in such languages is usually a three step process.
|
|---|
| 1774 |
|
|---|
| 1775 | \list 1
|
|---|
| 1776 | \i <b>Starting to Compose</b><br>
|
|---|
| 1777 | When the user presses the first key on a keyboard an input context
|
|---|
| 1778 | is created. This input context will contain a string with the
|
|---|
| 1779 | typed characters.
|
|---|
| 1780 |
|
|---|
| 1781 | \i <b>Composing</b><br>
|
|---|
| 1782 | With every new key pressed, the input method will try to create a
|
|---|
| 1783 | matching string for the text typed so far. While the input context
|
|---|
| 1784 | is active, the user can only move the cursor inside the string
|
|---|
| 1785 | belonging to this input context.
|
|---|
| 1786 |
|
|---|
| 1787 | \i <b>Completing</b><br>
|
|---|
| 1788 | At some point, e.g. when the user presses the Spacebar, they get
|
|---|
| 1789 | to this stage, where they can choose from a number of strings that
|
|---|
| 1790 | match the text they have typed so far. The user can press Enter to
|
|---|
| 1791 | confirm their choice or Escape to cancel the input; in either case
|
|---|
| 1792 | the input context will be closed.
|
|---|
| 1793 | \endlist
|
|---|
| 1794 |
|
|---|
| 1795 | Note that the particular key presses used for a given input
|
|---|
| 1796 | context may differ from those we've mentioned here, i.e. they may
|
|---|
| 1797 | not be Spacebar, Enter and Escape.
|
|---|
| 1798 |
|
|---|
| 1799 | These three stages are represented by three different types of
|
|---|
| 1800 | events. The IMStartEvent, IMComposeEvent and IMEndEvent. When a
|
|---|
| 1801 | new input context is created, an IMStartEvent will be sent to the
|
|---|
| 1802 | widget and delivered to the \l QWidget::imStartEvent() function.
|
|---|
| 1803 | The widget can then update internal data structures to reflect
|
|---|
| 1804 | this.
|
|---|
| 1805 |
|
|---|
| 1806 | After this, an IMComposeEvent will be sent to the widget for
|
|---|
| 1807 | every key the user presses. It will contain the current
|
|---|
| 1808 | composition string the widget has to show and the current cursor
|
|---|
| 1809 | position within the composition string. This string is temporary
|
|---|
| 1810 | and can change with every key the user types, so the widget will
|
|---|
| 1811 | need to store the state before the composition started (the state
|
|---|
| 1812 | it had when it received the IMStartEvent). IMComposeEvents will be
|
|---|
| 1813 | delivered to the \l QWidget::imComposeEvent() function.
|
|---|
| 1814 |
|
|---|
| 1815 | Usually, widgets try to mark the part of the text that is part of
|
|---|
| 1816 | the current composition in a way that is visible to the user. A
|
|---|
| 1817 | commonly used visual cue is to use a dotted underline.
|
|---|
| 1818 |
|
|---|
| 1819 | After the user has selected the final string, an IMEndEvent will
|
|---|
| 1820 | be sent to the widget. The event contains the final string the
|
|---|
| 1821 | user selected, and could be empty if they canceled the
|
|---|
| 1822 | composition. This string should be accepted as the final text the
|
|---|
| 1823 | user entered, and the intermediate composition string should be
|
|---|
| 1824 | cleared. These events are delivered to \l QWidget::imEndEvent().
|
|---|
| 1825 |
|
|---|
| 1826 | If the user clicks another widget, taking the focus out of the
|
|---|
| 1827 | widget where the composition is taking place the IMEndEvent will
|
|---|
| 1828 | be sent and the string it holds will be the result of the
|
|---|
| 1829 | composition up to that point (which may be an empty string).
|
|---|
| 1830 | */
|
|---|
| 1831 |
|
|---|
| 1832 | /*!
|
|---|
| 1833 | \fn QIMEvent::QIMEvent( Type type, const QString &text, int cursorPosition )
|
|---|
| 1834 |
|
|---|
| 1835 | Constructs a new QIMEvent with the accept flag set to FALSE. \a
|
|---|
| 1836 | type can be one of QEvent::IMStartEvent, QEvent::IMComposeEvent
|
|---|
| 1837 | or QEvent::IMEndEvent. \a text contains the current compostion
|
|---|
| 1838 | string and \a cursorPosition the current position of the cursor
|
|---|
| 1839 | inside \a text.
|
|---|
| 1840 | */
|
|---|
| 1841 |
|
|---|
| 1842 | /*!
|
|---|
| 1843 | \fn const QString &QIMEvent::text() const
|
|---|
| 1844 |
|
|---|
| 1845 | Returns the composition text. This is a null string for an
|
|---|
| 1846 | IMStartEvent, and contains the final accepted string (which may be
|
|---|
| 1847 | empty) in the IMEndEvent.
|
|---|
| 1848 | */
|
|---|
| 1849 |
|
|---|
| 1850 | /*!
|
|---|
| 1851 | \fn int QIMEvent::cursorPos() const
|
|---|
| 1852 |
|
|---|
| 1853 | Returns the current cursor position inside the composition string.
|
|---|
| 1854 | Will return 0 for IMStartEvent and IMEndEvent.
|
|---|
| 1855 | */
|
|---|
| 1856 |
|
|---|
| 1857 | /*!
|
|---|
| 1858 | \fn int QIMEvent::selectionLength() const
|
|---|
| 1859 |
|
|---|
| 1860 | Returns the number of characters in the composition string (
|
|---|
| 1861 | starting at cursorPos() ) that should be marked as selected by the
|
|---|
| 1862 | input widget receiving the event.
|
|---|
| 1863 | Will return 0 for IMStartEvent and IMEndEvent.
|
|---|
| 1864 | */
|
|---|
| 1865 |
|
|---|
| 1866 | /*!
|
|---|
| 1867 | \fn bool QIMEvent::isAccepted() const
|
|---|
| 1868 |
|
|---|
| 1869 | Returns TRUE if the receiver of the event processed the event;
|
|---|
| 1870 | otherwise returns FALSE.
|
|---|
| 1871 | */
|
|---|
| 1872 |
|
|---|
| 1873 | /*!
|
|---|
| 1874 | \fn void QIMEvent::accept()
|
|---|
| 1875 |
|
|---|
| 1876 | Sets the accept flag of the input method event object.
|
|---|
| 1877 |
|
|---|
| 1878 | Setting the accept parameter indicates that the receiver of the
|
|---|
| 1879 | event processed the input method event.
|
|---|
| 1880 |
|
|---|
| 1881 | The accept flag is not set by default.
|
|---|
| 1882 |
|
|---|
| 1883 | \sa ignore()
|
|---|
| 1884 | */
|
|---|
| 1885 |
|
|---|
| 1886 |
|
|---|
| 1887 | /*!
|
|---|
| 1888 | \fn void QIMEvent::ignore()
|
|---|
| 1889 |
|
|---|
| 1890 | Clears the accept flag parameter of the input method event object.
|
|---|
| 1891 |
|
|---|
| 1892 | Clearing the accept parameter indicates that the event receiver
|
|---|
| 1893 | does not want the input method event.
|
|---|
| 1894 |
|
|---|
| 1895 | The accept flag is cleared by default.
|
|---|
| 1896 |
|
|---|
| 1897 | \sa accept()
|
|---|
| 1898 | */
|
|---|
| 1899 |
|
|---|
| 1900 | /*!
|
|---|
| 1901 | \class QTabletEvent qevent.h
|
|---|
| 1902 | \brief The QTabletEvent class contains parameters that describe a Tablet
|
|---|
| 1903 | event.
|
|---|
| 1904 |
|
|---|
| 1905 | \ingroup events
|
|---|
| 1906 |
|
|---|
| 1907 | Tablet Events are generated from a Wacom© tablet. Most of
|
|---|
| 1908 | the time you will want to deal with events from the tablet as if
|
|---|
| 1909 | they were events from a mouse, for example retrieving the position
|
|---|
| 1910 | with x(), y(), pos(), globalX(), globalY() and globalPos(). In
|
|---|
| 1911 | some situations you may wish to retrieve the extra information
|
|---|
| 1912 | provided by the tablet device driver, for example, you might want
|
|---|
| 1913 | to adjust color brightness based on pressure. QTabletEvent allows
|
|---|
| 1914 | you to get the pressure(), the xTilt() and yTilt(), as well as the
|
|---|
| 1915 | type of device being used with device() (see \l{TabletDevice}).
|
|---|
| 1916 |
|
|---|
| 1917 | A tablet event contains a special accept flag that indicates
|
|---|
| 1918 | whether the receiver wants the event. You should call
|
|---|
| 1919 | QTabletEvent::accept() if you handle the tablet event; otherwise
|
|---|
| 1920 | it will be sent to the parent widget.
|
|---|
| 1921 |
|
|---|
| 1922 | The QWidget::setEnabled() function can be used to enable or
|
|---|
| 1923 | disable mouse and keyboard events for a widget.
|
|---|
| 1924 |
|
|---|
| 1925 | The event handler QWidget::tabletEvent() receives all three types of tablet
|
|---|
| 1926 | events. Qt will first send a tabletEvent and then, if it is not accepted,
|
|---|
| 1927 | it will send a mouse event. This allows applications that don't utilize
|
|---|
| 1928 | tablets to use a tablet like a mouse while also enabling those who want to
|
|---|
| 1929 | use both tablets and mouses differently.
|
|---|
| 1930 |
|
|---|
| 1931 | */
|
|---|
| 1932 |
|
|---|
| 1933 | /*!
|
|---|
| 1934 | \enum QTabletEvent::TabletDevice
|
|---|
| 1935 |
|
|---|
| 1936 | This enum defines what type of device is generating the event.
|
|---|
| 1937 |
|
|---|
| 1938 | \value NoDevice No device, or an unknown device.
|
|---|
| 1939 | \value Puck A Puck (a device that is similar to a flat mouse with
|
|---|
| 1940 | a transparent circle with cross-hairs).
|
|---|
| 1941 | \value Stylus A Stylus (the narrow end of the pen).
|
|---|
| 1942 | \value Eraser An Eraser (the broad end of the pen).
|
|---|
| 1943 | \omit
|
|---|
| 1944 | \value Menu A menu button was pressed (currently unimplemented).
|
|---|
| 1945 | */
|
|---|
| 1946 |
|
|---|
| 1947 | /*!
|
|---|
| 1948 | \fn QTabletEvent::QTabletEvent( Type t, const QPoint &pos,
|
|---|
| 1949 | const QPoint &globalPos, int device,
|
|---|
| 1950 | int pressure, int xTilt, int yTilt,
|
|---|
| 1951 | const QPair<int,int> &uId )
|
|---|
| 1952 | Construct a tablet event of type \a t. The position of when the event occurred is given
|
|---|
| 1953 | int \a pos and \a globalPos. \a device contains the \link TabletDevice device type\endlink,
|
|---|
| 1954 | \a pressure contains the pressure exerted on the \a device, \a xTilt and \a yTilt contain
|
|---|
| 1955 | \a device's degree of tilt from the X and Y axis respectively. The \a uId contains an
|
|---|
| 1956 | event id.
|
|---|
| 1957 |
|
|---|
| 1958 | On Irix, \a globalPos will contain the high-resolution coordinates received from the
|
|---|
| 1959 | tablet device driver, instead of from the windowing system.
|
|---|
| 1960 |
|
|---|
| 1961 | \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt()
|
|---|
| 1962 | */
|
|---|
| 1963 |
|
|---|
| 1964 | QTabletEvent::QTabletEvent( Type t, const QPoint &pos, const QPoint &globalPos, int device,
|
|---|
| 1965 | int pressure, int xTilt, int yTilt,
|
|---|
| 1966 | const QPair<int, int> &uId )
|
|---|
| 1967 | : QEvent( t ),
|
|---|
| 1968 | mPos( pos ),
|
|---|
| 1969 | mGPos( globalPos ),
|
|---|
| 1970 | mDev( device ),
|
|---|
| 1971 | mPress( pressure ),
|
|---|
| 1972 | mXT( xTilt ),
|
|---|
| 1973 | mYT( yTilt ),
|
|---|
| 1974 | mType( uId.first ),
|
|---|
| 1975 | mPhy( uId.second ),
|
|---|
| 1976 | mbAcc(TRUE)
|
|---|
| 1977 | {}
|
|---|
| 1978 |
|
|---|
| 1979 | /*!
|
|---|
| 1980 | \obsolete
|
|---|
| 1981 | \fn QTabletEvent::QTabletEvent( const QPoint &pos, const QPoint &globalPos, int device, int pressure, int xTilt, int yTilt, const QPair<int,int> &uId )
|
|---|
| 1982 |
|
|---|
| 1983 | Constructs a tablet event object. The position when the event
|
|---|
| 1984 | occurred is is given in \a pos and \a globalPos. \a device
|
|---|
| 1985 | contains the \link TabletDevice device type\endlink, \a pressure
|
|---|
| 1986 | contains the pressure exerted on the \a device, \a xTilt and \a
|
|---|
| 1987 | yTilt contain the \a device's degrees of tilt from the X and Y
|
|---|
| 1988 | axis respectively. The \a uId contains an event id.
|
|---|
| 1989 |
|
|---|
| 1990 | On Irix, \a globalPos will contain the high-resolution coordinates
|
|---|
| 1991 | received from the tablet device driver, instead of from the
|
|---|
| 1992 | windowing system.
|
|---|
| 1993 |
|
|---|
| 1994 | \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt()
|
|---|
| 1995 | */
|
|---|
| 1996 |
|
|---|
| 1997 | /*!
|
|---|
| 1998 | \fn TabletDevices QTabletEvent::device() const
|
|---|
| 1999 |
|
|---|
| 2000 | Returns the type of device that generated the event. Useful if you
|
|---|
| 2001 | want one end of the pen to do something different than the other.
|
|---|
| 2002 |
|
|---|
| 2003 | \sa TabletDevice
|
|---|
| 2004 | */
|
|---|
| 2005 |
|
|---|
| 2006 | /*!
|
|---|
| 2007 | \fn int QTabletEvent::pressure() const
|
|---|
| 2008 |
|
|---|
| 2009 | Returns the pressure that is exerted on the device. This number is
|
|---|
| 2010 | a value from 0 (no pressure) to 255 (maximum pressure). The
|
|---|
| 2011 | pressure is always scaled to be within this range no matter how
|
|---|
| 2012 | many pressure levels the underlying hardware supports.
|
|---|
| 2013 | */
|
|---|
| 2014 |
|
|---|
| 2015 | /*!
|
|---|
| 2016 | \fn int QTabletEvent::xTilt() const
|
|---|
| 2017 |
|
|---|
| 2018 | Returns the difference from the perpendicular in the X Axis.
|
|---|
| 2019 | Positive values are towards the tablet's physical right. The angle
|
|---|
| 2020 | is in the range -60 to +60 degrees.
|
|---|
| 2021 |
|
|---|
| 2022 | \sa yTilt()
|
|---|
| 2023 | */
|
|---|
| 2024 |
|
|---|
| 2025 | /*!
|
|---|
| 2026 | \fn int QTabletEvent::yTilt() const
|
|---|
| 2027 |
|
|---|
| 2028 | Returns the difference from the perpendicular in the Y Axis.
|
|---|
| 2029 | Positive values are towards the bottom of the tablet. The angle is
|
|---|
| 2030 | within the range -60 to +60 degrees.
|
|---|
| 2031 |
|
|---|
| 2032 | \sa xTilt()
|
|---|
| 2033 | */
|
|---|
| 2034 |
|
|---|
| 2035 | /*!
|
|---|
| 2036 | \fn const QPoint &QTabletEvent::pos() const
|
|---|
| 2037 |
|
|---|
| 2038 | Returns the position of the device, relative to the widget that
|
|---|
| 2039 | received the event.
|
|---|
| 2040 |
|
|---|
| 2041 | If you move widgets around in response to mouse events, use
|
|---|
| 2042 | globalPos() instead of this function.
|
|---|
| 2043 |
|
|---|
| 2044 | \sa x(), y(), globalPos()
|
|---|
| 2045 | */
|
|---|
| 2046 |
|
|---|
| 2047 | /*!
|
|---|
| 2048 | \fn int QTabletEvent::x() const
|
|---|
| 2049 |
|
|---|
| 2050 | Returns the x-position of the device, relative to the widget that
|
|---|
| 2051 | received the event.
|
|---|
| 2052 |
|
|---|
| 2053 | \sa y(), pos()
|
|---|
| 2054 | */
|
|---|
| 2055 |
|
|---|
| 2056 | /*!
|
|---|
| 2057 | \fn int QTabletEvent::y() const
|
|---|
| 2058 |
|
|---|
| 2059 | Returns the y-position of the device, relative to the widget that
|
|---|
| 2060 | received the event.
|
|---|
| 2061 |
|
|---|
| 2062 | \sa x(), pos()
|
|---|
| 2063 | */
|
|---|
| 2064 |
|
|---|
| 2065 | /*!
|
|---|
| 2066 | \fn const QPoint &QTabletEvent::globalPos() const
|
|---|
| 2067 |
|
|---|
| 2068 | Returns the global position of the device \e{at the time of the
|
|---|
| 2069 | event}. This is important on asynchronous windows systems like X11;
|
|---|
| 2070 | whenever you move your widgets around in response to mouse events,
|
|---|
| 2071 | globalPos() can differ significantly from the current position
|
|---|
| 2072 | QCursor::pos().
|
|---|
| 2073 |
|
|---|
| 2074 | \sa globalX(), globalY()
|
|---|
| 2075 | */
|
|---|
| 2076 |
|
|---|
| 2077 | /*!
|
|---|
| 2078 | \fn int QTabletEvent::globalX() const
|
|---|
| 2079 |
|
|---|
| 2080 | Returns the global x-position of the mouse pointer at the time of
|
|---|
| 2081 | the event.
|
|---|
| 2082 |
|
|---|
| 2083 | \sa globalY(), globalPos()
|
|---|
| 2084 | */
|
|---|
| 2085 |
|
|---|
| 2086 | /*!
|
|---|
| 2087 | \fn int QTabletEvent::globalY() const
|
|---|
| 2088 |
|
|---|
| 2089 | Returns the global y-position of the mouse pointer at the time of
|
|---|
| 2090 | the event.
|
|---|
| 2091 |
|
|---|
| 2092 | \sa globalX(), globalPos()
|
|---|
| 2093 | */
|
|---|
| 2094 |
|
|---|
| 2095 | /*!
|
|---|
| 2096 | \fn bool QTabletEvent::isAccepted() const
|
|---|
| 2097 |
|
|---|
| 2098 | Returns TRUE if the receiver of the event handles the tablet
|
|---|
| 2099 | event; otherwise returns FALSE.
|
|---|
| 2100 | */
|
|---|
| 2101 |
|
|---|
| 2102 | /*!
|
|---|
| 2103 | \fn void QTabletEvent::accept()
|
|---|
| 2104 |
|
|---|
| 2105 | Sets the accept flag of the tablet event object.
|
|---|
| 2106 |
|
|---|
| 2107 | Setting the accept flag indicates that the receiver of the event
|
|---|
| 2108 | wants the tablet event. Unwanted tablet events are sent to the
|
|---|
| 2109 | parent widget.
|
|---|
| 2110 |
|
|---|
| 2111 | The accept flag is set by default.
|
|---|
| 2112 |
|
|---|
| 2113 | \sa ignore()
|
|---|
| 2114 | */
|
|---|
| 2115 |
|
|---|
| 2116 | /*!
|
|---|
| 2117 | \fn void QTabletEvent::ignore()
|
|---|
| 2118 |
|
|---|
| 2119 | Clears the accept flag parameter of the tablet event object.
|
|---|
| 2120 |
|
|---|
| 2121 | Clearing the accept flag indicates that the event receiver does
|
|---|
| 2122 | not want the tablet event. Unwanted tablet events are sent to the
|
|---|
| 2123 | parent widget.
|
|---|
| 2124 |
|
|---|
| 2125 | The accept flag is set by default.
|
|---|
| 2126 |
|
|---|
| 2127 | \sa accept()
|
|---|
| 2128 | */
|
|---|
| 2129 |
|
|---|
| 2130 | /*!
|
|---|
| 2131 | \fn QPair<int, int> QTabletEvent::uniqueId()
|
|---|
| 2132 |
|
|---|
| 2133 | Returns a unique ID for the current device. It is possible to
|
|---|
| 2134 | generate a unique ID for any Wacom© device. This makes it
|
|---|
| 2135 | possible to differentiate between multiple devices being used at
|
|---|
| 2136 | the same time on the tablet. The \c first member contains a value
|
|---|
| 2137 | for the type, the \c second member contains a physical ID obtained
|
|---|
| 2138 | from the device. Each combination of these values is unique. Note:
|
|---|
| 2139 | for different platforms, the \c first value is different due to
|
|---|
| 2140 | different driver implementations.
|
|---|
| 2141 | */
|
|---|
| 2142 |
|
|---|
| 2143 | /*!
|
|---|
| 2144 | \class QChildEvent qevent.h
|
|---|
| 2145 | \brief The QChildEvent class contains event parameters for child object
|
|---|
| 2146 | events.
|
|---|
| 2147 |
|
|---|
| 2148 | \ingroup events
|
|---|
| 2149 |
|
|---|
| 2150 | Child events are sent to objects when children are inserted or
|
|---|
| 2151 | removed.
|
|---|
| 2152 |
|
|---|
| 2153 | A \c ChildRemoved event is sent immediately, but a \c
|
|---|
| 2154 | ChildInserted event is \e posted (with QApplication::postEvent()).
|
|---|
| 2155 |
|
|---|
| 2156 | Note that if a child is removed immediately after it is inserted,
|
|---|
| 2157 | the \c ChildInserted event may be suppressed, but the \c
|
|---|
| 2158 | ChildRemoved event will always be sent. In this case there will be
|
|---|
| 2159 | a \c ChildRemoved event without a corresponding \c ChildInserted
|
|---|
| 2160 | event.
|
|---|
| 2161 |
|
|---|
| 2162 | The handler for these events is QObject::childEvent().
|
|---|
| 2163 | */
|
|---|
| 2164 |
|
|---|
| 2165 | /*!
|
|---|
| 2166 | \fn QChildEvent::QChildEvent( Type type, QObject *child )
|
|---|
| 2167 |
|
|---|
| 2168 | Constructs a child event object. The \a child is the object that
|
|---|
| 2169 | is to be removed or inserted.
|
|---|
| 2170 |
|
|---|
| 2171 | The \a type parameter must be either \c QEvent::ChildInserted or
|
|---|
| 2172 | \c QEvent::ChildRemoved.
|
|---|
| 2173 | */
|
|---|
| 2174 |
|
|---|
| 2175 | /*!
|
|---|
| 2176 | \fn QObject *QChildEvent::child() const
|
|---|
| 2177 |
|
|---|
| 2178 | Returns the child widget that was inserted or removed.
|
|---|
| 2179 | */
|
|---|
| 2180 |
|
|---|
| 2181 | /*!
|
|---|
| 2182 | \fn bool QChildEvent::inserted() const
|
|---|
| 2183 |
|
|---|
| 2184 | Returns TRUE if the widget received a new child; otherwise returns
|
|---|
| 2185 | FALSE.
|
|---|
| 2186 | */
|
|---|
| 2187 |
|
|---|
| 2188 | /*!
|
|---|
| 2189 | \fn bool QChildEvent::removed() const
|
|---|
| 2190 |
|
|---|
| 2191 | Returns TRUE if the object lost a child; otherwise returns FALSE.
|
|---|
| 2192 | */
|
|---|
| 2193 |
|
|---|
| 2194 |
|
|---|
| 2195 |
|
|---|
| 2196 |
|
|---|
| 2197 | /*!
|
|---|
| 2198 | \class QCustomEvent qevent.h
|
|---|
| 2199 | \brief The QCustomEvent class provides support for custom events.
|
|---|
| 2200 |
|
|---|
| 2201 | \ingroup events
|
|---|
| 2202 |
|
|---|
| 2203 | QCustomEvent is a generic event class for user-defined events.
|
|---|
| 2204 | User defined events can be sent to widgets or other QObject
|
|---|
| 2205 | instances using QApplication::postEvent() or
|
|---|
| 2206 | QApplication::sendEvent(). Subclasses of QObject can easily
|
|---|
| 2207 | receive custom events by implementing the QObject::customEvent()
|
|---|
| 2208 | event handler function.
|
|---|
| 2209 |
|
|---|
| 2210 | QCustomEvent objects should be created with a type ID that
|
|---|
| 2211 | uniquely identifies the event type. To avoid clashes with the
|
|---|
| 2212 | Qt-defined events types, the value should be at least as large as
|
|---|
| 2213 | the value of the "User" entry in the QEvent::Type enum.
|
|---|
| 2214 |
|
|---|
| 2215 | QCustomEvent contains a generic void* data member that may be used
|
|---|
| 2216 | for transferring event-specific data to the receiver. Note that
|
|---|
| 2217 | since events are normally delivered asynchronously, the data
|
|---|
| 2218 | pointer, if used, must remain valid until the event has been
|
|---|
| 2219 | received and processed.
|
|---|
| 2220 |
|
|---|
| 2221 | QCustomEvent can be used as-is for simple user-defined event
|
|---|
| 2222 | types, but normally you will want to make a subclass of it for
|
|---|
| 2223 | your event types. In a subclass, you can add data members that are
|
|---|
| 2224 | suitable for your event type.
|
|---|
| 2225 |
|
|---|
| 2226 | Example:
|
|---|
| 2227 | \code
|
|---|
| 2228 | class ColorChangeEvent : public QCustomEvent
|
|---|
| 2229 | {
|
|---|
| 2230 | public:
|
|---|
| 2231 | ColorChangeEvent( QColor color )
|
|---|
| 2232 | : QCustomEvent( 65432 ), c( color ) {}
|
|---|
| 2233 | QColor color() const { return c; }
|
|---|
| 2234 | private:
|
|---|
| 2235 | QColor c;
|
|---|
| 2236 | };
|
|---|
| 2237 |
|
|---|
| 2238 | // To send an event of this custom event type:
|
|---|
| 2239 |
|
|---|
| 2240 | ColorChangeEvent* ce = new ColorChangeEvent( blue );
|
|---|
| 2241 | QApplication::postEvent( receiver, ce ); // Qt will delete it when done
|
|---|
| 2242 |
|
|---|
| 2243 | // To receive an event of this custom event type:
|
|---|
| 2244 |
|
|---|
| 2245 | void MyWidget::customEvent( QCustomEvent * e )
|
|---|
| 2246 | {
|
|---|
| 2247 | if ( e->type() == 65432 ) { // It must be a ColorChangeEvent
|
|---|
| 2248 | ColorChangeEvent* ce = (ColorChangeEvent*)e;
|
|---|
| 2249 | newColor = ce->color();
|
|---|
| 2250 | }
|
|---|
| 2251 | }
|
|---|
| 2252 | \endcode
|
|---|
| 2253 |
|
|---|
| 2254 | \sa QWidget::customEvent(), QApplication::notify()
|
|---|
| 2255 | */
|
|---|
| 2256 |
|
|---|
| 2257 |
|
|---|
| 2258 | /*!
|
|---|
| 2259 | Constructs a custom event object with event type \a type. The
|
|---|
| 2260 | value of \a type must be at least as large as QEvent::User. The
|
|---|
| 2261 | data pointer is set to 0.
|
|---|
| 2262 | */
|
|---|
| 2263 |
|
|---|
| 2264 | QCustomEvent::QCustomEvent( int type )
|
|---|
| 2265 | : QEvent( (QEvent::Type)type ), d( 0 )
|
|---|
| 2266 | {
|
|---|
| 2267 | }
|
|---|
| 2268 |
|
|---|
| 2269 |
|
|---|
| 2270 | /*!
|
|---|
| 2271 | \fn QCustomEvent::QCustomEvent( Type type, void *data )
|
|---|
| 2272 |
|
|---|
| 2273 | Constructs a custom event object with the event type \a type and a
|
|---|
| 2274 | pointer to \a data. (Note that any int value may safely be cast to
|
|---|
| 2275 | QEvent::Type).
|
|---|
| 2276 | */
|
|---|
| 2277 |
|
|---|
| 2278 |
|
|---|
| 2279 | /*!
|
|---|
| 2280 | \fn void QCustomEvent::setData( void* data )
|
|---|
| 2281 |
|
|---|
| 2282 | Sets the generic data pointer to \a data.
|
|---|
| 2283 |
|
|---|
| 2284 | \sa data()
|
|---|
| 2285 | */
|
|---|
| 2286 |
|
|---|
| 2287 | /*!
|
|---|
| 2288 | \fn void *QCustomEvent::data() const
|
|---|
| 2289 |
|
|---|
| 2290 | Returns a pointer to the generic event data.
|
|---|
| 2291 |
|
|---|
| 2292 | \sa setData()
|
|---|
| 2293 | */
|
|---|
| 2294 |
|
|---|
| 2295 |
|
|---|
| 2296 |
|
|---|
| 2297 | /*!
|
|---|
| 2298 | \fn QDragMoveEvent::QDragMoveEvent( const QPoint& pos, Type type )
|
|---|
| 2299 |
|
|---|
| 2300 | Creates a QDragMoveEvent for which the mouse is at point \a pos,
|
|---|
| 2301 | and the event is of type \a type.
|
|---|
| 2302 |
|
|---|
| 2303 | \warning Do not create a QDragMoveEvent yourself since these
|
|---|
| 2304 | objects rely on Qt's internal state.
|
|---|
| 2305 | */
|
|---|
| 2306 |
|
|---|
| 2307 | /*!
|
|---|
| 2308 | \fn void QDragMoveEvent::accept( const QRect & r )
|
|---|
| 2309 |
|
|---|
| 2310 | The same as accept(), but also notifies that future moves will
|
|---|
| 2311 | also be acceptable if they remain within the rectangle \a r on the
|
|---|
| 2312 | widget: this can improve performance, but may also be ignored by
|
|---|
| 2313 | the underlying system.
|
|---|
| 2314 |
|
|---|
| 2315 | If the rectangle is \link QRect::isEmpty() empty\endlink, then
|
|---|
| 2316 | drag move events will be sent continuously. This is useful if the
|
|---|
| 2317 | source is scrolling in a timer event.
|
|---|
| 2318 | */
|
|---|
| 2319 |
|
|---|
| 2320 | /*!
|
|---|
| 2321 | \fn void QDragMoveEvent::ignore( const QRect & r)
|
|---|
| 2322 |
|
|---|
| 2323 | The opposite of accept(const QRect&), i.e. says that moves within
|
|---|
| 2324 | rectangle \a r are not acceptable (will be ignored).
|
|---|
| 2325 | */
|
|---|
| 2326 |
|
|---|
| 2327 | /*!
|
|---|
| 2328 | \fn QRect QDragMoveEvent::answerRect() const
|
|---|
| 2329 |
|
|---|
| 2330 | Returns the rectangle for which the acceptance of the move event
|
|---|
| 2331 | applies.
|
|---|
| 2332 | */
|
|---|
| 2333 |
|
|---|
| 2334 |
|
|---|
| 2335 |
|
|---|
| 2336 | /*!
|
|---|
| 2337 | \fn const QPoint& QDropEvent::pos() const
|
|---|
| 2338 |
|
|---|
| 2339 | Returns the position where the drop was made.
|
|---|
| 2340 | */
|
|---|
| 2341 |
|
|---|
| 2342 | /*!
|
|---|
| 2343 | \fn bool QDropEvent::isAccepted () const
|
|---|
| 2344 |
|
|---|
| 2345 | Returns TRUE if the drop target accepts the event; otherwise
|
|---|
| 2346 | returns FALSE.
|
|---|
| 2347 | */
|
|---|
| 2348 |
|
|---|
| 2349 | /*!
|
|---|
| 2350 | \fn void QDropEvent::accept(bool y=TRUE)
|
|---|
| 2351 |
|
|---|
| 2352 | Call this function to indicate whether the event provided data
|
|---|
| 2353 | which your widget processed. Set \a y to TRUE (the default) if
|
|---|
| 2354 | your widget could process the data, otherwise set \a y to FALSE.
|
|---|
| 2355 | To get the data, use encodedData(), or preferably, the decode()
|
|---|
| 2356 | methods of existing QDragObject subclasses, such as
|
|---|
| 2357 | QTextDrag::decode(), or your own subclasses.
|
|---|
| 2358 |
|
|---|
| 2359 | \sa acceptAction()
|
|---|
| 2360 | */
|
|---|
| 2361 |
|
|---|
| 2362 | /*!
|
|---|
| 2363 | \fn void QDropEvent::acceptAction(bool y=TRUE)
|
|---|
| 2364 |
|
|---|
| 2365 | Call this to indicate that the action described by action() is
|
|---|
| 2366 | accepted (i.e. if \a y is TRUE, which is the default), not merely
|
|---|
| 2367 | the default copy action. If you call acceptAction(TRUE), there is
|
|---|
| 2368 | no need to also call accept(TRUE).
|
|---|
| 2369 | */
|
|---|
| 2370 |
|
|---|
| 2371 | /*!
|
|---|
| 2372 | \fn void QDragMoveEvent::accept( bool y )
|
|---|
| 2373 | \reimp
|
|---|
| 2374 | \internal
|
|---|
| 2375 | Remove in 3.0
|
|---|
| 2376 | */
|
|---|
| 2377 |
|
|---|
| 2378 | /*!
|
|---|
| 2379 | \fn void QDragMoveEvent::ignore()
|
|---|
| 2380 | \reimp
|
|---|
| 2381 | \internal
|
|---|
| 2382 | Remove in 3.0
|
|---|
| 2383 | */
|
|---|
| 2384 |
|
|---|
| 2385 |
|
|---|
| 2386 | /*!
|
|---|
| 2387 | \enum QDropEvent::Action
|
|---|
| 2388 |
|
|---|
| 2389 | This enum describes the action which a source requests that a
|
|---|
| 2390 | target perform with dropped data.
|
|---|
| 2391 |
|
|---|
| 2392 | \value Copy The default action. The source simply uses the data
|
|---|
| 2393 | provided in the operation.
|
|---|
| 2394 | \value Link The source should somehow create a link to the
|
|---|
| 2395 | location specified by the data.
|
|---|
| 2396 | \value Move The source should somehow move the object from the
|
|---|
| 2397 | location specified by the data to a new location.
|
|---|
| 2398 | \value Private The target has special knowledge of the MIME type,
|
|---|
| 2399 | which the source should respond to in a similar way to
|
|---|
| 2400 | a Copy.
|
|---|
| 2401 | \value UserAction The source and target can co-operate using
|
|---|
| 2402 | special actions. This feature is not currently
|
|---|
| 2403 | supported.
|
|---|
| 2404 |
|
|---|
| 2405 | The Link and Move actions only makes sense if the data is a
|
|---|
| 2406 | reference, for example, text/uri-list file lists (see QUriDrag).
|
|---|
| 2407 | */
|
|---|
| 2408 |
|
|---|
| 2409 | /*!
|
|---|
| 2410 | \fn void QDropEvent::setAction( Action a )
|
|---|
| 2411 |
|
|---|
| 2412 | Sets the action to \a a. This is used internally, you should not
|
|---|
| 2413 | need to call this in your code: the \e source decides the action,
|
|---|
| 2414 | not the target.
|
|---|
| 2415 | */
|
|---|
| 2416 |
|
|---|
| 2417 | /*!
|
|---|
| 2418 | \fn Action QDropEvent::action() const
|
|---|
| 2419 |
|
|---|
| 2420 | Returns the Action which the target is requesting to be performed
|
|---|
| 2421 | with the data. If your application understands the action and can
|
|---|
| 2422 | process the supplied data, call acceptAction(); if your
|
|---|
| 2423 | application can process the supplied data but can only perform the
|
|---|
| 2424 | Copy action, call accept().
|
|---|
| 2425 | */
|
|---|
| 2426 |
|
|---|
| 2427 | /*!
|
|---|
| 2428 | \fn void QDropEvent::ignore()
|
|---|
| 2429 |
|
|---|
| 2430 | The opposite of accept(), i.e. you have ignored the drop event.
|
|---|
| 2431 | */
|
|---|
| 2432 |
|
|---|
| 2433 | /*!
|
|---|
| 2434 | \fn bool QDropEvent::isActionAccepted () const
|
|---|
| 2435 |
|
|---|
| 2436 | Returns TRUE if the drop action was accepted by the drop site;
|
|---|
| 2437 | otherwise returns FALSE.
|
|---|
| 2438 | */
|
|---|
| 2439 |
|
|---|
| 2440 |
|
|---|
| 2441 | /*!
|
|---|
| 2442 | \fn void QDropEvent::setPoint (const QPoint & np)
|
|---|
| 2443 |
|
|---|
| 2444 | Sets the drop to happen at point \a np. You do not normally need
|
|---|
| 2445 | to use this as it will be set internally before your widget
|
|---|
| 2446 | receives the drop event.
|
|---|
| 2447 | */ // ### here too - what coordinate system?
|
|---|
| 2448 |
|
|---|
| 2449 |
|
|---|
| 2450 | /*!
|
|---|
| 2451 | \class QDragEnterEvent qevent.h
|
|---|
| 2452 | \brief The QDragEnterEvent class provides an event which is sent to the widget when a drag and drop first drags onto the widget.
|
|---|
| 2453 |
|
|---|
| 2454 | \ingroup events
|
|---|
| 2455 | \ingroup draganddrop
|
|---|
| 2456 |
|
|---|
| 2457 | This event is always immediately followed by a QDragMoveEvent, so
|
|---|
| 2458 | you only need to respond to one or the other event. This class
|
|---|
| 2459 | inherits most of its functionality from QDragMoveEvent, which in
|
|---|
| 2460 | turn inherits most of its functionality from QDropEvent.
|
|---|
| 2461 |
|
|---|
| 2462 | \sa QDragLeaveEvent, QDragMoveEvent, QDropEvent
|
|---|
| 2463 | */
|
|---|
| 2464 |
|
|---|
| 2465 | /*!
|
|---|
| 2466 | \fn QDragEnterEvent::QDragEnterEvent (const QPoint & pos)
|
|---|
| 2467 |
|
|---|
| 2468 | Constructs a QDragEnterEvent entering at the given point, \a pos.
|
|---|
| 2469 |
|
|---|
| 2470 | \warning Do not create a QDragEnterEvent yourself since these
|
|---|
| 2471 | objects rely on Qt's internal state.
|
|---|
| 2472 | */
|
|---|
| 2473 |
|
|---|
| 2474 | /*!
|
|---|
| 2475 | \class QDragLeaveEvent qevent.h
|
|---|
| 2476 | \brief The QDragLeaveEvent class provides an event which is sent to the widget when a drag and drop leaves the widget.
|
|---|
| 2477 |
|
|---|
| 2478 | \ingroup events
|
|---|
| 2479 | \ingroup draganddrop
|
|---|
| 2480 |
|
|---|
| 2481 | This event is always preceded by a QDragEnterEvent and a series of
|
|---|
| 2482 | \l{QDragMoveEvent}s. It is not sent if a QDropEvent is sent
|
|---|
| 2483 | instead.
|
|---|
| 2484 |
|
|---|
| 2485 | \sa QDragEnterEvent, QDragMoveEvent, QDropEvent
|
|---|
| 2486 | */
|
|---|
| 2487 |
|
|---|
| 2488 | /*!
|
|---|
| 2489 | \fn QDragLeaveEvent::QDragLeaveEvent()
|
|---|
| 2490 |
|
|---|
| 2491 | Constructs a QDragLeaveEvent.
|
|---|
| 2492 |
|
|---|
| 2493 | \warning Do not create a QDragLeaveEvent yourself since these
|
|---|
| 2494 | objects rely on Qt's internal state.
|
|---|
| 2495 | */
|
|---|
| 2496 |
|
|---|
| 2497 | /*!
|
|---|
| 2498 | \class QHideEvent qevent.h
|
|---|
| 2499 | \brief The QHideEvent class provides an event which is sent after a widget is hidden.
|
|---|
| 2500 |
|
|---|
| 2501 | \ingroup events
|
|---|
| 2502 |
|
|---|
| 2503 | This event is sent just before QWidget::hide() returns, and also
|
|---|
| 2504 | when a top-level window has been hidden (iconified) by the user.
|
|---|
| 2505 |
|
|---|
| 2506 | If spontaneous() is TRUE the event originated outside the
|
|---|
| 2507 | application, i.e. the user hid the window using the window manager
|
|---|
| 2508 | controls, either by iconifying the window or by switching to
|
|---|
| 2509 | another virtual desktop where the window isn't visible. The window
|
|---|
| 2510 | will become hidden but not withdrawn. If the window was iconified,
|
|---|
| 2511 | QWidget::isMinimized() returns TRUE.
|
|---|
| 2512 |
|
|---|
| 2513 | \sa QShowEvent
|
|---|
| 2514 | */
|
|---|
| 2515 |
|
|---|
| 2516 | /*!
|
|---|
| 2517 | \fn QHideEvent::QHideEvent()
|
|---|
| 2518 |
|
|---|
| 2519 | Constructs a QHideEvent.
|
|---|
| 2520 | */
|
|---|
| 2521 |
|
|---|
| 2522 | /*!
|
|---|
| 2523 | \class QShowEvent qevent.h
|
|---|
| 2524 | \brief The QShowEvent class provides an event which is sent when a widget is shown.
|
|---|
| 2525 |
|
|---|
| 2526 | \ingroup events
|
|---|
| 2527 |
|
|---|
| 2528 | There are two kinds of show events: show events caused by the
|
|---|
| 2529 | window system (spontaneous) and internal show events. Spontaneous
|
|---|
| 2530 | show events are sent just after the window system shows the
|
|---|
| 2531 | window, including after a top-level window has been shown
|
|---|
| 2532 | (un-iconified) by the user. Internal show events are delivered
|
|---|
| 2533 | just before the widget becomes visible.
|
|---|
| 2534 |
|
|---|
| 2535 | \sa QHideEvent
|
|---|
| 2536 | */
|
|---|
| 2537 |
|
|---|
| 2538 | /*!
|
|---|
| 2539 | \fn QShowEvent::QShowEvent()
|
|---|
| 2540 |
|
|---|
| 2541 | Constructs a QShowEvent.
|
|---|
| 2542 | */
|
|---|
| 2543 |
|
|---|
| 2544 |
|
|---|
| 2545 | /*!
|
|---|
| 2546 | \fn QByteArray QDropEvent::data(const char* f) const
|
|---|
| 2547 |
|
|---|
| 2548 | \obsolete
|
|---|
| 2549 |
|
|---|
| 2550 | Use QDropEvent::encodedData().
|
|---|
| 2551 | */
|
|---|
| 2552 |
|
|---|
| 2553 |
|
|---|
| 2554 | /*!
|
|---|
| 2555 | Destroys the event. If it was \link
|
|---|
| 2556 | QApplication::postEvent() posted \endlink,
|
|---|
| 2557 | it will be removed from the list of events to be posted.
|
|---|
| 2558 | */
|
|---|
| 2559 |
|
|---|
| 2560 | QEvent::~QEvent()
|
|---|
| 2561 | {
|
|---|
| 2562 | if ( posted && qApp )
|
|---|
| 2563 | QApplication::removePostedEvent( this );
|
|---|
| 2564 | }
|
|---|