iOS: don't store reference to focus object
Sometimes focus object is updated after we get a callback that the cursor rectangle has changed. And there is no reason to keep a local reference to it. Since we also send events to the qApp->focusObject from UIView_textInput, we now end up more consistent. Change-Id: I3976175aae4e3f346be9bc5b771ac0fdefc03ae6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>bb10
parent
8dcb72fd1e
commit
e33eb15811
|
|
@ -77,7 +77,6 @@ private:
|
|||
QIOSKeyboardListener *m_keyboardListener;
|
||||
QUIView *m_focusView;
|
||||
bool m_hasPendingHideRequest;
|
||||
QObject *m_focusObject;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@ QIOSInputContext::QIOSInputContext()
|
|||
, m_keyboardListener([[QIOSKeyboardListener alloc] initWithQIOSInputContext:this])
|
||||
, m_focusView(0)
|
||||
, m_hasPendingHideRequest(false)
|
||||
, m_focusObject(0)
|
||||
{
|
||||
if (isQtApplication())
|
||||
connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::cursorRectangleChanged);
|
||||
|
|
@ -227,8 +226,6 @@ bool QIOSInputContext::isInputPanelVisible() const
|
|||
|
||||
void QIOSInputContext::setFocusObject(QObject *focusObject)
|
||||
{
|
||||
m_focusObject = focusObject;
|
||||
|
||||
if (!focusObject || !m_focusView || !m_focusView.isFirstResponder) {
|
||||
scroll(0);
|
||||
return;
|
||||
|
|
@ -262,7 +259,7 @@ void QIOSInputContext::cursorRectangleChanged()
|
|||
// itself moves, we need to ask the focus object for ImCursorRectangle:
|
||||
static QPoint prevCursor;
|
||||
QInputMethodQueryEvent queryEvent(Qt::ImCursorRectangle);
|
||||
QCoreApplication::sendEvent(m_focusObject, &queryEvent);
|
||||
QCoreApplication::sendEvent(qApp->focusObject(), &queryEvent);
|
||||
QPoint cursor = queryEvent.value(Qt::ImCursorRectangle).toRect().topLeft();
|
||||
if (cursor != prevCursor)
|
||||
scrollToCursor();
|
||||
|
|
|
|||
Loading…
Reference in New Issue