From 53e01c4329ffbe4491ef7ef07662624f416f4a50 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 7 May 2013 14:32:03 +0200 Subject: QWidgetWindow: don't accept touch events while in popup mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø Reviewed-by: Frederik Gladhorn Reviewed-by: Samuel Rødal --- src/widgets/kernel/qwidgetwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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())); } -- cgit v1.2.3