summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qstandardgestures.cpp
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/kernel/qstandardgestures.cpp
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/kernel/qstandardgestures.cpp')
-rw-r--r--src/gui/kernel/qstandardgestures.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 4753416..2a5e7e8 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -46,11 +46,13 @@
#include <qscrollbar.h>
#include <private/qapplication_p.h>
#include <private/qevent_p.h>
+#include <private/qwidget_p.h>
QT_BEGIN_NAMESPACE
#ifdef Q_WS_WIN
QApplicationPrivate* getQApplicationPrivateInternal();
+QWidgetPrivate *qt_widget_private(QWidget *widget);
#endif
/*!
@@ -71,32 +73,38 @@ QApplicationPrivate* getQApplicationPrivateInternal();
QPanGesture::QPanGesture(QWidget *parent)
: QGesture(*new QPanGesturePrivate, parent)
{
-#ifdef Q_WS_WIN
if (parent) {
QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
qAppPriv->widgetGestures[parent].pan = this;
- }
+#ifdef Q_WS_WIN
+ qt_widget_private(parent)->winSetupGestures();
#endif
+ }
}
/*! \internal */
bool QPanGesture::event(QEvent *event)
{
-#ifdef Q_WS_WIN
- QApplicationPrivate* getQApplicationPrivateInternal();
switch (event->type()) {
case QEvent::ParentAboutToChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent()))
+ if (QWidget *w = qobject_cast<QWidget*>(parent())) {
getQApplicationPrivateInternal()->widgetGestures[w].pan = 0;
+#ifdef Q_WS_WIN
+ qt_widget_private(w)->winSetupGestures();
+#endif
+ }
break;
case QEvent::ParentChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent()))
+ if (QWidget *w = qobject_cast<QWidget*>(parent())) {
getQApplicationPrivateInternal()->widgetGestures[w].pan = this;
+#ifdef Q_WS_WIN
+ qt_widget_private(w)->winSetupGestures();
+#endif
+ }
break;
default:
break;
}
-#endif
#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
Q_D(QPanGesture);