diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-03-05 10:32:59 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-06 12:21:14 +0100 |
commit | 2bac49265efcf8faabc3756d1a3e405a3d336f68 (patch) | |
tree | 43b5d87e0641172ba8281be263e3274d491f4990 | |
parent | 04ef22b9ee71c42d8ff67d23ebeab704c38bec1e (diff) |
Tablet target widget isn't always the same as its widget window
In this scenario there is a widget with a QPushButton inside, and you
click the pushbutton with the tablet. The target of the event is the
pushbutton, but when you click it, the window is destroyed. The
widgetwindow destructor cannot check the pushbutton's window() because
it has already been destroyed. So it seems we have to store both
widgets: the actual target and the parent widget which has the window.
Task-number: QTBUG-36848
Change-Id: I37d8fb03743f3e501d695342edc42de104777b18
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 3cc48b442d..e50736d6b8 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -59,6 +59,7 @@ Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets(); QWidget *qt_button_down = 0; // widget got last button-down static QWidget *qt_tablet_target = 0; +static QWidget *qt_tablet_target_window = 0; // popup control QWidget *qt_popup_down = 0; // popup that contains the pressed widget @@ -103,8 +104,10 @@ QWidgetWindow::QWidgetWindow(QWidget *widget) QWidgetWindow::~QWidgetWindow() { - if (m_widget == qt_tablet_target) + if (m_widget == qt_tablet_target_window) { qt_tablet_target = 0; + qt_tablet_target_window = 0; + } } #ifndef QT_NO_ACCESSIBILITY @@ -774,6 +777,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) widget = m_widget; qt_tablet_target = widget; + qt_tablet_target_window = m_widget; } if (qt_tablet_target) { @@ -786,8 +790,10 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); } - if (event->type() == QEvent::TabletRelease) + if (event->type() == QEvent::TabletRelease) { qt_tablet_target = 0; + qt_tablet_target_window = 0; + } } #endif // QT_NO_TABLETEVENT |