send touch update when more points begin after single touch is ignored
Otherwise, a widget can't detect pinches if the points don't start simultaneously unless it sets WA_TouchPadAcceptSingleTouchEvents. The use case is for a widget that doesn't actually want the single touch events, but only when there are two or more touchpoints. Task-number: QTBUG-42389 Change-Id: I5269d9acb93a0001c4fde02b1f7b9e0dfcc0032f Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
ea8d4869b7
commit
63f5b1a7fc
@ -4230,8 +4230,9 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)
|
||||
return true;
|
||||
}
|
||||
|
||||
void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent)
|
||||
bool QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent)
|
||||
{
|
||||
bool containsPress = false;
|
||||
for (int i = 0; i < touchEvent->touchPoints().count(); ++i) {
|
||||
QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i];
|
||||
|
||||
@ -4244,7 +4245,11 @@ void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven
|
||||
touchPoint.d->rect = rect;
|
||||
touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
|
||||
touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
|
||||
|
||||
if (touchPoint.state() == Qt::TouchPointPressed)
|
||||
containsPress = true;
|
||||
}
|
||||
return containsPress;
|
||||
}
|
||||
|
||||
void QApplicationPrivate::initializeMultitouch()
|
||||
@ -4391,11 +4396,14 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
|
||||
QApplication::keyboardModifiers(),
|
||||
it.value().first,
|
||||
it.value().second);
|
||||
updateTouchPointsForWidget(widget, &touchEvent);
|
||||
bool containsPress = updateTouchPointsForWidget(widget, &touchEvent);
|
||||
touchEvent.setTimestamp(timestamp);
|
||||
touchEvent.setWindow(window->windowHandle());
|
||||
touchEvent.setTarget(widget);
|
||||
|
||||
if (containsPress)
|
||||
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
|
||||
|
||||
switch (touchEvent.type()) {
|
||||
case QEvent::TouchBegin:
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ public:
|
||||
QPixmap *ignore_cursor;
|
||||
#endif
|
||||
|
||||
static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
|
||||
static bool updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
|
||||
void initializeMultitouch();
|
||||
void initializeMultitouch_sys();
|
||||
void cleanupMultitouch();
|
||||
|
Loading…
Reference in New Issue
Block a user