Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable predictive text on Android #3464

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,6 @@ int main( int argc, char *argv[] )
init_qgis( appBundleDir );

#ifdef ANDROID
// See https://bugreports.qt.io/browse/QTBUG-86982 -> fix to make the predictive text disabled on Android
qputenv( "QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT", "1" );
// See issue #3431 -> disable Android accessibility features to prevent ANRs
qputenv( "QT_ANDROID_DISABLE_ACCESSIBILITY", "1" );
#endif
Expand Down
6 changes: 4 additions & 2 deletions app/qml/account/MMLoginPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ MMPage {
width: parent.width

title: qsTr( "Email or username" )
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
textField.inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
}

MMPasswordInput {
Expand Down Expand Up @@ -205,7 +205,9 @@ MMPage {

text: root.apiRoot
placeholderText: "https://my-server-app.com/"
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly

// Qt.ImhNoPredictiveText must be accompanied by Qt.ImhSensitiveData, see https://bugreports.qt.io/browse/QTBUG-86982
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
}

MMListSpacer { height: __style.spacing40 }
Expand Down
4 changes: 2 additions & 2 deletions app/qml/account/MMSignUpPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ MMPage {
width: parent.width

title: qsTr( "Username" )
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
textField.inputMethodHints: Qt.ImhNoAutoUppercase
}

MMTextInput {
Expand All @@ -81,7 +81,7 @@ MMPage {
width: parent.width

title: qsTr( "Email" )
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
textField.inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
}

MMPasswordInput {
Expand Down
2 changes: 0 additions & 2 deletions app/qml/components/private/MMBaseSingleLineInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ MMBaseInput {
leftPadding: leftContentGroupContainer.visible ? 0 : __style.margin20
rightPadding: rightContentGroupContainer.visible ? 0 : __style.margin20

inputMethodHints: Qt.ImhNoPredictiveText

placeholderTextColor: __style.darkGreyColor

font: __style.p5
Expand Down
8 changes: 7 additions & 1 deletion app/qml/form/editors/MMFormTextEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ MMPrivateComponents.MMBaseSingleLineInput {
text: _fieldValue === undefined || _fieldValueIsNull ? '' : _fieldValue

readOnly: _fieldIsReadOnly
textField.inputMethodHints: root._field.isNumeric ? Qt.ImhNoPredictiveText | Qt.ImhFormattedNumbersOnly : Qt.ImhNoPredictiveText

title: _fieldShouldShowTitle ? _fieldTitle : ""

Expand Down Expand Up @@ -75,6 +74,13 @@ MMPrivateComponents.MMBaseSingleLineInput {
root.editorValueChanged( val, val === "" )
}

Component.onCompleted: {
// Use numerical keyboard for number fields configured as texts
if ( root._field.isNumeric ) {
textField.inputMethodHints |= Qt.ImhFormattedNumbersOnly
}
}

QtObject {
id: internal

Expand Down
2 changes: 0 additions & 2 deletions app/qml/form/editors/MMFormTextMultilineEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ MMPrivateComponents.MMBaseInput {
}
placeholderTextColor: __style.darkGreyColor

inputMethodHints: Qt.ImhNoPredictiveText

readOnly: root.editState !== "enabled"

background: Rectangle {
Expand Down
3 changes: 2 additions & 1 deletion app/qml/inputs/MMPasswordInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ MMPrivateComponents.MMBaseSingleLineInput {

textField.echoMode: eyeButton.pressed ? TextInput.Normal : TextInput.Password

textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhSensitiveData | Qt.ImhHiddenText
// Qt.ImhNoPredictiveText must be accompanied by Qt.ImhSensitiveData, see https://bugreports.qt.io/browse/QTBUG-86982
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase | Qt.ImhHiddenText

rightContent: MMComponents.MMIcon {
id: eyeButton
Expand Down
2 changes: 1 addition & 1 deletion app/qml/settings/components/MMSettingsInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MMSettingsItem {
textFieldBackground.color: __style.lightGreenColor

text: root.value
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
textField.inputMethodHints: Qt.ImhNoAutoUppercase
}

MMComponents.MMListSpacer { height: __style.spacing40 }
Expand Down
Loading