From 69a8d1293ad69faaef120f1e46ab46fd8cd70318 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 7 Apr 2023 20:36:59 +0200 Subject: [PATCH] macOS Accessibility: don't create an unnecessary interface We only need to compare elements to determine whether this element has focus. Task-number: QTBUG-34337 Pick-to: 6.5 Change-Id: Ic1388ac00381735acfbf1e5877a658f4bd534dfb Reviewed-by: Timur Pocheptsov --- .../platforms/cocoa/qcocoaaccessibilityelement.mm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 2cfdd31ce0..406878d893 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -249,12 +249,9 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of - (BOOL)isAccessibilityFocused { - if (QAccessibleInterface *iface = self.qtInterface) { - // Just check if the app thinks we're focused. - id focusedElement = NSApp.accessibilityApplicationFocusedUIElement; - return [focusedElement isEqual:self]; - } - return false; + // Just check if the app thinks we're focused. + id focusedElement = NSApp.accessibilityApplicationFocusedUIElement; + return [focusedElement isEqual:self]; } // attributes