diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-02-06 13:03:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-06 14:20:11 +0100 |
commit | 577909b59a52c7d2755d2ce439895641ca93c4ad (patch) | |
tree | 6911b578ff573b1a2ffa3aa5bcc8e7217fc05970 /src/plugins/platforms/ios | |
parent | 865ef951077a641768093ed56950eb39d6b59e63 (diff) |
iOS: return correct uiview for IM rectangles
UITextView has a property for specifying which UIView the CGRects
you return should be aligned with. This makes a difference for
widgets when not using alien, since then the view that draws the
text will usually not be the same as the view that backs
the top level QWindow.
Change-Id: I240d63c98544c39308cd91465ee84351e7d7d1f4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r-- | src/plugins/platforms/ios/quiview_textinput.mm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/quiview_textinput.mm b/src/plugins/platforms/ios/quiview_textinput.mm index 64e93be7f2..d0088d415a 100644 --- a/src/plugins/platforms/ios/quiview_textinput.mm +++ b/src/plugins/platforms/ios/quiview_textinput.mm @@ -336,6 +336,18 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables); return t - f; } +- (UIView *)textInputView +{ + // iOS expects rects we return from other UITextInput methods + // to be relative to the view this method returns. + // Since QInputMethod returns rects relative to the top level + // QWindow, that is also the view we need to return. + QPlatformWindow *topLevel = m_qioswindow; + while (QPlatformWindow *p = topLevel->parent()) + topLevel = p; + return reinterpret_cast<UIView *>(topLevel->winId()); +} + - (CGRect)firstRectForRange:(UITextRange *)range { QObject *focusObject = QGuiApplication::focusObject(); |