diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-08-05 12:29:14 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-08-06 09:56:42 (GMT) |
commit | d90f1e4ff7a077daf59f5f035cf6744fe732f843 (patch) | |
tree | 457cb28948a76144215ee97a32cea3e7781bb3a4 /src/gui/widgets/qabstractscrollarea.cpp | |
parent | 5e7c47537f0f9599959388670ebd8fe910d9c0f1 (diff) | |
download | Qt-d90f1e4ff7a077daf59f5f035cf6744fe732f843.zip Qt-d90f1e4ff7a077daf59f5f035cf6744fe732f843.tar.gz Qt-d90f1e4ff7a077daf59f5f035cf6744fe732f843.tar.bz2 |
Rearranged the gesture code a bit for future native gestures on Windows.
Moved the code that subscribes to native gestures on Windows to a private
function in QWidget which will check which gestures the widget is subscribed to
and enable native gestures as requested.
Reviewed-by: trustme
Diffstat (limited to 'src/gui/widgets/qabstractscrollarea.cpp')
-rw-r--r-- | src/gui/widgets/qabstractscrollarea.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index dd92e17..e803afc 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -296,32 +296,6 @@ void QAbstractScrollAreaPrivate::init() layoutChildren(); } -void QAbstractScrollAreaPrivate::setupGestures() -{ -#ifdef Q_OS_WIN - if (!viewport) - return; - QApplicationPrivate* getQApplicationPrivateInternal(); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); - bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn - || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); - - bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn - || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); - if (qAppPriv->SetGestureConfig && (needh || needv)) { - GESTURECONFIG gc[1]; - gc[0].dwID = GID_PAN; - 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; - qAppPriv->SetGestureConfig(viewport->winId(), 0, 1, gc, sizeof(gc)); - } -#endif // Q_OS_WIN -} - void QAbstractScrollAreaPrivate::layoutChildren() { Q_Q(QAbstractScrollArea); @@ -1267,7 +1241,11 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); - setupGestures(); +#ifdef Q_OS_WIN + // Need to re-subscribe to gestures as the content changes to make sure we + // enable/disable panning when needed. + winSetupGestures(); +#endif // Q_OS_WIN } QPoint QAbstractScrollAreaPrivate::contentsOffset() const |