diff options
author | Boris Dušek <me@dusek.me> | 2015-01-05 23:06:50 +0100 |
---|---|---|
committer | Boris Dušek <me@dusek.me> | 2015-02-13 06:59:42 +0000 |
commit | 250e80ceb98e96514c886a8fb0d507fced1fc982 (patch) | |
tree | 85bae80ffae13dc1f70ffd2a59bd63ab82d4e641 /src/plugins | |
parent | c34efaf8ffa7bf661598a4b3acd2fdec9a5d17c6 (diff) |
OS X accessibility: implement AXRangeForPosition
This enables users with "Speak text under mouse after delay" set in
VoiceOver Utility > Verbosity > Announcements to hover mouse over text
in QTextEdit and have it spoken by VoiceOver. It also allows users with
Trackpad Commander on to interact with the text area (VO-Shift-arrow
down) and "touch-explore" the text while holding their finger on the
trackpad and moving it around.
[ChangeLog][QtWidgets][Accessibility][OS X] VoiceOver users of QTextEdit
can now use mouse and touch exploration on trackpad to point at text to
have spoken to them.
Change-Id: I6cfaa8b1ff2179cce027b22539ba9ee4f3ee7f3f
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 1cb51a37bc..47ba50a443 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -419,6 +419,11 @@ static void convertLineOffset(QAccessibleTextInterface *text, int &line, int &of NSRange range = [parameter rangeValue]; QString text = iface->textInterface()->text(range.location, range.location + range.length); return [[NSAttributedString alloc] initWithString: text.toNSString()]; + } else if ([attribute isEqualToString: NSAccessibilityRangeForPositionParameterizedAttribute]) { + NSPoint nsPoint = [parameter pointValue]; + QPoint point(static_cast<int>(nsPoint.x), static_cast<int>(qt_mac_flipYCoordinate(nsPoint.y))); + int offset = iface->textInterface()->offsetAtPoint(point); + return [NSValue valueWithRange:NSMakeRange(static_cast<NSUInteger>(offset), 1)]; } return nil; } |