diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-07-24 09:45:33 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-07-27 13:04:30 (GMT) |
commit | 3643028959f0b38350e57e60ba4000435b75e592 (patch) | |
tree | c129e4dee11487abd437ab8ebd993ba261e06fa6 /src/gui/kernel/qevent.cpp | |
parent | cf66c667a97c0079141eb3f2d9e997b7378ae792 (diff) | |
parent | c36139c665e61866aff4bf8572890a735167a7d0 (diff) | |
download | Qt-3643028959f0b38350e57e60ba4000435b75e592.zip Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
configure.exe
qmake/Makefile.unix
qmake/generators/makefile.cpp
src/corelib/global/qglobal.h
src/corelib/kernel/kernel.pri
src/corelib/kernel/qcoreevent.cpp
src/corelib/kernel/qsharedmemory_unix.cpp
src/gui/graphicsview/qgraphicsscene.cpp
src/gui/kernel/qaction.cpp
src/gui/kernel/qaction.h
src/gui/kernel/qaction_p.h
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget.h
src/gui/kernel/qwidget_mac.mm
src/gui/painting/qgraphicssystemfactory.cpp
src/gui/styles/qwindowsstyle.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/widgets/qabstractscrollarea_p.h
src/network/access/qnetworkaccessdebugpipebackend.cpp
src/network/socket/qlocalsocket_unix.cpp
src/network/socket/qnativesocketengine_p.h
src/network/socket/qnativesocketengine_unix.cpp
src/openvg/qpaintengine_vg.cpp
tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
tests/auto/qcssparser/qcssparser.pro
tests/auto/qdir/tst_qdir.cpp
tests/auto/qfile/tst_qfile.cpp
tests/auto/qobject/tst_qobject.cpp
tests/auto/qpathclipper/qpathclipper.pro
tests/auto/qprocess/tst_qprocess.cpp
tests/auto/qsettings/tst_qsettings.cpp
tests/auto/qsharedpointer/qsharedpointer.pro
tests/auto/qsqlquerymodel/qsqlquerymodel.pro
tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
tests/auto/qsqltablemodel/qsqltablemodel.pro
tests/auto/qsqlthread/qsqlthread.pro
tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 279 |
1 files changed, 101 insertions, 178 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8e92243..a6a87b7 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE -QString qt_getStandardGestureTypeName(Qt::GestureType type); - /*! \class QInputEvent \ingroup events @@ -116,8 +114,12 @@ QInputEvent::~QInputEvent() propagated up the parent widget chain until a widget accepts it with accept(), or an event filter consumes it. + \note If a mouse event is propagated to a \l{QWidget}{widget} for + which Qt::WA_NoMousePropagation has been set, that mouse event + will not be propagated further up the parent widget chain. + The state of the keyboard modifier keys can be found by calling the - \l{QInputEvent::modifiers()}{modifiers()} function, inhertied from + \l{QInputEvent::modifiers()}{modifiers()} function, inherited from QInputEvent. The functions pos(), x(), and y() give the cursor position @@ -3343,9 +3345,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child(); return dbg.space(); - case QEvent::Gesture: - n = "Gesture"; - break; default: dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')'; return dbg.space(); @@ -3542,167 +3541,24 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) #endif -/*! - \class QGestureEvent - \since 4.6 - \ingroup events - - \brief The QGestureEvent class provides the parameters used for - gesture recognition. - - The QGestureEvent class contains a list of gestures that are being - executed right now (\l{QGestureEvent::}{gestureTypes()}) and a - list of gestures that are cancelled (the gesture might be - cancelled because the window lost focus, or because of timeout, - etc). - - \sa QGesture -*/ - -/*! - Creates new QGestureEvent containing a list of \a gestures that - are being executed and a list of gesture that were cancelled (\a - cancelledGestures). -*/ -QGestureEvent::QGestureEvent(const QSet<QGesture*> &gestures, - const QSet<QString> &cancelledGestures) - : QEvent(QEvent::Gesture), m_cancelledGestures(cancelledGestures) -{ - setAccepted(false); - foreach(QGesture *r, gestures) - m_gestures.insert(r->type(), r); -} - -/*! - Destroys the QGestureEvent object. -*/ -QGestureEvent::~QGestureEvent() -{ -} - -/*! - Returns true if the gesture event contains gesture of specific \a - type; returns false otherwise. -*/ -bool QGestureEvent::contains(Qt::GestureType type) const -{ - return contains(qt_getStandardGestureTypeName(type)); -} - -/*! - Returns true if the gesture event contains gesture of specific \a - type; returns false otherwise. -*/ -bool QGestureEvent::contains(const QString &type) const -{ - return gesture(type) != 0; -} - -/*! - Returns a list of gesture names that this event contains. -*/ -QList<QString> QGestureEvent::gestureTypes() const -{ - return m_gestures.keys(); -} - -/*! - Returns extended information about a gesture of specific \a type. -*/ -const QGesture* QGestureEvent::gesture(Qt::GestureType type) const -{ - return gesture(qt_getStandardGestureTypeName(type)); -} - -/*! - Returns extended information about a gesture of specific \a type. -*/ -const QGesture* QGestureEvent::gesture(const QString &type) const -{ - return m_gestures.value(type, 0); -} - -/*! - Returns extended information about all gestures in the event. -*/ -QList<QGesture*> QGestureEvent::gestures() const -{ - return m_gestures.values(); -} - -/*! - Returns a set of gesture names that used to be executed, but were - cancelled (i.e. they were not finished properly). -*/ -QSet<QString> QGestureEvent::cancelledGestures() const -{ - return m_cancelledGestures; -} - -/*! - Sets the accept flag of the all gestures inside the event object, - the equivalent of calling \l{QEvent::accept()}{accept()} or - \l{QEvent::setAccepted()}{setAccepted(true)}. - - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGestureEvent::acceptAll() -{ - QHash<QString, QGesture*>::iterator it = m_gestures.begin(), - e = m_gestures.end(); - for(; it != e; ++it) - it.value()->accept(); - setAccepted(true); -} - -/*! - Sets the accept flag of the specified gesture inside the event - object, the equivalent of calling - \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()} - - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGestureEvent::accept(Qt::GestureType type) -{ - if (QGesture *g = m_gestures.value(qt_getStandardGestureTypeName(type), 0)) - g->accept(); -} - -/*! - Sets the accept flag of the specified gesture inside the event - object, the equivalent of calling - \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()} - - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGestureEvent::accept(const QString &type) -{ - if (QGesture *g = m_gestures.value(type, 0)) - g->accept(); -} - /*! \class QTouchEvent - \brief The QTouchEvent class contains parameters that describe a touch event -. + \brief The QTouchEvent class contains parameters that describe a touch event. \since 4.6 \ingroup events Touch events occur when pressing, releasing, or moving one or more touch points on a touch device (such as a touch-screen or - track-pad), and if the widget has the Qt::WA_AcceptTouchEvents - attribute. + track-pad). To receive touch events, widgets have to have the + Qt::WA_AcceptTouchEvents attribute set and graphics items need to have + the \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents} + attribute set to true. All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, or QEvent::TouchEnd. The touchPoints() function returns a list of all touch points contained in the event. - Information about each touch point can be retreived using the - QTouchEvent::TouchPoint class. + Information about each touch point can be retrieved using the + QTouchEvent::TouchPoint class. The Qt::TouchPointState enum + describes the different states that a touch point may have. Similar to QMouseEvent, Qt automatically grabs each touch point on the first press inside a widget; the widget will receive all @@ -3720,10 +3576,11 @@ void QGestureEvent::accept(const QString &type) then mouse events are simulated from the state of the first touch point. - The Qt::TouchPointState enum describes the different states that a - touch point may have. + Reimplement QWidget::event() for widgets and QGraphicsItem::sceneEvent() + for items in a graphics view to receive touch events. - QTouchEvent::TouchPoint Qt::TouchPointState Qt::WA_AcceptTouchEvents + \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents, + QGraphicsItem::acceptTouchEvents() */ /*! \enum Qt::TouchPointState @@ -3741,13 +3598,7 @@ void QGestureEvent::accept(const QString &type) \omitvalue TouchPointPrimary */ -/*! \class QTouchEvent::TouchPoint - \brief The QTouchEvent::TouchPoint class provide information about a touch point in a QTouchEvent. - \since 4.6 -*/ - /*! \enum QTouchEvent::DeviceType - \since 4.6 This enum represents the type of device that generated a QTouchEvent. @@ -3826,6 +3677,11 @@ QTouchEvent::~QTouchEvent() Sets the list of touch points for this event. */ +/*! \class QTouchEvent::TouchPoint + \brief The QTouchEvent::TouchPoint class provides information about a touch point in a QTouchEvent. + \since 4.6 +*/ + /*! \internal Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent. @@ -3885,7 +3741,9 @@ bool QTouchEvent::TouchPoint::isPrimary() const /*! Returns the position of this touch point, relative to the widget - or item that received the event. + or QGraphicsItem that received the event. + + \sa startPos(), lastPos(), screenPos(), scenePos(), normalizedPos() */ QPointF QTouchEvent::TouchPoint::pos() const { @@ -3894,6 +3752,13 @@ QPointF QTouchEvent::TouchPoint::pos() const /*! Returns the scene position of this touch point. + + The scene position is the position in QGraphicsScene coordinates + if the QTouchEvent is handled by a QGraphicsItem::touchEvent() + reimplementation, and identical to the screen position for + widgets. + + \sa startScenePos(), lastScenePos(), pos() */ QPointF QTouchEvent::TouchPoint::scenePos() const { @@ -3902,6 +3767,8 @@ QPointF QTouchEvent::TouchPoint::scenePos() const /*! Returns the screen position of this touch point. + + \sa startScreenPos(), lastScreenPos(), pos() */ QPointF QTouchEvent::TouchPoint::screenPos() const { @@ -3909,8 +3776,12 @@ QPointF QTouchEvent::TouchPoint::screenPos() const } /*! - Returns the position of this touch point. The coordinates are normalized to size of the touch - device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. + Returns the normalized position of this touch point. + + The coordinates are normalized to the size of the touch device, + i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. + + \sa startNormalizedPos(), lastNormalizedPos(), pos() */ QPointF QTouchEvent::TouchPoint::normalizedPos() const { @@ -3919,7 +3790,9 @@ QPointF QTouchEvent::TouchPoint::normalizedPos() const /*! Returns the starting position of this touch point, relative to the - widget that received the event. + widget or QGraphicsItem that received the event. + + \sa pos(), lastPos() */ QPointF QTouchEvent::TouchPoint::startPos() const { @@ -3928,6 +3801,13 @@ QPointF QTouchEvent::TouchPoint::startPos() const /*! Returns the starting scene position of this touch point. + + The scene position is the position in QGraphicsScene coordinates + if the QTouchEvent is handled by a QGraphicsItem::touchEvent() + reimplementation, and identical to the screen position for + widgets. + + \sa scenePos(), lastScenePos() */ QPointF QTouchEvent::TouchPoint::startScenePos() const { @@ -3936,6 +3816,8 @@ QPointF QTouchEvent::TouchPoint::startScenePos() const /*! Returns the starting screen position of this touch point. + + \sa screenPos(), lastScreenPos() */ QPointF QTouchEvent::TouchPoint::startScreenPos() const { @@ -3943,8 +3825,12 @@ QPointF QTouchEvent::TouchPoint::startScreenPos() const } /*! - Returns the starting position of this touch point. The coordinates are normalized to size of - the touch device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. + Returns the normalized starting position of this touch point. + + The coordinates are normalized to the size of the touch device, + i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. + + \sa normalizedPos(), lastNormalizedPos() */ QPointF QTouchEvent::TouchPoint::startNormalizedPos() const { @@ -3953,7 +3839,9 @@ QPointF QTouchEvent::TouchPoint::startNormalizedPos() const /*! Returns the position of this touch point from the previous touch - event, relative to the widget that received the event. + event, relative to the widget or QGraphicsItem that received the event. + + \sa pos(), startPos() */ QPointF QTouchEvent::TouchPoint::lastPos() const { @@ -3963,6 +3851,13 @@ QPointF QTouchEvent::TouchPoint::lastPos() const /*! Returns the scene position of this touch point from the previous touch event. + + The scene position is the position in QGraphicsScene coordinates + if the QTouchEvent is handled by a QGraphicsItem::touchEvent() + reimplementation, and identical to the screen position for + widgets. + + \sa scenePos(), startScenePos() */ QPointF QTouchEvent::TouchPoint::lastScenePos() const { @@ -3972,6 +3867,8 @@ QPointF QTouchEvent::TouchPoint::lastScenePos() const /*! Returns the screen position of this touch point from the previous touch event. + + \sa screenPos(), startScreenPos() */ QPointF QTouchEvent::TouchPoint::lastScreenPos() const { @@ -3979,9 +3876,13 @@ QPointF QTouchEvent::TouchPoint::lastScreenPos() const } /*! - Returns the position of this touch point from the previous touch event. The coordinates are - normalized to size of the touch device, i.e. (0,0) is the top-left corner and (1,1) is the - bottom-right corner. + Returns the normalized position of this touch point from the + previous touch event. + + The coordinates are normalized to the size of the touch device, + i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. + + \sa normalizedPos(), startNormalizedPos() */ QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const { @@ -3989,8 +3890,11 @@ QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const } /*! - Returns the rect for this touch point. The rect is centered around the point returned by pos(). - Note this function returns an empty rect if the device does not report touch point sizes. + Returns the rect for this touch point, relative to the widget + or QGraphicsItem that received the event. The rect is centered + around the point returned by pos(). + + \note This function returns an empty rect if the device does not report touch point sizes. */ QRectF QTouchEvent::TouchPoint::rect() const { @@ -3999,6 +3903,10 @@ QRectF QTouchEvent::TouchPoint::rect() const /*! Returns the rect for this touch point in scene coordinates. + + \note This function returns an empty rect if the device does not report touch point sizes. + + \sa scenePos(), rect() */ QRectF QTouchEvent::TouchPoint::sceneRect() const { @@ -4007,6 +3915,10 @@ QRectF QTouchEvent::TouchPoint::sceneRect() const /*! Returns the rect for this touch point in screen coordinates. + + \note This function returns an empty rect if the device does not report touch point sizes. + + \sa screenPos(), rect() */ QRectF QTouchEvent::TouchPoint::screenRect() const { @@ -4176,4 +4088,15 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T return *this; } +/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const + Returns the touch device Type, which is of type + \l {QTouchEvent::DeviceType} {DeviceType}. + */ + +/*! \fn void QTouchEvent::setDeviceType(DeviceType deviceType) + Sets the device type to \a deviceType, which is of type + \l {QTouchEvent::DeviceType} {DeviceType}. + */ + + QT_END_NAMESPACE |