diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-08-21 09:14:33 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-08-21 12:52:13 (GMT) |
commit | 1a78099a6b5523ad913caf9d1700a4f6ffbea485 (patch) | |
tree | 3d0dc36cd2ba0496dbe42d21caa5034f3fb94678 /src/gui/kernel/qwidget_win.cpp | |
parent | 09878f0d63000a2920458884d5ae0d765939395e (diff) | |
download | Qt-1a78099a6b5523ad913caf9d1700a4f6ffbea485.zip Qt-1a78099a6b5523ad913caf9d1700a4f6ffbea485.tar.gz Qt-1a78099a6b5523ad913caf9d1700a4f6ffbea485.tar.bz2 |
Fixed gesture handling on Windows when there are no alien widgets
Use the proper winid to set gesture configuration to.
Reviewed-by: trustme
Diffstat (limited to 'src/gui/kernel/qwidget_win.cpp')
-rw-r--r-- | src/gui/kernel/qwidget_win.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index bf2abc8..ef0fe6a 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2074,7 +2074,13 @@ void QWidgetPrivate::winSetupGestures() WId winid = 0; if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q)) { - winid = asa->viewport()->winId(); + winid = asa->viewport()->internalWinId(); + if (!winid) { + QWidget *nativeParent = asa->viewport()->nativeParentWidget(); + if (!nativeParent) + return; + winid = nativeParent->internalWinId(); + } QScrollBar *hbar = asa->horizontalScrollBar(); QScrollBar *vbar = asa->verticalScrollBar(); Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy(); @@ -2085,9 +2091,13 @@ void QWidgetPrivate::winSetupGestures() (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; } else { - winid = q->winId(); + winid = q->internalWinId(); + if (!winid) { + if (QWidget *nativeParent = q->nativeParentWidget()) + winid = nativeParent->internalWinId(); + } } - if (qAppPriv->SetGestureConfig) { + if (winid && qAppPriv->SetGestureConfig) { GESTURECONFIG gc[3]; memset(gc, 0, sizeof(gc)); gc[0].dwID = GID_PAN; @@ -2116,7 +2126,6 @@ void QWidgetPrivate::winSetupGestures() else gc[2].dwBlock = GC_ROTATE; - Q_ASSERT(winid); qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } } |