Why MacOS QML TextField with Password echo mode allows non-ascii(korea lanaguage) IME input?

Viewed 66

i use qt5.12.6 I recently ran into a strange problem while coding.(I am Korean) QML TextField echoMode: TextInput.Password.

Windows platform not allows non-ascii(korea lanaguage) IME input. but MacOS platform allows non-ascii(korea lanaguage) IME input.

why? echoMode: TextInput.Password, is Properties Windows platform specific? Or am I missing a setting?

Window {
  visible: true
  width: 640
  height: 480
  title: "window"

  Column {
   width:  parent.width
   height: parent.height
  spacing: 10

   TextField {
    id: test
    echoMode: TextInput.Password
    width: 200
   }
   Text {
    id: test2
    width: 200
    text: test.text
   }
 }
}

from MacOS, example code result(allows non-ascii[korea lanaguage] IME input)

if password textfield focus true, macos auto change IME input lanauage I want it to be like the picture below. from dbeaver password focus true

I hope from MacOS platform not allows non-ascii IME input. help me please...! Thanks you

1 Answers

Rather than leave it to chance, you can control the allowable input with validators. For instance:

   TextField {
       id: test
       echoMode: TextInput.Password
       width: 200
       validator: RegExpValidator { regExp: /[0-9A-Za-z]+/ }
   }

The above RegExpValidator will limit input to only alphanumeric characters.

Reference:

Related