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>
bb10
Richard Moe Gustavsen 2014-02-06 13:03:37 +01:00 committed by The Qt Project
parent 865ef95107
commit 577909b59a
1 changed files with 12 additions and 0 deletions

View File

@ -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();