summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2013-05-07 14:32:03 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-07 22:43:14 +0200
commit53e01c4329ffbe4491ef7ef07662624f416f4a50 (patch)
tree0cd847a3272406d7ebf58613172c6a16f3bd716a /src
parentc0e04bad701211613269a5014c593c1d4d25a619 (diff)
QWidgetWindow: don't accept touch events while in popup mode
QWidgetWindow will always redirect mouse events to the active popup (if any). The same logic is not implemented for touch events, which means that touch events are always delivered to the widget under the finger. It is therefore possible to interact with widgets that are modally shaddowed by the popup. It is also not possible to close popups without touching them directly. This patch will ignore touch events when a popup is active, and as such, force a synthesised mouse event to be sent instead. Implementing proper touch support also for popups is out of scope for widgets. Change-Id: I023c09c3e1fd4e5495df990c11419c69ecafb8f9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index bedcfe78bf..b60648549e 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -476,6 +476,10 @@ void QWidgetWindow::handleTouchEvent(QTouchEvent *event)
if (event->type() == QEvent::TouchCancel) {
QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp());
event->accept();
+ } else if (qApp->d_func()->inPopupMode()) {
+ // Ignore touch events for popups. This will cause QGuiApplication to synthesise mouse
+ // events instead, which QWidgetWindow::handleMouseEvent will forward correctly:
+ event->ignore();
} else {
event->setAccepted(QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()));
}