path: root/src/android/jar
diff options
authorChristian Strømme <>2014-06-16 13:35:21 +0200
committerChristian Stromme <>2014-06-30 16:58:57 +0200
commit50cf698b76bd140a4ada4058f9abbee837289a75 (patch)
tree2bf8b364abb6a4993c9b13342c92e1315019cf57 /src/android/jar
parent8f96ce37333b3034f2eef1366f9eea4a47a479ed (diff)
Android: Fix hover-event handling.
The accessibility delegate needs to intercept the hover events before the view gets them, but since the dispatchHoverEvent() method was added in API level 14 and we build with API level < 14, we can't call the super class implementation (e.g., when the event isn't handled by the accessibility delegate). In the previous implementation we where trying to solve this by using the reflection API, but that does not provide a solution to call the super class implementation (Note: It's possible with JDK 7 or newer), so the code would call itself recursively and we would eventually get a stack overflow exception. This change uses the OnHoverListener class to intercept the hover events, this way we avoid "overriding" the dispatchHoverEvent() method in QtSurface and therefore avoid the problem it causes. Task-number: QTBUG-38905 Change-Id: I8b3cbad718d8524042397bb877e39e3005bfb4ce Reviewed-by: Frederik Gladhorn <>
Diffstat (limited to 'src/android/jar')
1 files changed, 0 insertions, 18 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/ b/src/android/jar/src/org/qtproject/qt5/android/
index 45a80a3dbb..ca3f20f11b 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/
+++ b/src/android/jar/src/org/qtproject/qt5/android/
@@ -110,24 +110,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
- public boolean dispatchHoverEvent(MotionEvent event) {
- // Always attempt to dispatch hover events to accessibility first.
- if (m_accessibilityDelegate != null) {
- try {
- Method dispHoverA11y = m_accessibilityDelegate.getClass().getMethod("dispatchHoverEvent", MotionEvent.class);
- boolean ret = (Boolean) dispHoverA11y.invoke(m_accessibilityDelegate, event);
- if (ret)
- return true;
- SurfaceView view = (SurfaceView) this;
- Method dispHoverView = view.getClass().getMethod("dispatchHoverEvent", MotionEvent.class);
- return (Boolean) dispHoverView.invoke(view, event);
- } catch (Exception e) {
- Log.w("Qt A11y", "EXCEPTION in dispatchHoverEvent for Accessibility: " + e);
- }
- }
- return false;
- }
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)