When QLineEdit is in password mode then it will still allow characters to be composed but it will lose what the intended character is. For instance, to get tilde you on some keyboards you need to use ALT+^ and then space to get it to stay as a tilde. But in password echo mode you will only end up with space. So if you typed: "1~A" you would end up with "1 A" as the actual string.
When comparing to native password fields, it should not allow composing at all, so it should just put a literal ~ straight away without the need to press space (as a rule it seems IMEs are disabled in that case)