summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-03-05 17:41:10 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-05-11 13:41:38 (GMT)
commitfc84e3a05d01cce25949c605fc56dba4b4d3d183 (patch)
tree7ea7af86751c5828b61f025edcd830d1efc3491c /src/gui/kernel
parentb349831a5ae7bca80f22240b1ed204dd3d87c71f (diff)
downloadQt-fc84e3a05d01cce25949c605fc56dba4b4d3d183.zip
Qt-fc84e3a05d01cce25949c605fc56dba4b4d3d183.tar.gz
Qt-fc84e3a05d01cce25949c605fc56dba4b4d3d183.tar.bz2
Fixes: improved gesture manager event filtering.
Details: Several fixes - parsing only spontaneous mouse events and send gesture events to QGraphicsSceneItems according to their z-order
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index b39cbc3..88871a4 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -3706,28 +3706,31 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QMouseEvent* mouse = static_cast<QMouseEvent*>(e);
QPoint relpos = mouse->pos();
- if (QApplication::testAttribute(Qt::AA_EnableGestures)) {
- if (!gestureManager)
- gestureManager = new QGestureManager;
- // if we are in gesture mode, we send all mouse events
- // directly to gesture recognizer.
- if (gestureManager->inGestureMode()) {
- // ### should I send events through all application event filters?
- if (gestureManager->filterEvent(e))
- return true;
- }
- if (w && (mouse->type() != QEvent::MouseMove || mouse->buttons() != 0)) {
- // find the gesture target widget
- QWidget *target = w;
- while (target && target->gestures().isEmpty())
- target = target->parentWidget();
- if (target) {
- gestureManager->setGestureTargetWidget(target);
- res = gestureManager->filterEvent(e);
+ if (e->spontaneous()) {
+ if (QApplication::testAttribute(Qt::AA_EnableGestures)) {
+ QWidget *w = static_cast<QWidget*>(receiver);
+ if (!gestureManager)
+ gestureManager = new QGestureManager;
+ // if we are in gesture mode, we send all mouse events
+ // directly to gesture recognizer.
+ if (gestureManager->inGestureMode()) {
+ if (gestureManager->filterEvent(e))
+ return true;
+ } else {
+ QMouseEvent* mouse = static_cast<QMouseEvent*>(e);
+ if (w && (mouse->type() != QEvent::MouseMove || mouse->buttons() != 0)) {
+ // find the gesture target widget
+ QWidget *target = w;
+ while (target && target->gestures().isEmpty())
+ target = target->parentWidget();
+ if (target) {
+ gestureManager->setGestureTargetWidget(target);
+ if (gestureManager->filterEvent(e))
+ return true;
+ }
+ }
}
}
- }
- if (e->spontaneous()) {
if (e->type() == QEvent::MouseButtonPress) {
QApplicationPrivate::giveFocusAccordingToFocusPolicy(w,
Qt::ClickFocus,