diff options
Diffstat (limited to 'src/gui/kernel/qwidget_win.cpp')
-rw-r--r-- | src/gui/kernel/qwidget_win.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index d5ce40b..49254ef 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -56,6 +56,10 @@ #include "private/qbackingstore_p.h" #include "private/qwindowsurface_raster_p.h" +#include "qscrollbar.h" +#include "qabstractscrollarea.h" +#include <private/qabstractscrollarea_p.h> + #include <qdebug.h> #include <private/qapplication_p.h> @@ -2053,6 +2057,58 @@ void QWidgetPrivate::registerTouchWindow() QApplicationPrivate::RegisterTouchWindow(q->effectiveWinId(), 0); } +void QWidgetPrivate::winSetupGestures() +{ + Q_Q(QWidget); + if (!q) + return; + extern QApplicationPrivate* getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + bool needh = false; + bool needv = false; + bool singleFingerPanEnabled = false; + QStandardGestures gestures = qAppPriv->widgetGestures[q]; + WId winid = 0; + + if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q)) { + winid = asa->viewport()->winId(); + QScrollBar *hbar = asa->horizontalScrollBar(); + QScrollBar *vbar = asa->verticalScrollBar(); + Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy(); + Qt::ScrollBarPolicy vbarpolicy = asa->verticalScrollBarPolicy(); + needh = (hbarpolicy == Qt::ScrollBarAlwaysOn + || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); + needv = (vbarpolicy == Qt::ScrollBarAlwaysOn + || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); + singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; + } else { + winid = q->winId(); + } + if (qAppPriv->SetGestureConfig) { + GESTURECONFIG gc[2]; + gc[0].dwID = GID_PAN; + if (gestures.pan || needh || needv) { + gc[0].dwWant = GC_PAN; + gc[0].dwBlock = 0; + if (needv && singleFingerPanEnabled) + gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; + if (needh && singleFingerPanEnabled) + gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; + } else { + gc[0].dwWant = 0; + gc[0].dwBlock = GC_PAN; + } + + gc[1].dwID = GID_ZOOM; + if (gestures.pinch) { + gc[1].dwWant = GC_ZOOM; + gc[1].dwBlock = 0; + } + Q_ASSERT(winid); + qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); + } +} + QT_END_NAMESPACE #ifdef Q_WS_WINCE |