equal
deleted
inserted
replaced
3625 /*! |
3625 /*! |
3626 \class QTouchEvent |
3626 \class QTouchEvent |
3627 \brief The QTouchEvent class contains parameters that describe a touch event. |
3627 \brief The QTouchEvent class contains parameters that describe a touch event. |
3628 \since 4.6 |
3628 \since 4.6 |
3629 \ingroup events |
3629 \ingroup events |
3630 \ingroup multitouch |
3630 \ingroup touch |
3631 |
3631 |
3632 \section1 Enabling Touch Events |
3632 \section1 Enabling Touch Events |
3633 |
3633 |
3634 Touch events occur when pressing, releasing, or moving one or more touch points on a touch |
3634 Touch events occur when pressing, releasing, or moving one or more touch points on a touch |
3635 device (such as a touch-screen or track-pad). To receive touch events, widgets have to have the |
3635 device (such as a touch-screen or track-pad). To receive touch events, widgets have to have the |
3639 When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents |
3639 When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents |
3640 attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}. |
3640 attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}. |
3641 |
3641 |
3642 Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a |
3642 Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a |
3643 widget, and the widget will receive all updates for the touch point until it is released. |
3643 widget, and the widget will receive all updates for the touch point until it is released. |
3644 Note that it is possible for a widget to receive events for multiple touch points, and that |
3644 Note that it is possible for a widget to receive events for numerous touch points, and that |
3645 multiple widgets may be receiving touch events at the same time. |
3645 multiple widgets may be receiving touch events at the same time. |
3646 |
3646 |
3647 \section1 Event Handling |
3647 \section1 Event Handling |
3648 |
3648 |
3649 All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, or QEvent::TouchEnd. |
3649 All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, or QEvent::TouchEnd. |
3715 |
3715 |
3716 \list |
3716 \list |
3717 |
3717 |
3718 \i As mentioned above, enabling touch events means multiple widgets can be receiving touch |
3718 \i As mentioned above, enabling touch events means multiple widgets can be receiving touch |
3719 events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents, |
3719 events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents, |
3720 this gives you great flexibility in designing multi-touch user interfaces. Be aware of the |
3720 this gives you great flexibility in designing touch user interfaces. Be aware of the |
3721 implications. For example, it is possible that the user is moving a QSlider with one finger and |
3721 implications. For example, it is possible that the user is moving a QSlider with one finger and |
3722 pressing a QPushButton with another. The signals emitted by these widgets will be |
3722 pressing a QPushButton with another. The signals emitted by these widgets will be |
3723 interleaved. |
3723 interleaved. |
3724 |
3724 |
3725 \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or |
3725 \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or |
3727 recipients, recursion may cause problems, including but not limited to lost events |
3727 recipients, recursion may cause problems, including but not limited to lost events |
3728 and unexpected infinite recursion. |
3728 and unexpected infinite recursion. |
3729 |
3729 |
3730 \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an |
3730 \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an |
3731 \l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is |
3731 \l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is |
3732 undefined when opening a pop-up or grabbing the mouse while there are multiple active touch |
3732 undefined when opening a pop-up or grabbing the mouse while there are more than one active touch |
3733 points. |
3733 points. |
3734 |
3734 |
3735 \endlist |
3735 \endlist |
3736 |
3736 |
3737 \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents, |
3737 \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents, |
4279 accepted and in the Qt::GestureStarted state will be propagated up the |
4279 accepted and in the Qt::GestureStarted state will be propagated up the |
4280 parent widget chain until a widget accepts them individually, by calling |
4280 parent widget chain until a widget accepts them individually, by calling |
4281 QGestureEvent::accept() for each of them, or an event filter consumes the |
4281 QGestureEvent::accept() for each of them, or an event filter consumes the |
4282 event. |
4282 event. |
4283 |
4283 |
|
4284 \section1 Further Reading |
|
4285 |
|
4286 For an overview of gesture handling in Qt and information on using gestures |
|
4287 in your applications, see the \l{Gestures Programming} document. |
|
4288 |
4284 \sa QGesture, QGestureRecognizer, |
4289 \sa QGesture, QGestureRecognizer, |
4285 QWidget::grabGesture(), QGraphicsObject::grabGesture() |
4290 QWidget::grabGesture(), QGraphicsObject::grabGesture() |
4286 */ |
4291 */ |
4287 |
4292 |
4288 /*! |
4293 /*! |