summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_win.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-08-05 16:57:25 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-08-10 12:21:44 (GMT)
commit6826490774d66e0470fc1e5848ab89b3a0d0bb86 (patch)
tree553656766c1625ca837e3d07f59f77e6f3461ace /src/gui/kernel/qwidget_win.cpp
parent47f58dfad1eb7fe61a523597023df33f3d320377 (diff)
downloadQt-6826490774d66e0470fc1e5848ab89b3a0d0bb86.zip
Qt-6826490774d66e0470fc1e5848ab89b3a0d0bb86.tar.gz
Qt-6826490774d66e0470fc1e5848ab89b3a0d0bb86.tar.bz2
Implemented QPinchGesture.
Added a new standard gesture, which is implemented using a native zoom and rotate gestures on Windows and with a direct touch event handling on other platforms. Improved pan support - we subscribe to native pan gesture only when it's really needed, and we pass proper flags for single finger horizontal/vertical panning. Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'src/gui/kernel/qwidget_win.cpp')
-rw-r--r--src/gui/kernel/qwidget_win.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 7cfa111..510df7f 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1160,6 +1160,8 @@ void QWidgetPrivate::show_sys()
data.window_state |= Qt::WindowMaximized;
}
+ winSetupGestures();
+
invalidateBuffer(q->rect());
}
#endif //Q_WS_WINCE
@@ -2058,8 +2060,11 @@ void QWidgetPrivate::winSetupGestures()
Q_Q(QWidget);
if (!q)
return;
- extern QApplicationPrivate* getQApplicationPrivateInternal();
- QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ q->setAttribute(Qt::WA_DontCreateNativeAncestors);
+ q->setAttribute(Qt::WA_NativeWindow);
+ if (!q->isVisible())
+ return;
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
bool needh = false;
bool needv = false;
bool singleFingerPanEnabled = false;
@@ -2072,34 +2077,43 @@ void QWidgetPrivate::winSetupGestures()
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()));
+ 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];
+ GESTURECONFIG gc[3];
+ memset(gc, 0, sizeof(gc));
gc[0].dwID = GID_PAN;
- if (gestures.pan || needh || needv) {
+ if (gestures.pan) {
gc[0].dwWant = GC_PAN;
- gc[0].dwBlock = 0;
if (needv && singleFingerPanEnabled)
gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+ else
+ gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
if (needh && singleFingerPanEnabled)
gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+ else
+ gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
} else {
- gc[0].dwWant = 0;
gc[0].dwBlock = GC_PAN;
}
gc[1].dwID = GID_ZOOM;
- if (gestures.pinch) {
+ if (gestures.pinch)
gc[1].dwWant = GC_ZOOM;
- gc[1].dwBlock = 0;
- }
+ else
+ gc[1].dwBlock = GC_ZOOM;
+ gc[2].dwID = GID_ROTATE;
+ if (gestures.pinch)
+ gc[2].dwWant = GC_ROTATE;
+ else
+ gc[2].dwBlock = GC_ROTATE;
+
Q_ASSERT(winid);
qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0]));
}