summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosinputcontext.mm
Commit message (Collapse)AuthorAgeFilesLines
...
* iOS: animate screen from current in-flight geometryRichard Moe Gustavsen2014-03-291-1/+1
| | | | | | | | | | | | If you show/hide the keyboard quickly while we scroll the screen, the scroll will appear to jump. The reason is that the screen animation will start from where the model layer is at, and not the presentation layer. So specify that the animation should start from the current state of the presentation layer. Change-Id: I3db87ab11aab583eb50784b0c0a03a9a07c8b822 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* iOS: keep keyboard rect in syncRichard Moe Gustavsen2014-03-291-3/+0
| | | | | | | | | | | | | | If you resign/become first responder several times while the keyboard is animating (e.g changing focus between focus objects while the keyboard is animating), iOS will short-cut the whole animation, and jump directly to keyboard end-state. For that reason, we always need to handle keyboardRectChanged, and not bail out early. This is fine, since the guard we had was really only meant for keyboardWillShow/Hide in the first place. Change-Id: I3a3d1e7061962286c538360029ed38410dc0f347 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* iOS: implement 'close keyboard' gestureRichard Moe Gustavsen2014-03-211-3/+27
| | | | | | | | | | | | | | | | | | | | | | Before this patch there were no way for the user to hide the keyboard on iPhone for multi-line edit fields unless the app had a separate button added for it. And even that would be problematic since we scroll the screen (and perhaps the button) to track the cursor. This patch implements a gesture that resembles the 'hide keyboard' gesture that UIScrollView implements on iOS 7. Note that if you start the gesture inside the edit field, you will start selecting text as well. This will also cause the cursor to move and the screen to scroll. After some testing and failing, it seems like we need to live with such artifacts until we do get around to do the only sensible thing; fix up how we do text selection on touch platforms. Working around it becomes just to messy. Change-Id: I1c0d9c88ff1f5430587a49591f165b9708e5dc60 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: update keyboard rectangle when scrolling the screenRichard Moe Gustavsen2014-03-151-8/+24
| | | | | | | | | | When we scroll, the keyboard will change position relative to QScreen, even if it appears to stay put. For that reason we also need to update the keyboard rect after doing a scroll. Change-Id: I9bda2ab5b5e4970f488d3e69e44cf58e273f8fcd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: prevent crash on iOS 5Richard Moe Gustavsen2014-03-041-3/+3
| | | | | | | | | | For some reason, the [] access into NSDictionary causes a crash on iOS 5. So instead use the API as listed in the documentation: objectForKey. Task-number: QTBUG-36532 Change-Id: I19fdf0f4ba1aebaf9477e2bd45040c389923605d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: don't store reference to focus objectRichard Moe Gustavsen2014-02-141-4/+1
| | | | | | | | | | | 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>
* iOS: implement support for input methodsRichard Moe Gustavsen2014-02-061-15/+23
| | | | | | | | This change will add support for input methods, word completion, spell checking and related functionality. Change-Id: I41d4de1cab521c679d414cfc7c1a2d0f9c1fcaaf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: change logic for when to scroll screenRichard Moe Gustavsen2014-02-061-46/+72
| | | | | | | | | | | | | | | | | | | The current implementation will stop scrolling the screen to reveal the cursor if the input item changes transformation. This to not interfere with flicking etc. This strategy turns out to be too strict, as some qml apps/games can easily have small animations applied (e.g qtquick cork board example) that moves or scales the text areas (or their parents) upon focus. So instead of relying on input item transformation, we now scroll whenever the cursor changes position inside the input item (in addition to orientation changes etc). We also refactor scrollRootView into two functions, since we in many cases know if the keyboard should scroll up or down already when the call is made. Change-Id: If5bf349139eed69823cfc8986bb4b32c93bdf91b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Fix C++11 buildTor Arne Vestbø2013-12-211-1/+1
| | | | | Change-Id: Ib7dc8dcbeca7e85d97b8c7fb04d2cf42e5245298 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: fix crash when focusWindow changes while keyboard is openRichard Moe Gustavsen2013-12-041-1/+1
| | | | | | | | | | | | | | | 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>
* iOS: update keyboard layout upon focus transferRichard Moe Gustavsen2013-11-251-2/+18
| | | | | | | | | | | | | | | | | | | | When iOS transfers focus from one view to another, it asks the new view for its UIKeyInput properties before deciding how the keyboard should be configured. For Qt, the same QUIView is used for the whole QWindow which means that UIKit will not change the keyboard configuration just because we change the focus object in Qt, since the UIView does not change. There seems to be no way to tell UIKit that the keyboard needs to change becuse the UIKeyInput properties has changed. To work around this, we briefly resign first responder status, and grabs it again, for the same QUIView. Change-Id: I2d15cc0c928deb023e7da58ad4669b7099dce2cf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: don't scroll after inputItem has movedRichard Moe Gustavsen2013-11-251-0/+13
| | | | | | | | | | | | If the inputItem moves, it typically means that the user scrolls or flicks the focus item around. In that case we should avoid scrolling the screen, otherwise they will "cancel out" each other. Besides, when the user flicks, he takes control over the whereabouts on the screen anyway. Change-Id: Iad0762965f9dcdbcca934ce6d90a8c1413ce3ca2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: scroll screen when keyboard opensRichard Moe Gustavsen2013-11-251-7/+116
| | | | | | | | | This change will let QIOSInputContext scroll the root view when the virtual keyboard is open, so that the input cursor is not obscured. Change-Id: If0758f4bf04c2b8e554e0196451154def7e3cb86 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: decouple QIOSWindow and QIOSInputContextRichard Moe Gustavsen2013-11-241-1/+3
| | | | | Change-Id: I85dda6fc0c6d2d11709b8bcdc0de6c0cef42d40f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* iOS: post the code that closes the input panelRichard Moe Gustavsen2013-06-251-1/+10
| | | | | | | | | | | | When the user is tranferring input focus between line edits (or similar controls), the edit that lost focus will close the input panel, just to see that the input that gained focus will open it again. This will cause the input panel to "jump", and can also trigger other input panel related code/signals unnecessary. Change-Id: Iac0a103e8d2f0f7cdcc04b8ec5b10e07587d1ad6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Don't crash on landscape mode startupMorten Johan Sørvig2013-02-271-1/+1
| | | | | | | | | fromPortraitToPrimary is called from the QIOSScreen constructor. This is probably to early to call QGuiApplication functions. Change-Id: I882304fd641df13dc530491990245ba9ad495377 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: let first responder follow the view of the focus windowRichard Moe Gustavsen2013-02-271-18/+15
| | | | | | | | | | This to ensure that the keyboard does not close prematurly. This can happen if the user opens up the keyboard while typing inside one window, then switch window, continue typing while the other window gets deleted. Change-Id: I5cfb1673ccbe4d5aaa14167b7aa53451031089a1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: report changes to keyboard rect back to QtRichard Moe Gustavsen2013-02-271-2/+13
| | | | | | | | | QInputContext expects us to report whenever the input panel changes geometry. This patch implements this. Change-Id: I9162f0d48da6925274a7489c9bcb6adab9afae82 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: add class QIOSInputContext (to handle keyboard)Richard Moe Gustavsen2013-02-271-0/+134
This change will add an initial implementation of the QPlatformInputContext for dealing with the keyboard. Change-Id: I29c1cfbbebb8456977b8a1db0e966973cd2c24a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>