iOS: fix crash when focusWindow changes while keyboard is open
It turns out we cannot rely on QGuiApplication::focusWindow() to be non-zero at all times (e.g when pop-ups are closing etc). So instead use m_focusView.qwindow which points to a valid QWindow. This window is the same as QGuiApplication::focusWindow most of the time, except when a focus window closes. For those cases we get a new call to scrollRootView immediately after with m_focusView updated to reflect the new focusWindow. Task-number: QTBUG-35339 Change-Id: Icb3a8d3140af1f1904495a9289c8c26ab79e70f6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
parent
32f71db1bd
commit
bd9cf0b7b9
@ -270,7 +270,7 @@ void QIOSInputContext::scrollRootView()
|
||||
&& m_keyboardListener->m_keyboardVisibleAndDocked
|
||||
&& m_focusView.window == view.window) {
|
||||
QRectF cursorRect = qGuiApp->inputMethod()->cursorRectangle();
|
||||
cursorRect.translate(qGuiApp->focusWindow()->geometry().topLeft());
|
||||
cursorRect.translate(m_focusView.qwindow->geometry().topLeft());
|
||||
qreal keyboardY = m_keyboardListener->m_keyboardEndRect.y();
|
||||
int statusBarY = qGuiApp->primaryScreen()->availableGeometry().y();
|
||||
const int margin = 20;
|
||||
|
Loading…
x
Reference in New Issue
Block a user