From 513fcf0d2ad3328830dbf73dc2a55ad1487393c0 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 1 Feb 2022 17:17:12 +0100 Subject: Android A11Y: execute C++ code on main Qt thread The C++ code, which is called from Java, was executed on Java thread. However Qt has its own main GUI thread, where all GUI elements and their accessibility instances are created. As a result we have threading issues when accessing A11Y objects from Java thread. This patch uses QMetaObject::invokeMethod calls to dispatch all the critical parts of the C++ code to the main thread. It uses BlockingQueuedConnection, so that Java thread can still use these methods synchronously. The proper context is based on the m_accessibilityContext object, which is created as a child of the base accessibility QObject of the application (which is the QGuiApplication instance in most cases). Task-number: QTBUG-95764 Change-Id: Iff4f3f2645657f6aca426fa19ccc86a2cbe4d4d0 Reviewed-by: Assam Boudjelthia Reviewed-by: Jarkko Koivikko (cherry picked from commit e0c61193ea8f6462192d2ef7f1d48d8fa3e38c99) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/android/qandroidplatformaccessibility.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms/android/qandroidplatformaccessibility.h') diff --git a/src/plugins/platforms/android/qandroidplatformaccessibility.h b/src/plugins/platforms/android/qandroidplatformaccessibility.h index e165ce7019..81d816c8b7 100644 --- a/src/plugins/platforms/android/qandroidplatformaccessibility.h +++ b/src/plugins/platforms/android/qandroidplatformaccessibility.h @@ -52,6 +52,7 @@ public: ~QAndroidPlatformAccessibility(); void notifyAccessibilityUpdate(QAccessibleEvent *event) override; + void setRootObject(QObject *obj) override; }; QT_END_NAMESPACE -- cgit v1.2.3