Qt 4.8
qevent.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qevent.h"
43 #include "qcursor.h"
44 #include "qapplication.h"
45 #include "private/qapplication_p.h"
46 #include "private/qevent_p.h"
47 #include "private/qkeysequence_p.h"
48 #include "qwidget.h"
49 #include "qgraphicsview.h"
50 #include "qdebug.h"
51 #include "qmime.h"
52 #include "qdnd_p.h"
53 #include "qevent_p.h"
54 #include "qgesture.h"
55 #include "qgesture_p.h"
56 
57 #ifdef Q_OS_SYMBIAN
58 #include "private/qcore_symbian_p.h"
59 #endif
60 
62 
77 QInputEvent::QInputEvent(Type type, Qt::KeyboardModifiers modifiers)
78  : QEvent(type), modState(modifiers)
79 {}
80 
85 {
86 }
87 
181  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
182  : QInputEvent(type, modifiers), p(position), b(button), mouseState(buttons)
183 {
184  g = QCursor::pos();
185 }
186 
191 {
192 }
193 
194 #ifdef QT3_SUPPORT
195 
201 QMouseEvent::QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state)
203 {
204  g = QCursor::pos();
205  mouseState = Qt::MouseButtons((state ^ b) & Qt::MouseButtonMask);
206  modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask);
207 }
208 
216  Qt::ButtonState button, int state)
217  : QInputEvent(type), p(pos), g(globalPos), b((Qt::MouseButton)button)
218 {
219  mouseState = Qt::MouseButtons((state ^ b) & Qt::MouseButtonMask);
220  modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask);
221 }
222 #endif
223 
224 
242 QMouseEvent::QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
243  Qt::MouseButton button, Qt::MouseButtons buttons,
244  Qt::KeyboardModifiers modifiers)
245  : QInputEvent(type, modifiers), p(pos), g(globalPos), b(button), mouseState(buttons)
246 {}
247 
252  const QPoint &globalPos, Qt::MouseButton button,
253  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
254 {
255  return new QMouseEventEx(type, pos, globalPos, button, buttons, modifiers);
256 }
257 
279 {
280  return hasExtendedInfo() ? reinterpret_cast<const QMouseEventEx *>(this)->posF : QPointF(pos());
281 }
282 
286 QMouseEventEx::QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos,
287  Qt::MouseButton button, Qt::MouseButtons buttons,
288  Qt::KeyboardModifiers modifiers)
289  : QMouseEvent(type, pos.toPoint(), globalPos, button, buttons, modifiers), posF(pos)
290 {
291  d = reinterpret_cast<QEventPrivate *>(this);
292 }
293 
298 {
299 }
300 
531 QHoverEvent::QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos)
532  : QEvent(type), p(pos), op(oldPos)
533 {
534 }
535 
540 {
541 }
542 
543 
606 #ifndef QT_NO_WHEELEVENT
607 QWheelEvent::QWheelEvent(const QPoint &pos, int delta,
608  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
609  Qt::Orientation orient)
610  : QInputEvent(Wheel, modifiers), p(pos), d(delta), mouseState(buttons), o(orient)
611 {
612  g = QCursor::pos();
613 }
614 
619 {
620 }
621 
622 #ifdef QT3_SUPPORT
623 
626 QWheelEvent::QWheelEvent(const QPoint &pos, int delta, int state, Qt::Orientation orient)
627  : QInputEvent(Wheel), p(pos), d(delta), o(orient)
628 {
629  g = QCursor::pos();
630  mouseState = Qt::MouseButtons(state & Qt::MouseButtonMask);
631  modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask);
632 }
633 #endif
634 
646 QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
647  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
648  Qt::Orientation orient)
649  : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), d(delta), mouseState(buttons), o(orient)
650 {}
651 
652 #ifdef QT3_SUPPORT
653 
656 QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
657  Qt::Orientation orient)
658  : QInputEvent(Wheel), p(pos), g(globalPos), d(delta), o(orient)
659 {
660  mouseState = Qt::MouseButtons(state & Qt::MouseButtonMask);
661  modState = Qt::KeyboardModifiers(state & (int) Qt::KeyButtonMask);
662 }
663 #endif
664 #endif // QT_NO_WHEELEVENT
665 
826 QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,
827  bool autorep, ushort count)
828  : QInputEvent(type, modifiers), txt(text), k(key), c(count), autor(autorep)
829 {
830 }
831 
836 {
837 }
838 
845  const QString& text, bool autorep, ushort count)
846 {
847  return new QKeyEventEx(type, key, modifiers, text, autorep, count,
848  nativeScanCode, nativeVirtualKey, nativeModifiers);
849 }
850 
873 {
874  return (reinterpret_cast<const QKeyEvent*>(d) != this
875  ? 0 : reinterpret_cast<const QKeyEventEx*>(this)->nScanCode);
876 }
877 
890 {
891  return (reinterpret_cast<const QKeyEvent*>(d) != this
892  ? 0 : reinterpret_cast<const QKeyEventEx*>(this)->nVirtualKey);
893 }
894 
907 {
908  return (reinterpret_cast<const QKeyEvent*>(d) != this
909  ? 0 : reinterpret_cast<const QKeyEventEx*>(this)->nModifiers);
910 }
911 
921 QKeyEventEx::QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers,
922  const QString &text, bool autorep, ushort count,
924  : QKeyEvent(type, key, modifiers, text, autorep, count),
925  nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers)
926 {
927  d = reinterpret_cast<QEventPrivate*>(this);
928 }
929 
938  : QKeyEvent(QEvent::Type(other.t), other.k, other.modState, other.txt, other.autor, other.c),
940 {
941  d = reinterpret_cast<QEventPrivate*>(this);
942 }
943 
948 {
949 }
950 
998 //###### We must check with XGetModifierMapping
999 Qt::KeyboardModifiers QKeyEvent::modifiers() const
1000 {
1001  if (key() == Qt::Key_Shift)
1002  return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
1003  if (key() == Qt::Key_Control)
1004  return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
1005  if (key() == Qt::Key_Alt)
1006  return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
1007  if (key() == Qt::Key_Meta)
1008  return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
1009  return QInputEvent::modifiers();
1010 }
1011 
1012 #ifndef QT_NO_SHORTCUT
1013 
1024 {
1025  uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
1027 
1028 #ifdef Q_WS_MAC
1029  if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
1030  uint oldSearchKey = searchkey;
1031  searchkey &= ~(Qt::ControlModifier | Qt::MetaModifier);
1032  if (oldSearchKey & Qt::ControlModifier)
1033  searchkey |= Qt::MetaModifier;
1034  if (oldSearchKey & Qt::MetaModifier)
1035  searchkey |= Qt::ControlModifier;
1036  }
1037 #endif
1038 
1040  int first = 0;
1041  int last = N - 1;
1042 
1043  while (first <= last) {
1044  int mid = (first + last) / 2;
1046 
1047  if (searchkey > midVal.shortcut){
1048  first = mid + 1; // Search in top half
1049  }
1050  else if (searchkey < midVal.shortcut){
1051  last = mid - 1; // Search in bottom half
1052  }
1053  else {
1054  //found correct shortcut value, now we must check for platform match
1055  if ((midVal.platform & platform) && (midVal.standardKey == matchKey)) {
1056  return true;
1057  } else { //We may have several equal values for different platforms, so we must search in both directions
1058 
1059  //search forward
1060  for ( unsigned int i = mid + 1 ; i < N - 1 ; ++i) {
1062  if (current.shortcut != searchkey)
1063  break;
1064  else if (current.platform & platform && current.standardKey == matchKey)
1065  return true;
1066  }
1067 
1068  //search back
1069  for ( int i = mid - 1 ; i >= 0 ; --i) {
1071  if (current.shortcut != searchkey)
1072  break;
1073  else if (current.platform & platform && current.standardKey == matchKey)
1074  return true;
1075  }
1076  return false; //we could not find it among the matching keySequences
1077  }
1078  }
1079  }
1080  return false; //we could not find matching keySequences at all
1081 }
1082 #endif // QT_NO_SHORTCUT
1083 
1084 
1111 #ifdef QT3_SUPPORT
1112 
1149 #endif
1150 
1183  : QEvent(type), m_reason(reason)
1184 {}
1185 
1190 {
1191 }
1192 
1193 // ### Qt 5: remove
1198 {
1199  return m_reason;
1200 }
1201 
1206 {
1207  return m_reason;
1208 }
1209 
1230 #ifdef QT3_SUPPORT
1231 
1249 #endif
1250 
1312  : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(false)
1313 {}
1314 
1320  : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(false)
1321 {}
1322 
1323 
1324 #ifdef QT3_SUPPORT
1325 
1331 QPaintEvent::QPaintEvent(const QRegion &paintRegion, const QRect &paintRect)
1332  : QEvent(Paint), m_rect(paintRect), m_region(paintRegion), m_erased(false)
1333 {}
1334 #endif
1335 
1340 {
1341 }
1342 
1367  : QEvent(UpdateLater), m_region(paintRegion)
1368 {
1369 }
1370 
1372 {
1373 }
1374 
1396 QMoveEvent::QMoveEvent(const QPoint &pos, const QPoint &oldPos)
1397  : QEvent(Move), p(pos), oldp(oldPos)
1398 {}
1399 
1404 {
1405 }
1406 
1447 QResizeEvent::QResizeEvent(const QSize &size, const QSize &oldSize)
1448  : QEvent(Resize), s(size), olds(oldSize)
1449 {}
1450 
1455 {
1456 }
1457 
1535  : QEvent(Close)
1536 {}
1537 
1541 {
1542 }
1543 
1570  : QEvent(IconDrag)
1571 { ignore(); }
1572 
1575 {
1576 }
1577 
1602 #ifndef QT_NO_CONTEXTMENU
1603 
1614 QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos)
1615  : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason)
1616 {}
1617 
1630  Qt::KeyboardModifiers modifiers)
1631  : QInputEvent(ContextMenu, modifiers), p(pos), gp(globalPos), reas(reason)
1632 {}
1633 
1634 #ifdef QT3_SUPPORT
1635 
1640 QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
1641  int /* dummy */)
1642  : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason)
1643 {}
1644 #endif
1645 
1648 {
1649 }
1665  : QInputEvent(ContextMenu), p(pos), reas(reason)
1666 {
1667  gp = QCursor::pos();
1668 }
1669 
1670 #ifdef QT3_SUPPORT
1671 
1676 QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, int /* dummy */)
1677  : QInputEvent(ContextMenu), p(pos), reas(reason)
1678 {
1679  gp = QCursor::pos();
1680 }
1681 
1682 Qt::ButtonState QContextMenuEvent::state() const
1683 {
1684  return Qt::ButtonState(int(QApplication::keyboardModifiers())|QApplication::mouseButtons());
1685 }
1686 #endif
1687 
1759 #endif // QT_NO_CONTEXTMENU
1760 
1997  : QEvent(QEvent::InputMethod), replace_from(0), replace_length(0)
1998 {
1999 }
2000 
2012  : QEvent(QEvent::InputMethod), preedit(preeditText), attrs(attributes),
2014 {
2015 }
2016 
2021  : QEvent(QEvent::InputMethod), preedit(other.preedit), attrs(other.attrs),
2023 {
2024 }
2025 
2042 void QInputMethodEvent::setCommitString(const QString &commitString, int replaceFrom, int replaceLength)
2043 {
2044  commit = commitString;
2045  replace_from = replaceFrom;
2046  replace_length = replaceLength;
2047 }
2048 
2113 #ifndef QT_NO_TABLETEVENT
2114 
2228 QTabletEvent::QTabletEvent(Type type, const QPoint &pos, const QPoint &globalPos,
2229  const QPointF &hiResGlobalPos, int device, int pointerType,
2230  qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
2231  qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
2232  : QInputEvent(type, keyState),
2233  mPos(pos),
2234  mGPos(globalPos),
2235  mHiResGlobalPos(hiResGlobalPos),
2236  mDev(device),
2237  mPointerType(pointerType),
2238  mXT(xTilt),
2239  mYT(yTilt),
2240  mZ(z),
2241  mPress(pressure),
2242  mTangential(tangentialPressure),
2243  mRot(rotation),
2244  mUnique(uniqueID),
2245  mExtra(0)
2246 {
2247 }
2248 
2253 {
2254 }
2255 
2492 #endif // QT_NO_TABLETEVENT
2493 
2494 #ifndef QT_NO_DRAGANDDROP
2495 
2507 QDragMoveEvent::QDragMoveEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
2508  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
2509  : QDropEvent(pos, actions, data, buttons, modifiers, type)
2510  , rect(pos, QSize(1, 1))
2511 {}
2512 
2517 {
2518 }
2519  // ### pos is in which coordinate system?
2645 QDropEvent::QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
2646  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
2647  : QEvent(type), p(pos), mouseState(buttons),
2648  modState(modifiers), act(actions),
2649  mdata(data)
2650 {
2653  ignore();
2654 }
2655 
2658 {
2659 }
2660 
2680 {
2681  return mdata->data(QLatin1String(format));
2682 }
2683 
2700 const char* QDropEvent::format(int n) const
2701 {
2702  if (fmts.isEmpty()) {
2703  QStringList formats = mdata->formats();
2704  for (int i = 0; i < formats.size(); ++i)
2705  fmts.append(formats.at(i).toLatin1());
2706  }
2707  if (n < 0 || n >= fmts.size())
2708  return 0;
2709  return fmts.at(n).constData();
2710 }
2711 
2723 bool QDropEvent::provides(const char *mimeType) const
2724 {
2725  return mdata->formats().contains(QLatin1String(mimeType));
2726 }
2727 
2740 {
2741  QDragManager *manager = QDragManager::self();
2742  return manager ? manager->source() : 0;
2743 }
2744 
2745 
2747 {
2748  if (!(action & act) && action != Qt::IgnoreAction)
2749  action = default_action;
2750  drop_action = action;
2751 }
2752 
2899 #ifdef QT3_SUPPORT
2900 
2915 QT3_SUPPORT QDropEvent::Action QDropEvent::action() const
2916 {
2917  switch(drop_action) {
2918  case Qt::CopyAction:
2919  return Copy;
2920  case Qt::MoveAction:
2921  return Move;
2922  case Qt::LinkAction:
2923  return Link;
2924  default:
2925  return Copy;
2926  }
2927 }
2928 #endif
2929  // ### here too - what coordinate system?
2941 
2942 
2977 QDragEnterEvent::QDragEnterEvent(const QPoint& point, Qt::DropActions actions, const QMimeData *data,
2978  Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
2979  : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
2980 {}
2981 
2985 {
2986 }
2987 
2994  : QEvent(DragResponse), a(accepted)
2995 {}
2996 
3000 {
3001 }
3002 
3056  : QEvent(DragLeave)
3057 {}
3058 
3062 {
3063 }
3064 #endif // QT_NO_DRAGANDDROP
3065 
3093 QHelpEvent::QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos)
3094  : QEvent(type), p(pos), gp(globalPos)
3095 {}
3096 
3168 {
3169 }
3170 
3171 #ifndef QT_NO_STATUSTIP
3172 
3219  : QEvent(StatusTip), s(tip)
3220 {}
3221 
3225 {
3226 }
3227 
3239 #endif // QT_NO_STATUSTIP
3240 
3241 #ifndef QT_NO_WHATSTHIS
3242 
3264  : QEvent(WhatsThisClicked), s(href)
3265 {}
3266 
3270 {
3271 }
3272 
3283 #endif // QT_NO_WHATSTHIS
3284 
3285 #ifndef QT_NO_ACTION
3286 
3315  : QEvent(static_cast<QEvent::Type>(type)), act(action), bef(before)
3316 {}
3317 
3321 {
3322 }
3323 
3343 #endif // QT_NO_ACTION
3344 
3371  : QEvent(Hide)
3372 {}
3373 
3377 {
3378 }
3379 
3403  : QEvent(Show)
3404 {}
3405 
3409 {
3410 }
3411 
3444 {
3445 #ifdef Q_OS_SYMBIAN
3446  file.Close();
3447 #endif
3448 }
3449 
3459  : QEvent(FileOpen), f(file)
3460 {
3461  d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(QUrl::fromLocalFile(file)));
3462 }
3463 
3473  : QEvent(FileOpen)
3474 {
3475  d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(url));
3476  f = url.toLocalFile();
3477 }
3478 
3479 #ifdef Q_OS_SYMBIAN
3480 
3482 QFileOpenEvent::QFileOpenEvent(const RFile &fileHandle)
3483  : QEvent(FileOpen)
3484 {
3485  TFileName fullName;
3486  fileHandle.FullName(fullName);
3487  f = qt_TDesC2QString(fullName);
3489  // Duplicate here allows the file handle to be valid after S60 app construction is complete.
3490  qt_symbian_throwIfError(priv->file.Duplicate(fileHandle));
3491  d = reinterpret_cast<QEventPrivate *>(priv.take());
3492 }
3493 #endif
3494 
3498 {
3499  delete reinterpret_cast<QFileOpenEventPrivate *>(d);
3500 }
3501 
3522 {
3523  return reinterpret_cast<const QFileOpenEventPrivate *>(d)->url;
3524 }
3525 
3542 bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
3543 {
3544  file.setFileName(f);
3545 #ifdef Q_OS_SYMBIAN
3546  const QFileOpenEventPrivate *priv = reinterpret_cast<const QFileOpenEventPrivate *>(d);
3547  if (priv->file.SubSessionHandle()) {
3548  RFile dup;
3549  // Duplicate here means that the opened QFile will continue to be valid beyond the lifetime of this QFileOpenEvent.
3550  // It also allows openFile to be used in threads other than the thread in which the QFileOpenEvent was created.
3551  if (dup.Duplicate(priv->file) == KErrNone) {
3553  bool open = file.open(dup, flags, QFile::AutoCloseHandle);
3554  dupCloser.take();
3555  return open;
3556  }
3557  }
3558 #endif
3559  return file.open(flags);
3560 }
3561 
3562 #ifndef QT_NO_TOOLBAR
3563 
3589  : QEvent(ToolBarChange), tog(t)
3590 {}
3591 
3595 {
3596 }
3597 
3603 /*
3604  \fn Qt::ButtonState QToolBarChangeEvent::state() const
3605 
3606  Returns the keyboard modifier flags at the time of the event.
3607 
3608  The returned value is a selection of the following values,
3609  combined using the OR operator:
3610  Qt::ShiftButton, Qt::ControlButton, Qt::MetaButton, and Qt::AltButton.
3611 */
3612 
3613 #endif // QT_NO_TOOLBAR
3614 
3615 #ifndef QT_NO_SHORTCUT
3616 
3624 QShortcutEvent::QShortcutEvent(const QKeySequence &key, int id, bool ambiguous)
3625  : QEvent(Shortcut), sequence(key), ambig(ambiguous), sid(id)
3626 {
3627 }
3628 
3633 {
3634 }
3635 
3636 #endif // QT_NO_SHORTCUT
3637 
3638 #ifndef QT_NO_DEBUG_STREAM
3639 QDebug operator<<(QDebug dbg, const QEvent *e) {
3640 #ifndef Q_BROKEN_DEBUG_STREAM
3641  // More useful event output could be added here
3642  if (!e)
3643  return dbg << "QEvent(this = 0x0)";
3644  const char *n = 0;
3645  switch (e->type()) {
3646  case QEvent::Timer:
3647  n = "Timer";
3648  break;
3650  case QEvent::MouseMove:
3653  {
3654  const QMouseEvent *me = static_cast<const QMouseEvent*>(e);
3655  switch(me->type()) {
3657  n = "MouseButtonPress";
3658  break;
3659  case QEvent::MouseMove:
3660  n = "MouseMove";
3661  break;
3663  n = "MouseButtonRelease";
3664  break;
3666  default:
3667  n = "MouseButtonDblClick";
3668  break;
3669  }
3670  dbg.nospace() << "QMouseEvent(" << n
3671  << ", " << me->button()
3672  << ", " << hex << (int)me->buttons()
3673  << ", " << hex << (int)me->modifiers()
3674  << ')';
3675  }
3676  return dbg.space();
3677 
3678 #ifndef QT_NO_TOOLTIP
3679  case QEvent::ToolTip:
3680  n = "ToolTip";
3681  break;
3682 #endif
3684  n = "WindowActivate";
3685  break;
3687  n = "WindowDeactivate";
3688  break;
3690  n = "ActivationChange";
3691  break;
3692 #ifndef QT_NO_WHEELEVENT
3693  case QEvent::Wheel:
3694  dbg.nospace() << "QWheelEvent(" << static_cast<const QWheelEvent *>(e)->delta()
3695  << ')';
3696  return dbg.space();
3697 #endif
3698  case QEvent::KeyPress:
3699  case QEvent::KeyRelease:
3701  {
3702  const QKeyEvent *ke = static_cast<const QKeyEvent*>(e);
3703  switch(ke->type()) {
3705  n = "ShortcutOverride";
3706  break;
3707  case QEvent::KeyRelease:
3708  n = "KeyRelease";
3709  break;
3710  case QEvent::KeyPress:
3711  default:
3712  n = "KeyPress";
3713  break;
3714  }
3715  dbg.nospace() << "QKeyEvent(" << n
3716  << ", " << hex << ke->key()
3717  << ", " << hex << (int)ke->modifiers()
3718  << ", \"" << ke->text()
3719  << "\", " << ke->isAutoRepeat()
3720  << ", " << ke->count()
3721  << ')';
3722  }
3723  return dbg.space();
3724  case QEvent::FocusIn:
3725  n = "FocusIn";
3726  break;
3727  case QEvent::FocusOut:
3728  n = "FocusOut";
3729  break;
3730  case QEvent::Enter:
3731  n = "Enter";
3732  break;
3733  case QEvent::Leave:
3734  n = "Leave";
3735  break;
3736  case QEvent::PaletteChange:
3737  n = "PaletteChange";
3738  break;
3739  case QEvent::PolishRequest:
3740  n = "PolishRequest";
3741  break;
3742  case QEvent::Polish:
3743  n = "Polish";
3744  break;
3745  case QEvent::UpdateRequest:
3746  n = "UpdateRequest";
3747  break;
3748  case QEvent::Paint:
3749  n = "Paint";
3750  break;
3751  case QEvent::Move:
3752  n = "Move";
3753  break;
3754  case QEvent::Resize:
3755  n = "Resize";
3756  break;
3757  case QEvent::Create:
3758  n = "Create";
3759  break;
3760  case QEvent::Destroy:
3761  n = "Destroy";
3762  break;
3763  case QEvent::Close:
3764  n = "Close";
3765  break;
3766  case QEvent::Quit:
3767  n = "Quit";
3768  break;
3769  case QEvent::FileOpen:
3770  n = "FileOpen";
3771  break;
3772  case QEvent::Show:
3773  n = "Show";
3774  break;
3775  case QEvent::ShowToParent:
3776  n = "ShowToParent";
3777  break;
3778  case QEvent::Hide:
3779  n = "Hide";
3780  break;
3781  case QEvent::HideToParent:
3782  n = "HideToParent";
3783  break;
3784  case QEvent::None:
3785  n = "None";
3786  break;
3787  case QEvent::ParentChange:
3788  n = "ParentChange";
3789  break;
3791  n = "ParentAboutToChange";
3792  break;
3793  case QEvent::HoverEnter:
3794  n = "HoverEnter";
3795  break;
3796  case QEvent::HoverMove:
3797  n = "HoverMove";
3798  break;
3799  case QEvent::HoverLeave:
3800  n = "HoverLeave";
3801  break;
3802  case QEvent::ZOrderChange:
3803  n = "ZOrderChange";
3804  break;
3805  case QEvent::StyleChange:
3806  n = "StyleChange";
3807  break;
3808  case QEvent::DragEnter:
3809  n = "DragEnter";
3810  break;
3811  case QEvent::DragMove:
3812  n = "DragMove";
3813  break;
3814  case QEvent::DragLeave:
3815  n = "DragLeave";
3816  break;
3817  case QEvent::Drop:
3818  n = "Drop";
3819  break;
3821  n = "GraphicsSceneMouseMove";
3822  break;
3824  n = "GraphicsSceneMousePress";
3825  break;
3827  n = "GraphicsSceneMouseRelease";
3828  break;
3830  n = "GraphicsSceneMouseDoubleClick";
3831  break;
3833  n = "GraphicsSceneContextMenu";
3834  break;
3836  n = "GraphicsSceneHoverEnter";
3837  break;
3839  n = "GraphicsSceneHoverMove";
3840  break;
3842  n = "GraphicsSceneHoverLeave";
3843  break;
3845  n = "GraphicsSceneHelp";
3846  break;
3848  n = "GraphicsSceneDragEnter";
3849  break;
3851  n = "GraphicsSceneDragMove";
3852  break;
3854  n = "GraphicsSceneDragLeave";
3855  break;
3857  n = "GraphicsSceneDrop";
3858  break;
3860  n = "GraphicsSceneWheel";
3861  break;
3863  n = "GraphicsSceneResize";
3864  break;
3866  n = "GraphicsSceneMove";
3867  break;
3868  case QEvent::CursorChange:
3869  n = "CursorChange";
3870  break;
3871  case QEvent::ToolTipChange:
3872  n = "ToolTipChange";
3873  break;
3874  case QEvent::StatusTip:
3875  n = "StatusTip";
3876  break;
3877  case QEvent::WhatsThis:
3878  n = "WhatsThis";
3879  break;
3880  case QEvent::FontChange:
3881  n = "FontChange";
3882  break;
3883  case QEvent::Style:
3884  n = "Style";
3885  break;
3887  n = "KeyboardLayoutChange";
3888  break;
3890  n = "DynamicPropertyChange";
3891  break;
3892  case QEvent::GrabMouse:
3893  n = "GrabMouse";
3894  break;
3895  case QEvent::UngrabMouse:
3896  n = "UngrabMouse";
3897  break;
3898  case QEvent::GrabKeyboard:
3899  n = "GrabKeyboard";
3900  break;
3902  n = "UngrabKeyboard";
3903  break;
3904 #ifdef QT3_SUPPORT
3905  case QEvent::ChildInsertedRequest:
3906  n = "ChildInsertedRequest";
3907  break;
3908  case QEvent::ChildInserted: n = "ChildInserted";
3909 #endif
3910  case QEvent::ChildAdded: n = n ? n : "ChildAdded";
3911  case QEvent::ChildPolished: n = n ? n : "ChildPolished";
3912  case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
3913  dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child();
3914  return dbg.space();
3915 #ifndef QT_NO_GESTURES
3916  case QEvent::Gesture:
3917  n = "Gesture";
3918  break;
3919 #endif
3920  default:
3921  dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')';
3922  return dbg.space();
3923  }
3924 
3925  dbg.nospace() << 'Q' << n << "Event(" << (const void *)e << ')';
3926  return dbg.space();
3927 #else
3928  qWarning("This compiler doesn't support streaming QEvent to QDebug");
3929  return dbg;
3930  Q_UNUSED(e);
3931 #endif
3932 }
3933 #endif
3934 
3935 #ifndef QT_NO_CLIPBOARD
3936 
3953  : QEvent(QEvent::Clipboard)
3954 {
3955  d = data;
3956 }
3957 
3959 {
3960 }
3961 #endif // QT_NO_CLIPBOARD
3962 
3988 // ### Qt 5: remove
4007 // ### Qt 5: remove
4027 // ### Qt 5: remove
4056  : QEvent(WindowStateChange), ostate(s)
4057 {
4058 }
4059 
4064 {
4065  if (isOverride)
4066  d = (QEventPrivate*)(this);
4067 }
4068 
4072 {
4073  return (d != 0);
4074 }
4075 
4079 {
4080 }
4081 
4082 #ifdef QT3_SUPPORT
4083 
4096 QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
4097 :QEvent(QEvent::MenubarUpdated), m_menuBar(menuBar) {}
4098 
4141 #endif
4142 
4308  QTouchEvent::DeviceType deviceType,
4309  Qt::KeyboardModifiers modifiers,
4310  Qt::TouchPointStates touchPointStates,
4311  const QList<QTouchEvent::TouchPoint> &touchPoints)
4312  : QInputEvent(eventType, modifiers),
4313  _widget(0),
4314  _deviceType(deviceType),
4315  _touchPointStates(touchPointStates),
4316  _touchPoints(touchPoints)
4317 { }
4318 
4323 { }
4324 
4409  : d(new QTouchEventTouchPointPrivate(id))
4410 { }
4411 
4420  : d(other.d)
4421 {
4422  d->ref.ref();
4423 }
4424 
4433 {
4434  if (!d->ref.deref())
4435  delete d;
4436 }
4437 
4446 {
4447  return d->id;
4448 }
4449 
4454 {
4456 }
4457 
4463 {
4464  return (d->state & Qt::TouchPointPrimary) != 0;
4465 }
4466 
4474 {
4475  return d->rect.center();
4476 }
4477 
4489 {
4490  return d->sceneRect.center();
4491 }
4492 
4499 {
4500  return d->screenRect.center();
4501 }
4502 
4512 {
4513  return d->normalizedPos;
4514 }
4515 
4523 {
4524  return d->startPos;
4525 }
4526 
4538 {
4539  return d->startScenePos;
4540 }
4541 
4548 {
4549  return d->startScreenPos;
4550 }
4551 
4561 {
4562  return d->startNormalizedPos;
4563 }
4564 
4572 {
4573  return d->lastPos;
4574 }
4575 
4588 {
4589  return d->lastScenePos;
4590 }
4591 
4599 {
4600  return d->lastScreenPos;
4601 }
4602 
4613 {
4614  return d->lastNormalizedPos;
4615 }
4616 
4625 {
4626  return d->rect;
4627 }
4628 
4637 {
4638  return d->sceneRect;
4639 }
4640 
4649 {
4650  return d->screenRect;
4651 }
4652 
4658 {
4659  return d->pressure;
4660 }
4661 
4664 {
4665  if (d->ref != 1)
4666  d = d->detach();
4667  d->id = id;
4668 }
4669 
4671 void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
4672 {
4673  if (d->ref != 1)
4674  d = d->detach();
4675  d->state = state;
4676 }
4677 
4680 {
4681  if (d->ref != 1)
4682  d = d->detach();
4683  d->rect.moveCenter(pos);
4684 }
4685 
4688 {
4689  if (d->ref != 1)
4690  d = d->detach();
4691  d->sceneRect.moveCenter(scenePos);
4692 }
4693 
4696 {
4697  if (d->ref != 1)
4698  d = d->detach();
4699  d->screenRect.moveCenter(screenPos);
4700 }
4701 
4704 {
4705  if (d->ref != 1)
4706  d = d->detach();
4708 }
4709 
4712 {
4713  if (d->ref != 1)
4714  d = d->detach();
4715  d->startPos = startPos;
4716 }
4717 
4720 {
4721  if (d->ref != 1)
4722  d = d->detach();
4724 }
4725 
4728 {
4729  if (d->ref != 1)
4730  d = d->detach();
4732 }
4733 
4736 {
4737  if (d->ref != 1)
4738  d = d->detach();
4740 }
4741 
4744 {
4745  if (d->ref != 1)
4746  d = d->detach();
4747  d->lastPos = lastPos;
4748 }
4749 
4752 {
4753  if (d->ref != 1)
4754  d = d->detach();
4756 }
4757 
4760 {
4761  if (d->ref != 1)
4762  d = d->detach();
4764 }
4765 
4768 {
4769  if (d->ref != 1)
4770  d = d->detach();
4772 }
4773 
4776 {
4777  if (d->ref != 1)
4778  d = d->detach();
4779  d->rect = rect;
4780 }
4781 
4784 {
4785  if (d->ref != 1)
4786  d = d->detach();
4787  d->sceneRect = sceneRect;
4788 }
4789 
4792 {
4793  if (d->ref != 1)
4794  d = d->detach();
4795  d->screenRect = screenRect;
4796 }
4797 
4800 {
4801  if (d->ref != 1)
4802  d = d->detach();
4803  d->pressure = pressure;
4804 }
4805 
4808 {
4809  other.d->ref.ref();
4810  if (!d->ref.deref())
4811  delete d;
4812  d = other.d;
4813  return *this;
4814 }
4815 
4816 #ifndef QT_NO_GESTURES
4817 
4857  : QEvent(QEvent::Gesture)
4858 {
4859  d = reinterpret_cast<QEventPrivate *>(new QGestureEventPrivate(gestures));
4860 }
4861 
4866 {
4867  delete reinterpret_cast<QGestureEventPrivate *>(d);
4868 }
4869 
4874 {
4875  return d_func()->gestures;
4876 }
4877 
4882 {
4883  const QGestureEventPrivate *d = d_func();
4884  for(int i = 0; i < d->gestures.size(); ++i)
4885  if (d->gestures.at(i)->gestureType() == type)
4886  return d->gestures.at(i);
4887  return 0;
4888 }
4889 
4894 {
4896  foreach (QGesture *gesture, d_func()->gestures) {
4897  if (gesture->state() != Qt::GestureCanceled)
4898  gestures.append(gesture);
4899  }
4900  return gestures;
4901 }
4902 
4907 {
4909  foreach (QGesture *gesture, d_func()->gestures) {
4910  if (gesture->state() == Qt::GestureCanceled)
4911  gestures.append(gesture);
4912  }
4913  return gestures;
4914 }
4915 
4930 {
4931  if (gesture)
4932  setAccepted(gesture->gestureType(), value);
4933 }
4934 
4945 {
4946  if (gesture)
4947  setAccepted(gesture->gestureType(), true);
4948 }
4949 
4960 {
4961  if (gesture)
4962  setAccepted(gesture->gestureType(), false);
4963 }
4964 
4969 {
4970  return gesture ? isAccepted(gesture->gestureType()) : false;
4971 }
4972 
4988 void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)
4989 {
4990  setAccepted(false);
4991  d_func()->accepted[gestureType] = value;
4992 }
4993 
5004 {
5005  setAccepted(gestureType, true);
5006 }
5007 
5018 {
5019  setAccepted(gestureType, false);
5020 }
5021 
5027 {
5028  return d_func()->accepted.value(gestureType, true);
5029 }
5030 
5040 {
5041  d_func()->widget = widget;
5042 }
5043 
5048 {
5049  return d_func()->widget;
5050 }
5051 
5052 #ifndef QT_NO_GRAPHICSVIEW
5053 
5064 {
5065  QWidget *w = widget();
5066  if (w) // we get the viewport as widget, not the graphics view
5067  w = w->parentWidget();
5069  if (view) {
5070  return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint()));
5071  }
5072  return QPointF();
5073 }
5074 #endif //QT_NO_GRAPHICSVIEW
5075 
5080 {
5081  return reinterpret_cast<QGestureEventPrivate *>(d);
5082 }
5083 
5088 {
5089  return reinterpret_cast<const QGestureEventPrivate *>(d);
5090 }
5091 
5092 #ifdef Q_NO_USING_KEYWORD
5093 
5142 #endif
5143 
5144 #endif // QT_NO_GESTURES
5145 
~QInputEvent()
Definition: qevent.cpp:84
QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
Constructs a QDragEnterEvent that represents a drag entering a widget at the given point with mouse a...
Definition: qevent.cpp:2977
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62
QString txt
Definition: qevent.h:268
void setAccepted(QGesture *, bool)
Sets the accept flag of the given gesture object to the specified value.
Definition: qevent.cpp:4929
QKeySequence::StandardKey standardKey
int id() const
Returns the id number of this touch point.
Definition: qevent.cpp:4445
void setScreenPos(const QPointF &screenPos)
Definition: qevent.cpp:4695
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void setLastPos(const QPointF &lastPos)
Definition: qevent.cpp:4743
QStatusTipEvent(const QString &tip)
Constructs a status tip event with the text specified by tip.
Definition: qevent.cpp:3218
The QKeyEvent class describes a key event.
Definition: qevent.h:224
int type
Definition: qmetatype.cpp:239
double qreal
Definition: qglobal.h:1193
Qt::DropActions act
Definition: qevent.h:522
unsigned char c[8]
Definition: qnumeric_p.h:62
QPointF mapToScene(const QPoint &point) const
Returns the viewport coordinate point mapped to scene coordinates.
int replace_length
Definition: qevent.h:468
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual QStringList formats() const
Returns a list of formats supported by the object.
Definition: qmimedata.cpp:579
QClipboardEvent(QEventPrivate *data)
Definition: qevent.cpp:3952
const char * format(int n=0) const
Returns a string describing one of the available data types for this drag.
Definition: qevent.cpp:2700
QPointF startScenePos() const
Returns the starting scene position of this touch point.
Definition: qevent.cpp:4537
ushort t
Definition: qcoreevent.h:316
QList< QGesture * > activeGestures() const
Returns a list of active (not canceled) gestures.
Definition: qevent.cpp:4893
Qt::TouchPointState state() const
Returns the current state of this touch point.
Definition: qevent.cpp:4453
Qt::MouseButtons mouseState
Definition: qevent.h:173
static QMouseEvent * createExtendedMouseEvent(Type type, const QPointF &pos, const QPoint &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
Definition: qevent.cpp:251
void setRect(const QRectF &rect)
Definition: qevent.cpp:4775
quint32 nVirtualKey
Definition: qevent_p.h:79
quint32 nativeScanCode() const
Returns the native scan code of the key event.
Definition: qevent.cpp:872
QShortcutEvent(const QKeySequence &key, int id, bool ambiguous=false)
Constructs a shortcut event for the given key press, associated with the QShortcut ID id...
Definition: qevent.cpp:3624
Qt::TouchPointStates state
Definition: qevent_p.h:119
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition: qfile.cpp:1064
bool provides(const char *) const
Returns true if this event provides format mimeType; otherwise returns false.
Definition: qevent.cpp:2723
The QWheelEvent class contains parameters that describe a wheel event.
Definition: qevent.h:139
void setStartNormalizedPos(const QPointF &startNormalizedPos)
Definition: qevent.cpp:4735
QRectF rect() const
Returns the rect for this touch point, relative to the widget or QGraphicsItem that received the even...
Definition: qevent.cpp:4624
QIconDragEvent()
Constructs an icon drag event object with the accept flag set to false.
Definition: qevent.cpp:1569
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
QList< QGesture * > canceledGestures() const
Returns a list of canceled gestures.
Definition: qevent.cpp:4906
Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const
Definition: qdnd.cpp:194
Reason
This enum describes the reason why the event was sent.
Definition: qevent.h:399
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
void setStartScenePos(const QPointF &startScenePos)
Definition: qevent.cpp:4719
QPoint p
Definition: qevent.h:135
T * take()
Returns the value of the pointer referenced by this object.
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QToolBarChangeEvent(bool t)
Construct a QToolBarChangeEvent given the current button state in state.
Definition: qevent.cpp:3588
uint autor
Definition: qevent.h:271
static Qt::MouseButtons buttons
QPoint g
Definition: qevent.h:120
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
QPointF lastScreenPos() const
Returns the screen position of this touch point from the previous touch event.
Definition: qevent.cpp:4598
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setDropAction(Qt::DropAction action)
Sets the action to be performed on the data by the target.
Definition: qevent.cpp:2746
QWidget * widget
Definition: qevent_p.h:168
void setCommitString(const QString &commitString, int replaceFrom=0, int replaceLength=0)
Sets the commit string to commitString.
Definition: qevent.cpp:2042
quint32 nativeModifiers() const
Returns the native modifiers of a key event.
Definition: qevent.cpp:906
quint32 nModifiers
Definition: qevent_p.h:80
QShowEvent()
Constructs a QShowEvent.
Definition: qevent.cpp:3402
QList< Attribute > attrs
Definition: qevent.h:465
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
QPointF lastScenePos() const
Returns the scene position of this touch point from the previous touch event.
Definition: qevent.cpp:4587
StandardKey
This enum represent standard key bindings.
Definition: qkeysequence.h:75
QByteArray data(const QString &mimetype) const
Returns the data stored in the object in the format described by the MIME type specified by mimeType...
Definition: qmimedata.cpp:524
bool ref()
Atomically increments the value of this QAtomicInt.
bool isOverride() const
Definition: qevent.cpp:4071
Qt::MouseButtons mouseState
Definition: qevent.h:122
Qt::Orientation o
Definition: qevent.h:174
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
QPointF scenePos() const
Returns the scene position of this touch point.
Definition: qevent.cpp:4488
void setNormalizedPos(const QPointF &normalizedPos)
Definition: qevent.cpp:4703
QWhatsThisClickedEvent(const QString &href)
Constructs an event containing a URL specified by href when a link is clicked in a "What&#39;s This...
Definition: qevent.cpp:3263
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
Definition: qevent.h:530
DeviceType
This enum represents the type of device that generated a QTouchEvent.
Definition: qevent.h:805
QWindowStateChangeEvent(Qt::WindowStates aOldState)
Definition: qevent.cpp:4055
~QMouseEvent()
Definition: qevent.cpp:190
Qt::FocusReason m_reason
Definition: qevent.h:294
QPointF normalizedPos() const
Returns the normalized position of this touch point.
Definition: qevent.cpp:4511
void setStartPos(const QPointF &startPos)
Definition: qevent.cpp:4711
QByteArray encodedData(const char *) const
Returns a byte array containing the drag&#39;s data, in format.
Definition: qevent.cpp:2679
QRectF sceneRect() const
Returns the rect for this touch point in scene coordinates.
Definition: qevent.cpp:4636
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers)
Constructs a context menu event object with the accept parameter flag set to false.
Definition: qevent.cpp:1629
QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type=DragMove)
Creates a QDragMoveEvent of the required type indicating that the mouse is at position pos given with...
Definition: qevent.cpp:2507
QWidget * source() const
Definition: qdnd_p.h:230
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
~QDragMoveEvent()
Destroys the event.
Definition: qevent.cpp:2516
~TouchPoint()
Destroys the QTouchEvent::TouchPoint.
Definition: qevent.cpp:4432
static uint currentPlatform()
QPointF mapToGraphicsScene(const QPointF &gesturePoint) const
Returns the scene-local coordinates if the gesturePoint is inside a graphics view.
Definition: qevent.cpp:5063
void setState(Qt::TouchPointStates state)
Definition: qevent.cpp:4671
Qt::DropAction default_action
Definition: qevent.h:524
static const QRectF boundingRect(const QPointF *points, int pointCount)
qreal pressure() const
Returns the pressure of this touch point.
Definition: qevent.cpp:4657
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Definition: qevent.cpp:999
int key() const
Returns the code of the key that was pressed or released.
Definition: qevent.h:231
QString preedit
Definition: qevent.h:464
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const QString & commitString() const
Returns the text that should get added to (or replace parts of) the text of the editor widget...
Definition: qevent.h:457
Qt::WindowStates ostate
Definition: qevent.h:716
QResizeEvent(const QSize &size, const QSize &oldSize)
Constructs a resize event with the new and old widget sizes, size and oldSize respectively.
Definition: qevent.cpp:1447
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Qt::KeyboardModifiers modState
Definition: qevent.h:521
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPoint p
Definition: qevent.h:170
static QKeyEvent * createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
Definition: qevent.cpp:842
bool isAccepted() const
Definition: qcoreevent.h:307
QPointF lastPos() const
Returns the position of this touch point from the previous touch event, relative to the widget or QGr...
Definition: qevent.cpp:4571
#define qApp
ushort c
Definition: qevent.h:270
bool hasExtendedInfo() const
Definition: qevent.h:107
QDebug operator<<(QDebug dbg, const QEvent *e)
Definition: qevent.cpp:3639
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool deref()
Atomically decrements the value of this QAtomicInt.
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
Q_CORE_EXPORT void qWarning(const char *,...)
int delta() const
Returns the distance that the wheel is rotated, in eighths of a degree.
Definition: qevent.h:150
static const char * data(const QByteArray &arr)
Qt::MouseButtons buttons() const
Returns the mouse state when the event occurred.
Definition: qevent.h:158
unsigned int uint
Definition: qglobal.h:996
void setSceneRect(const QRectF &sceneRect)
Definition: qevent.cpp:4783
~QKeyEvent()
Definition: qevent.cpp:835
QEvent(Type type)
Contructs an event object of type type.
Definition: qcoreevent.cpp:289
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
QTouchEvent(QEvent::Type eventType, QTouchEvent::DeviceType deviceType=TouchScreen, Qt::KeyboardModifiers modifiers=Qt::NoModifier, Qt::TouchPointStates touchPointStates=0, const QList< QTouchEvent::TouchPoint > &touchPoints=QList< QTouchEvent::TouchPoint >())
Constructs a QTouchEvent with the given eventType, deviceType, and touchPoints.
Definition: qevent.cpp:4307
QPointF screenPos() const
Returns the screen position of this touch point.
Definition: qevent.cpp:4498
QPointF startNormalizedPos() const
Returns the normalized starting position of this touch point.
Definition: qevent.cpp:4560
int count() const
Returns the number of keys involved in this event.
Definition: qevent.h:238
QList< QGesture * > gestures() const
Returns all gestures that are delivered in the event.
Definition: qevent.cpp:4873
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QPointF startScreenPos() const
Returns the starting screen position of this touch point.
Definition: qevent.cpp:4547
const QList< Attribute > & attributes() const
Returns the list of attributes passed to the QInputMethodEvent constructor.
Definition: qevent.h:454
DropAction
Definition: qnamespace.h:1597
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
__int64 qint64
Definition: qglobal.h:942
QPointF posF() const
Returns the position of the mouse cursor as a QPointF, relative to the widget that received the event...
Definition: qevent.cpp:278
void setScreenRect(const QRectF &screenRect)
Definition: qevent.cpp:4791
QList< QByteArray > fmts
Definition: qevent.h:526
QTouchEventTouchPointPrivate * detach()
Definition: qevent_p.h:108
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
QMoveEvent(const QPoint &pos, const QPoint &oldPos)
Constructs a move event with the new and old widget positions, pos and oldPos respectively.
Definition: qevent.cpp:1396
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
Definition: qurl.cpp:6412
const QMimeData * mdata
Definition: qevent.h:525
void setId(int id)
Definition: qevent.cpp:4663
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
GestureType
Definition: qnamespace.h:1759
~QGestureEvent()
Destroys QGestureEvent.
Definition: qevent.cpp:4865
int k
Definition: qevent.h:269
QUpdateLaterEvent(const QRegion &paintRegion)
Definition: qevent.cpp:1366
QString file() const
Returns the file that is being opened.
Definition: qevent.h:654
Reason reason() const
Returns the reason for this context event.
Definition: qevent.h:415
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
static QDragManager * self()
Definition: qdnd.cpp:163
The QChildEvent class contains event parameters for child object events.
Definition: qcoreevent.h:353
QEventPrivate * d
Definition: qcoreevent.h:315
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
The QInputMethodEvent class provides parameters for input method events.
Definition: qevent.h:431
void setLastScreenPos(const QPointF &lastScreenPos)
Definition: qevent.cpp:4759
quint32 nScanCode
Definition: qevent_p.h:78
~QKeyEventEx()
Definition: qevent.cpp:947
QWidget * widget() const
Returns the widget on which the event occurred.
Definition: qevent.cpp:5047
QList< QGesture * > gestures
Definition: qevent_p.h:167
void setLastScenePos(const QPointF &lastScenePos)
Definition: qevent.cpp:4751
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
Definition: qevent.h:476
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
Qt::MouseButtons mouseState
Definition: qevent.h:520
QString f
Definition: qevent.h:658
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
Definition: qevent.h:102
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
QFileOpenEvent(const QString &file)
Constructs a file open event for the given file.
Definition: qevent.cpp:3458
FocusReason
Definition: qnamespace.h:1521
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
Constructs a key event object.
Definition: qevent.cpp:826
QInputEvent(Type type, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
Definition: qevent.cpp:77
~QTouchEvent()
Destroys the QTouchEvent.
Definition: qevent.cpp:4322
The QGesture class represents a gesture, containing properties that describe the corresponding user i...
Definition: qgesture.h:64
bool m_erased
Definition: qevent.h:319
QUrl url() const
Returns the url that is being opened.
Definition: qevent.cpp:3521
QString text() const
Returns the Unicode text that this key generated.
Definition: qevent.h:236
Qt::GestureType gestureType
the type of the gesture
Definition: qgesture.h:70
unsigned short ushort
Definition: qglobal.h:995
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
Definition: qpoint.h:376
Qt::MouseButton b
Definition: qevent.h:121
QGestureEventPrivate * d_func()
Definition: qevent.cpp:5079
QPointF pos() const
Returns the position of this touch point, relative to the widget or QGraphicsItem that received the e...
Definition: qevent.cpp:4473
QWidget * source() const
If the source of the drag operation is a widget in this application, this function returns that sourc...
Definition: qevent.cpp:2739
QInputMethodEvent()
Constructs an event of type QEvent::InputMethod.
Definition: qevent.cpp:1996
~QHoverEvent()
Definition: qevent.cpp:539
int key
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason)
Constructs a focus event object.
Definition: qevent.cpp:1182
static const uint numberOfKeyBindings
void setStartScreenPos(const QPointF &startScreenPos)
Definition: qevent.cpp:4727
unsigned int quint32
Definition: qglobal.h:938
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
Definition: qevent.cpp:286
void setWidget(QWidget *widget)
Sets the widget for this event to the widget specified.
Definition: qevent.cpp:5039
void setPressure(qreal pressure)
Definition: qevent.cpp:4799
static const QMetaObjectPrivate * priv(const uint *data)
Qt::DropAction drop_action
Definition: qevent.h:523
QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
Construct a tablet event of the given type.
Definition: qevent.cpp:2228
QString s
Definition: qevent.h:614
TouchPointState
This enum represents the state of a touch point at the time the QTouchEvent occurred.
Definition: qnamespace.h:1738
QTouchEventTouchPointPrivate * d
Definition: qevent.h:800
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRect m_rect
Definition: qevent.h:317
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
Definition: qevent.h:237
Qt::FocusReason reason()
Definition: qevent.cpp:1197
QHideEvent()
Constructs a QHideEvent.
Definition: qevent.cpp:3370
QDragLeaveEvent()
Constructs a QDragLeaveEvent.
Definition: qevent.cpp:3055
QPaintEvent(const QRegion &paintRegion)
Constructs a paint event object with the region that needs to be updated.
Definition: qevent.cpp:1311
bool isPrimary() const
Returns true if this touch point is the primary touch point.
Definition: qevent.cpp:4462
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
Qt::KeyboardModifiers modState
Definition: qevent.h:82
The TouchPoint class provides information about a touch point in a QTouchEvent.
Definition: qevent.h:744
bool openFile(QFile &file, QIODevice::OpenMode flags) const
Opens a QFile on the file referenced by this event in the mode specified by flags.
Definition: qevent.cpp:3542
QDropEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type=Drop)
Constructs a drop event of a certain type corresponding to a drop at the point specified by pos in th...
Definition: qevent.cpp:2645
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:64
TouchPoint(int id=-1)
Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent.
Definition: qevent.cpp:4408
QPoint p
Definition: qevent.h:120
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
Definition: qurl.cpp:6374
QGesture * gesture(Qt::GestureType type) const
Returns a gesture object by type.
Definition: qevent.cpp:4881
void setScenePos(const QPointF &scenePos)
Definition: qevent.cpp:4687
The QInputEvent class is the base class for events that describe user input.
Definition: qevent.h:74
static const QKeyBinding keyBindings[]
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310
~QShortcutEvent()
Destroys the event object.
Definition: qevent.cpp:3632
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Definition: qcoreevent.h:309
Qt::GestureState state
the current state of the gesture
Definition: qgesture.h:69
QRectF screenRect() const
Returns the rect for this touch point in screen coordinates.
Definition: qevent.cpp:4648
QGestureEvent(const QList< QGesture *> &gestures)
Creates new QGestureEvent containing a list of gestures.
Definition: qevent.cpp:4856
QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos)
Constructs a hover event object.
Definition: qevent.cpp:531
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QRegion m_region
Definition: qevent.h:318
QWheelEvent(const QPoint &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient=Qt::Vertical)
Constructs a wheel event object.
Definition: qevent.cpp:607
static Qt::MouseButtons mouseButtons()
Returns the current state of the buttons on the mouse.
QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
Constructs a mouse event object.
Definition: qevent.cpp:180
QTouchEvent::TouchPoint & operator=(const QTouchEvent::TouchPoint &other)
Definition: qevent.cpp:4807
void setLastNormalizedPos(const QPointF &lastNormalizedPos)
Definition: qevent.cpp:4767
QActionEvent(int type, QAction *action, QAction *before=0)
Constructs an action event.
Definition: qevent.cpp:3314
QPoint p
Definition: qevent.h:519
QEventPrivate * data()
Definition: qevent.h:701
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately before the event occurred.
Definition: qevent.h:79
QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos)
Constructs a help event with the given type corresponding to the widget-relative position specified b...
Definition: qevent.cpp:3093
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
Orientation
Definition: qnamespace.h:174
void setPos(const QPointF &pos)
Definition: qevent.cpp:4679
void moveCenter(const QPointF &p)
Moves the rectangle, leaving the center point at the given position.
Definition: qrect.h:705
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
QPoint g
Definition: qevent.h:171
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
QPointF lastNormalizedPos() const
Returns the normalized position of this touch point from the previous touch event.
Definition: qevent.cpp:4612
QMap< Qt::GestureType, bool > accepted
Definition: qevent_p.h:169
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Definition: qevent.h:96
QPointF center() const
Returns the center point of the rectangle.
Definition: qrect.h:686
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
quint32 nativeVirtualKey() const
Returns the native virtual key, or key sym of the key event.
Definition: qevent.cpp:889
QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text, bool autorep, ushort count, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers)
Creates an extended key event object, which in addition to the normal key event data, also contains the native scan code, virtual key and modifiers.
Definition: qevent.cpp:921
~QWheelEvent()
Definition: qevent.cpp:618
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
void setFileName(const QString &name)
Sets the name of the file.
Definition: qfile.cpp:494
QDragResponseEvent(bool accepted)
Constructs a drag response event containing the accepted value, indicating whether the drag and drop ...
Definition: qevent.cpp:2993
int open(const char *, int,...)
#define text
Definition: qobjectdefs.h:80
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310
QPointF startPos() const
Returns the starting position of this touch point, relative to the widget or QGraphicsItem that recei...
Definition: qevent.cpp:4522
QString commit
Definition: qevent.h:466
bool matches(QKeySequence::StandardKey key) const
Returns true if the key event matches the given standard key; otherwise returns false.
Definition: qevent.cpp:1023
MouseButton
Definition: qnamespace.h:150
QCloseEvent()
Constructs a close event object.
Definition: qevent.cpp:1534