summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-08-05 12:29:14 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-08-06 09:56:42 (GMT)
commitd90f1e4ff7a077daf59f5f035cf6744fe732f843 (patch)
tree457cb28948a76144215ee97a32cea3e7781bb3a4 /src/gui/widgets
parent5e7c47537f0f9599959388670ebd8fe910d9c0f1 (diff)
downloadQt-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')
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp32
-rw-r--r--src/gui/widgets/qabstractscrollarea.h1
-rw-r--r--src/gui/widgets/qabstractscrollarea_p.h1
3 files changed, 6 insertions, 28 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
diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h
index 3ec41d1..c7441c1 100644
--- a/src/gui/widgets/qabstractscrollarea.h
+++ b/src/gui/widgets/qabstractscrollarea.h
@@ -130,6 +130,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars())
friend class QStyleSheetStyle;
+ friend class QWidgetPrivate;
};
#endif // QT_NO_SCROLLAREA
diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h
index aef8ac5..9a6b923 100644
--- a/src/gui/widgets/qabstractscrollarea_p.h
+++ b/src/gui/widgets/qabstractscrollarea_p.h
@@ -103,7 +103,6 @@ public:
#ifdef Q_WS_WIN
bool singleFingerPanEnabled;
#endif
- void setupGestures();
};
class QAbstractScrollAreaFilter : public QObject