Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qnsview_accessibility.mm
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4// This file is included from qnsview.mm, and only used to organize the code
5
8#include "qcocoaintegration.h"
9
10#include <QtGui/qaccessible.h>
11
12#include <AppKit/NSAccessibility.h>
13
14@implementation QNSView (Accessibility)
15
16- (id)childAccessibleElement
17{
18 QCocoaWindow *platformWindow = self.platformWindow;
19 if (!platformWindow || !platformWindow->window()->accessibleRoot())
20 return nil;
21
22 QAccessible::Id childId = QAccessible::uniqueId(platformWindow->window()->accessibleRoot());
23 return [QMacAccessibilityElement elementWithId:childId];
24}
25
26// The QNSView is a container that the user does not interact directly with:
27// Remove it from the user-visible accessibility tree.
28- (BOOL)accessibilityIsIgnored
29{
30 return YES;
31}
32
33- (id)accessibilityAttributeValue:(NSString *)attribute
34{
35 // activate accessibility updates
36 QCocoaIntegration::instance()->accessibility()->setActive(true);
37
38 if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
39 return NSAccessibilityUnignoredChildrenForOnlyChild([self childAccessibleElement]);
40 else
41 return [super accessibilityAttributeValue:attribute];
42}
43
44- (id)accessibilityHitTest:(NSPoint)point
45{
46 return [[self childAccessibleElement] accessibilityHitTest:point];
47}
48
49- (id)accessibilityFocusedUIElement
50{
51 return [[self childAccessibleElement] accessibilityFocusedUIElement];
52}
53
54@end
static QCocoaIntegration * instance()
QWindow * window() const
Returns the window which belongs to the QPlatformWindow.
virtual QAccessibleInterface * accessibleRoot() const
Returns the accessibility interface for the object that the window represents.
Definition qwindow.cpp:2150
QString self
Definition language.cpp:57
EGLOutputLayerEXT EGLint attribute
GLenum GLuint id
[7]