iOS: Guard against request for textInputView without focus window
Change-Id: I7b8df07fffef1cc948f6720685234540a20ccc81 Fixes: QTBUG-79316 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 9ac156c90b92a981f70929e081c64083b14e9a57) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
1e5566c2e9
commit
6cddd0e8cf
@ -781,12 +781,16 @@
|
|||||||
|
|
||||||
- (UIView *)textInputView
|
- (UIView *)textInputView
|
||||||
{
|
{
|
||||||
|
auto *focusWindow = QGuiApplication::focusWindow();
|
||||||
|
if (!focusWindow)
|
||||||
|
return nil;
|
||||||
|
|
||||||
// iOS expects rects we return from other UITextInput methods
|
// iOS expects rects we return from other UITextInput methods
|
||||||
// to be relative to the view this method returns.
|
// to be relative to the view this method returns.
|
||||||
// Since QInputMethod returns rects relative to the top level
|
// Since QInputMethod returns rects relative to the top level
|
||||||
// QWindow, that is also the view we need to return.
|
// QWindow, that is also the view we need to return.
|
||||||
Q_ASSERT(qApp->focusWindow()->handle());
|
Q_ASSERT(focusWindow->handle());
|
||||||
QPlatformWindow *topLevel = qApp->focusWindow()->handle();
|
QPlatformWindow *topLevel = focusWindow->handle();
|
||||||
while (QPlatformWindow *p = topLevel->parent())
|
while (QPlatformWindow *p = topLevel->parent())
|
||||||
topLevel = p;
|
topLevel = p;
|
||||||
return reinterpret_cast<UIView *>(topLevel->winId());
|
return reinterpret_cast<UIView *>(topLevel->winId());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user