summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-24 07:01:08 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-24 09:18:25 (GMT)
commit6bc7af414219e92ccec45ec45d47e6fe432ad048 (patch)
treedd229c087c1c0be4b66533ca262bdb0683a820e7 /src/gui/widgets
parentaceeaa1dcbce8b1fbd869eb64a1f59b928d59e4e (diff)
downloadQt-6bc7af414219e92ccec45ec45d47e6fe432ad048.zip
Qt-6bc7af414219e92ccec45ec45d47e6fe432ad048.tar.gz
Qt-6bc7af414219e92ccec45ec45d47e6fe432ad048.tar.bz2
Gestures, Mac: remove pan gesture from qabstractscrollarea
On Mac there really is no native pan gesture. Instead, this gesture is delivered as mouse wheel events. So adding a pan gesture to qabstractscrollarea means that it will get both wheel and pan events. And both will try to move the viweport. I think that the correct thing to do here is to not apply a pan gesture by default on all scroll areas.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp11
-rw-r--r--src/gui/widgets/qabstractscrollarea_p.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 533a56b..28435ef 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -159,9 +159,9 @@ QT_BEGIN_NAMESPACE
QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate()
:hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded),
viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0),
- xoffset(0), yoffset(0), viewportFilter(0), panGesture(0)
+ xoffset(0), yoffset(0), viewportFilter(0)
#ifdef Q_WS_WIN
- , singleFingerPanEnabled(false)
+ , panGesture(0), singleFingerPanEnabled(false)
#endif
{
}
@@ -295,8 +295,10 @@ void QAbstractScrollAreaPrivate::init()
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layoutChildren();
- panGesture = new QPanGesture(q);
+#ifdef Q_WS_WIN
+ panGesture = new QPanGesture(viewport);
QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
+#endif // Q_WS_WIN
}
#ifdef Q_WS_WIN
@@ -547,6 +549,9 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
if (isVisible())
d->viewport->show();
QMetaObject::invokeMethod(this, "setupViewport", Q_ARG(QWidget *, widget));
+#ifdef Q_WS_WIN
+ d->panGesture->setGestureTarget(widget);
+#endif
delete oldViewport;
}
}
diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h
index 211b7a7..a5acdd1 100644
--- a/src/gui/widgets/qabstractscrollarea_p.h
+++ b/src/gui/widgets/qabstractscrollarea_p.h
@@ -102,8 +102,8 @@ public:
QScopedPointer<QObject> viewportFilter;
virtual void _q_gestureTriggered();
- QPanGesture *panGesture;
#ifdef Q_WS_WIN
+ QPanGesture *panGesture;
bool singleFingerPanEnabled;
void setSingleFingerPanEnabled(bool on = true);
#endif