macOS: Organize QNSView accessibility code like the rest of the class
Drive-by style-fixes were applied as well. Change-Id: I22c17925be41eeaac692ab776dd5b46791265cb3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
2d01de4e87
commit
1918674309
@ -8,7 +8,6 @@ SOURCES += main.mm \
|
||||
qcocoawindow.mm \
|
||||
qnsview.mm \
|
||||
qnswindow.mm \
|
||||
qnsviewaccessibility.mm \
|
||||
qnswindowdelegate.mm \
|
||||
qcocoanativeinterface.mm \
|
||||
qcocoaeventdispatcher.mm \
|
||||
|
@ -363,6 +363,9 @@
|
||||
#include "qnsview_keys.mm"
|
||||
#include "qnsview_complextext.mm"
|
||||
#include "qnsview_menus.mm"
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include "qnsview_accessibility.mm"
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
||||
|
@ -37,22 +37,20 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qnsview.h"
|
||||
#include "qcocoahelpers.h"
|
||||
// This file is included from qnsview.mm, and only used to organize the code
|
||||
|
||||
#include "qcocoaaccessibility.h"
|
||||
#include "qcocoaaccessibilityelement.h"
|
||||
#include "qcocoaintegration.h"
|
||||
|
||||
#include <QtGui/qaccessible.h>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#import <AppKit/NSAccessibility.h>
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
@implementation QT_MANGLE_NAMESPACE(QNSView) (Accessibility)
|
||||
|
||||
@implementation QNSView (QNSViewAccessibility)
|
||||
|
||||
- (id)childAccessibleElement {
|
||||
- (id)childAccessibleElement
|
||||
{
|
||||
QCocoaWindow *platformWindow = self.platformWindow;
|
||||
if (!platformWindow || !platformWindow->window()->accessibleRoot())
|
||||
return nil;
|
||||
@ -63,29 +61,30 @@
|
||||
|
||||
// The QNSView is a container that the user does not interact directly with:
|
||||
// Remove it from the user-visible accessibility tree.
|
||||
- (BOOL)accessibilityIsIgnored {
|
||||
- (BOOL)accessibilityIsIgnored
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)accessibilityAttributeValue:(NSString *)attribute {
|
||||
- (id)accessibilityAttributeValue:(NSString *)attribute
|
||||
{
|
||||
// activate accessibility updates
|
||||
QCocoaIntegration::instance()->accessibility()->setActive(true);
|
||||
|
||||
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
|
||||
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
|
||||
return NSAccessibilityUnignoredChildrenForOnlyChild([self childAccessibleElement]);
|
||||
} else {
|
||||
else
|
||||
return [super accessibilityAttributeValue:attribute];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)accessibilityHitTest:(NSPoint)point {
|
||||
return [[self childAccessibleElement] accessibilityHitTest: point];
|
||||
- (id)accessibilityHitTest:(NSPoint)point
|
||||
{
|
||||
return [[self childAccessibleElement] accessibilityHitTest:point];
|
||||
}
|
||||
|
||||
- (id)accessibilityFocusedUIElement {
|
||||
- (id)accessibilityFocusedUIElement
|
||||
{
|
||||
return [[self childAccessibleElement] accessibilityFocusedUIElement];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // QT_NO_ACCESSIBILITY
|
Loading…
Reference in New Issue
Block a user