QTouchEvent Class ReferenceThe QTouchEvent class contains parameters that describe a touch event. Далее... #include <QTouchEvent> Inherits: QInputEvent. Этот класс был введён в Qt 4.6. Открытые типы
Открытые функции
Дополнительные унаследованные членыПодробное описаниеThe QTouchEvent class contains parameters that describe a touch event. Enabling Touch EventsTouch events occur when pressing, releasing, or moving one or more touch points on a touch device (such as a touch-screen or track-pad). To receive touch events, widgets have to have the Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the acceptTouchEvents attribute set to true. When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents attribute on the scroll area's viewport. Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a widget, and the widget will receive all updates for the touch point until it is released. Note that it is possible for a widget to receive events for numerous touch points, and that multiple widgets may be receiving touch events at the same time. Обработка событийAll touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, or QEvent::TouchEnd. Reimplement QWidget::event() or QAbstractScrollArea::viewportEvent() for widgets and QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events. The QEvent::TouchUpdate and QEvent::TouchEnd events are sent to the widget or item that accepted the QEvent::TouchBegin event. If the QEvent::TouchBegin event is not accepted and not filtered by an event filter, then no further touch events are sent until the next QEvent::TouchBegin. The touchPoints() function returns a list of all touch points contained in the event. 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. Event Delivery and PropagationBy default, QWidget::event() translates the first non-primary touch point in a QTouchEvent into a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not normally handle QTouchEvent. See below for information on some special considerations needed when doing this. QEvent::TouchBegin is the first touch event sent to a widget. The QEvent::TouchBegin event contains a special accept flag that indicates whether the receiver wants the event. By default, the event is accepted. You should call ignore() if the touch event is not handled by your widget. The QEvent::TouchBegin event is propagated up the parent widget chain until a widget accepts it with accept(), or an event filter consumes it. For QGraphicsItems, the QEvent::TouchBegin event is propagated to items under the mouse (similar to mouse event propagation for QGraphicsItems). Touch Point GroupingAs mentioned above, it is possible that several widgets can be receiving QTouchEvents at the same time. However, Qt makes sure to never send duplicate QEvent::TouchBegin events to the same widget, which could theoretically happen during propagation if, for example, the user touched 2 separate widgets in a QGroupBox and both widgets ignored the QEvent::TouchBegin event. To avoid this, Qt will group new touch points together using the following rules:
This makes it possible for sibling widgets to handle touch events independently while making sure that the sequence of QTouchEvents is always correct. Mouse Events and the Primary Touch PointQTouchEvent delivery is independent from that of QMouseEvent. On some windowing systems, mouse events are also sent for the primary touch point. This means it is possible for your widget to receive both QTouchEvent and QMouseEvent for the same user interaction point. You can use the QTouchEvent::TouchPoint::isPrimary() function to identify the primary touch point. Note that on some systems, it is possible to receive touch events without a primary touch point. All this means is that there will be no mouse event generated for the touch points in the QTouchEvent. Caveats
See also QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents, and QGraphicsItem::acceptTouchEvents(). Описание типов-членовenum QTouchEvent::DeviceTypeThis enum represents the type of device that generated a QTouchEvent.
Описание функций-членовQTouchEvent::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. The touchPointStates and modifiers are the current touch point states and keyboard modifiers at the time of the event. QTouchEvent::~QTouchEvent ()Destroys the QTouchEvent. QTouchEvent::DeviceType QTouchEvent::deviceType () constReturns the touch device Type, which is of type DeviceType. Qt::TouchPointStates QTouchEvent::touchPointStates () constReturns a bitwise OR of all the touch point states for this event. const QList<QTouchEvent::TouchPoint> & QTouchEvent::touchPoints () constReturns the list of touch points contained in the touch event. QWidget * QTouchEvent::widget () constReturns the widget on which the event occurred. |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |