2

I'm building a Qt application for Android, and I can't figure out the reason a textfield behaves the way it does.

This code:

    TextField {
        id: usrField
        Layout.fillWidth: true
    }

somehow capitalizes the text that is entered in the textfield, but only on the phone. If I build it as a desktop application, it works the way it ought. The password field:

    TextField {
        id: pwField
        echoMode: TextInput.Password
        Layout.fillWidth: true
        Keys.onReturnPressed: {
            loginButton.accessiblePressAction()
        }
    }

works as intended, both on device and on desktop.

I've tried adding font.capitalization: Font.AllLowercase, but to no avail.

Any help is greatly appreciated. Any ideas?

Clarification: All letters are capitalized, not only the first. If I manually turn off caps lock and enter a letter, caps lock is automatically turned on again.

EvenLisle
  • 4,672
  • 3
  • 24
  • 47
  • 1
    Are you sure it is the `TextField` that is to blame? Phone keyboards have a setting to capitalize the first letter of a "sentence" that is ON by default. – dtech Aug 28 '14 at 08:32
  • That's not the reason, but thank you for pointing it out. I've updated the question. – EvenLisle Aug 28 '14 at 08:39
  • That sounds weird. Might be a bad feature implementation in the platform plugin that requests caps lock for the field from the system. Do you get the same behavior with... say `TextInput`? – dtech Aug 28 '14 at 08:47
  • I don't, but I'm reluctant to use a TextArea and manually force its size to the same as the password field. – EvenLisle Aug 28 '14 at 08:54
  • Well in that case you have to options: 1 - submit a bug report and hope that in many months this might be fixed or 2 - dig in the platform plugin and fix it yourself. BTW, you can set the size of `TextInput` just as well, the difference is it doesn't have any "decoration" and lacks certain features, at least on the desktop. BTW any attempts to "force" all lowercase would destroy any intentional uppercase, so I would not count it as a solution, unless all lowercase is really intended. – dtech Aug 28 '14 at 08:58

0 Answers0