diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-12-14 15:27:25 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-12-15 09:36:06 (GMT) |
commit | 1f4a4cca0067b1d4a9784f00e41c3fc1aca1f712 (patch) | |
tree | 5162863461c5489aa5c7ad15da95f7c915c91ded /src/gui/kernel/qapplication.cpp | |
parent | 7a3c595421b98087da638a5e706320d0d936d828 (diff) | |
download | Qt-1f4a4cca0067b1d4a9784f00e41c3fc1aca1f712.zip Qt-1f4a4cca0067b1d4a9784f00e41c3fc1aca1f712.tar.gz Qt-1f4a4cca0067b1d4a9784f00e41c3fc1aca1f712.tar.bz2 |
Optimisations to gesture event filtering.
Now we don't filter some events through the gesture manager and use QMap
instead of QHash, which seem to be a bit faster in our cases.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 8c63968..bd13423 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3629,12 +3629,46 @@ bool QApplication::notify(QObject *receiver, QEvent *e) // walk through parents and check for gestures if (qt_gestureManager) { - if (receiver->isWidgetType()) { - if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) - return true; - } else if (QGesture *gesture = qobject_cast<QGesture *>(receiver)) { - if (qt_gestureManager->filterEvent(gesture, e)) - return true; + switch (e->type()) { + case QEvent::Paint: + case QEvent::MetaCall: + case QEvent::DeferredDelete: + case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave: + case QEvent::Drop: case QEvent::DragResponse: + case QEvent::ChildAdded: case QEvent::ChildPolished: +#ifdef QT3_SUPPORT + case QEvent::ChildInsertedRequest: + case QEvent::ChildInserted: + case QEvent::LayoutHint: +#endif + case QEvent::ChildRemoved: + case QEvent::UpdateRequest: + case QEvent::UpdateLater: + case QEvent::AccessibilityPrepare: + case QEvent::LocaleChange: + case QEvent::Style: + case QEvent::IconDrag: + case QEvent::StyleChange: + case QEvent::AccessibilityHelp: + case QEvent::AccessibilityDescription: + case QEvent::GraphicsSceneDragEnter: + case QEvent::GraphicsSceneDragMove: + case QEvent::GraphicsSceneDragLeave: + case QEvent::GraphicsSceneDrop: + case QEvent::DynamicPropertyChange: + case QEvent::NetworkReplyUpdated: + break; + default: + if (receiver->isWidgetType()) { + if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) + return true; + } else { + // a special case for events that go to QGesture objects. + // We pass the object to the gesture manager and it'll figure + // out if it's QGesture or not. + if (qt_gestureManager->filterEvent(receiver, e)) + return true; + } } } |