diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-06-01 21:38:16 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-06-07 09:56:45 +0000 |
commit | 038d5651940cfcd9fad017e6a4df00389b997da3 (patch) | |
tree | 302f8ff40155c31b00f9eaf1dcdb6188ae160f48 /src/quicktemplates2/qquickoverlay.cpp | |
parent | a4a570e813c72e308dd0897bcf256d19fee471a3 (diff) |
Let users disable the multi-touch support
The newly added multi-touch support can create issues, especially
together with Flickable that is unfortunately still not properly
touch-compatible. The implementation is still based on synthesized
mouse events, so things like Flickable::pressDelay that intercepts
mouse presses and re-sends sends them after a delay, does not play
well with touch-enabled controls.
The easiest way we can disable the whole thing is to make multi-
touch support a configurable feature, the same way hover support
is.
./configure -no-feature-quicktemplates2-multitouch
[...]
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... no
[ChangeLog][Templates] Added a configure feature for disabling multi-
touch support (configure -no-feature-quicktemplates2-multitouch).
Task-number: QTBUG-61144
Change-Id: I0003ae925c2a499ecb3e2a5b720088bd963d9ad3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickoverlay.cpp')
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index 15104808..a4aaa60d 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -276,6 +276,7 @@ bool QQuickOverlayPrivate::handleMouseEvent(QQuickItem *source, QMouseEvent *eve return false; } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickOverlayPrivate::handleTouchEvent(QQuickItem *source, QTouchEvent *event, QQuickPopup *target) { bool handled = false; @@ -309,6 +310,7 @@ bool QQuickOverlayPrivate::handleTouchEvent(QQuickItem *source, QTouchEvent *eve return handled; } +#endif void QQuickOverlayPrivate::addPopup(QQuickPopup *popup) { @@ -475,11 +477,13 @@ void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event) d->handleMouseEvent(this, event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickOverlay::touchEvent(QTouchEvent *event) { Q_D(QQuickOverlay); d->handleTouchEvent(this, event); } +#endif #if QT_CONFIG(wheelevent) void QQuickOverlay::wheelEvent(QWheelEvent *event) @@ -516,10 +520,12 @@ bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event) // does not have background dimming. if (item == p->dimmer || !p->popupItem->isAncestorOf(item)) { switch (event->type()) { +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: return d->handleTouchEvent(item, static_cast<QTouchEvent *>(event), popup); +#endif case QEvent::MouseButtonPress: case QEvent::MouseMove: @@ -541,6 +547,7 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event) return false; switch (event->type()) { +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: @@ -567,10 +574,13 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event) // touch events, to be able to close non-modal popups on release outside. event->accept(); return true; +#endif case QEvent::MouseButtonPress: +#if QT_CONFIG(quicktemplates2_multitouch) // do not emit pressed() twice when mouse events have been synthesized from touch events if (static_cast<QMouseEvent *>(event)->source() == Qt::MouseEventNotSynthesized) +#endif emit pressed(); QQuickWindowPrivate::get(d->window)->handleMouseEvent(static_cast<QMouseEvent *>(event)); @@ -583,8 +593,10 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event) return true; case QEvent::MouseButtonRelease: +#if QT_CONFIG(quicktemplates2_multitouch) // do not emit released() twice when mouse events have been synthesized from touch events if (static_cast<QMouseEvent *>(event)->source() == Qt::MouseEventNotSynthesized) +#endif emit released(); // allow non-modal popups to close on mouse release outside |