Skip to content

Commit

Permalink
Cocoa: Make dictation via speech recognition work
Browse files Browse the repository at this point in the history
Returning NSNotFound from the NSTextInputClient selectedRange
implementation when there is no selection prevents
dictation from activating (for unknown reasons).

Return an empty {0, 0} range instead. Text input
methods such as Pinyin still work after this change.

[ChangeLog][macOS] Speech to text dictation now works
for Qt text input.

Change-Id: Ibf1729bdd271e8ed5ce3c9d2a0373c8ab3613d8e
Reviewed-by: Timur Pocheptsov <[email protected]>
  • Loading branch information
Morten Johan Sørvig authored and liangqi committed Nov 14, 2016
1 parent 291eba6 commit 246fe27
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/plugins/platforms/cocoa/qnsview.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1783,9 +1783,7 @@ - (NSRange) markedRange

- (NSRange) selectedRange
{
NSRange selectedRange = {NSNotFound, 0};
selectedRange.location = NSNotFound;
selectedRange.length = 0;
NSRange selectedRange = {0, 0};

QObject *fo = QGuiApplication::focusObject();
if (!fo)
Expand Down

0 comments on commit 246fe27

Please sign in to comment.