diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-12-10 16:44:48 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2014-12-11 14:39:00 +0100 |
commit | 8aa663e1393fcd2fa78eccc92b1acd7ba7c9cde2 (patch) | |
tree | 274ada8524dbf34376e91949c9ef74036cde8e69 /src/plugins/platforms/ios/qiosinputcontext.mm | |
parent | e415ed83af3b90be76c63b21ee281eb48995c2ed (diff) |
iOS: Only scroll to cursor on keyboard hide gesture reset if requested
Change-Id: I15b313b5f0d57358e405f16e941fc5061028c6a7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosinputcontext.mm')
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.mm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index aebf8fff8f..69bdf4aa87 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -68,6 +68,7 @@ static QUIView *focusView() @private QIOSInputContext *m_context; } +@property BOOL hasDeferredScrollToCursor; @end @implementation QIOSKeyboardListener @@ -80,6 +81,8 @@ static QUIView *focusView() m_context = context; + self.hasDeferredScrollToCursor = NO; + // UIGestureRecognizer self.enabled = NO; self.cancelsTouchesInView = NO; @@ -231,9 +234,14 @@ static QUIView *focusView() qImDebug() << "keyboard was hidden, disabling hide-keyboard gesture"; self.enabled = NO; } else { - qImDebug() << "gesture completed without triggering, scrolling view to cursor"; - m_context->scrollToCursor(); + qImDebug() << "gesture completed without triggering"; + if (self.hasDeferredScrollToCursor) { + qImDebug() << "applying deferred scroll to cursor"; + m_context->scrollToCursor(); + } } + + self.hasDeferredScrollToCursor = NO; } @end @@ -418,7 +426,8 @@ void QIOSInputContext::scrollToCursor() if (m_keyboardHideGesture.state == UIGestureRecognizerStatePossible && m_keyboardHideGesture.numberOfTouches == 1) { // Don't scroll to the cursor if the user is touching the screen and possibly // trying to trigger the hide-keyboard gesture. - qImDebug() << "preventing scrolling to cursor as we're still waiting for a possible gesture"; + qImDebug() << "deferring scrolling to cursor as we're still waiting for a possible gesture"; + m_keyboardHideGesture.hasDeferredScrollToCursor = YES; return; } |