Android soft keyboard action button
-
wrote on 2 Nov 2015, 14:14 last edited by morte 11 Jun 2015, 20:47
There is Dialog (from Qt.Quick Dialogs) with few SpinBoxes, when user edit an SpinBox value then press 'Done' button (on Android software keyboard) whole Dialog closes.
How can i replace 'Done' with 'Next' keyboard action button on or change that behavior? -
wrote on 11 Jan 2016, 14:14 last edited by
Did you find a solution to this as I have the same requirement ?
In a Java app you would include in the XML:
android:imeOptions="actionNext" -
wrote on 11 Mar 2017, 09:23 last edited by
Same problem too :/
-
wrote on 28 May 2020, 20:31 last edited by seyed
OK! I solved it as follow in Qt 5.12:
import QtQuick 2.12 import QtQuick.Controls 2.12 Column { TextField { id: field1 KeyNavigation.tab: field2 //<--- what is next element? activeFocusOnTab: true //<--- I want use tab key for desktop version EnterKey.type: Qt.EnterKeyNext //<--- change 'done' label to 'next' Keys.onReturnPressed: KeyNavigation.tab.forceActiveFocus(); //<--- focus next element same as tab key does } TextField { id: field2 KeyNavigation.tab: field3 activeFocusOnTab: true EnterKey.type: Qt.EnterKeyNext Keys.onReturnPressed: KeyNavigation.tab.forceActiveFocus(); } TextField { id: field3 KeyNavigation.tab: field1 activeFocusOnTab: true EnterKey.type: Qt.EnterKeySend //<--- change label of return key of the soft keyboard as 'send' Keys.onReturnPressed: sendData(); //<--- finally send data if user pressed done button (return button) } }
NOTE: Action button of the Android soft keyboard is same as return button which you can control it in XML layout file with 'imeOptions' attribute.
-
OK! I solved it as follow in Qt 5.12:
import QtQuick 2.12 import QtQuick.Controls 2.12 Column { TextField { id: field1 KeyNavigation.tab: field2 //<--- what is next element? activeFocusOnTab: true //<--- I want use tab key for desktop version EnterKey.type: Qt.EnterKeyNext //<--- change 'done' label to 'next' Keys.onReturnPressed: KeyNavigation.tab.forceActiveFocus(); //<--- focus next element same as tab key does } TextField { id: field2 KeyNavigation.tab: field3 activeFocusOnTab: true EnterKey.type: Qt.EnterKeyNext Keys.onReturnPressed: KeyNavigation.tab.forceActiveFocus(); } TextField { id: field3 KeyNavigation.tab: field1 activeFocusOnTab: true EnterKey.type: Qt.EnterKeySend //<--- change label of return key of the soft keyboard as 'send' Keys.onReturnPressed: sendData(); //<--- finally send data if user pressed done button (return button) } }
NOTE: Action button of the Android soft keyboard is same as return button which you can control it in XML layout file with 'imeOptions' attribute.
wrote on 12 Mar 2021, 14:48 last edited byThanks so much for posting this result!
This worked for me in QT 5.14.2@seyed said in Android soft keyboard action button:
NOTE: Action button of the Android soft keyboard is same as return button which you can control it in XML layout file with 'imeOptions' attribute.
Can you elaborate on this?
I'm working on Android and am not seeing the 'Done' button changing as expected, but I do see in the QT Docs:
Note: Not all of these values are supported on all platforms. For unsupported values the default key is used instead.