Electrum 3.2.3: "Incorrect Password" when manual typing, works fine when pasting from clipboard
My password works ok when copying and pasting it, but fails with "Incorrect Password" when manually typing it. I've confirmed that the password being typed is correct by using `xdotool` to type it over the GUI, so there's no human error here.

I managed to narrow the problem a bit: **A password with special characters (á, ã, é and so on) does not work when manual typed.**

This applies to the Wizard, Change Password box, Seed "Enter Password" box, probably all over the GUI.

I'm using Arch Linux with `gnome-shell` 3.30.1

-- Edit --
I managed to narrow it down further: apparently the bug only happens if the password was set up by copying and pasting it on the first place. So, to reproduce the bug:

- Open any wallet
- Open the Change Password dialog
- Paste `á` (from the clipboard) into *New Password* and *Confirm Password* input boxes and change the password
- Open any password dialog (you can open Change Password again)
- Type `á` with the keyboard and submit the dialog, you'll get Invalid Password.
- Paste `á` from the clipboard, it'll work.
diff --git a/electrum/gui/qt/password_dialog.py b/electrum/gui/qt/password_dialog.py
index 3202618ec..c38251d94 100644
--- a/electrum/gui/qt/password_dialog.py
+++ b/electrum/gui/qt/password_dialog.py
@@ -56,19 +56,22 @@ def check_password_strength(password):
 PW_NEW, PW_CHANGE, PW_PASSPHRASE = range(0, 3)
 
 
+class PasswordLineEdit(QLineEdit):
+    # workaround Qt bug https://github.com/spesmilo/electrum/issues/5038
+    def __init__(self, *args, **kwargs):
+        QLineEdit.__init__(self, *args, **kwargs)
+        self.textChanged.connect(lambda: self.setEchoMode(2))
+
+
 class PasswordLayout(object):
 
     titles = [_("Enter Password"), _("Change Password"), _("Enter Passphrase")]
 
     def __init__(self, msg, kind, OK_button, wallet=None, force_disable_encrypt_cb=False):
         self.wallet = wallet
-
-        self.pw = QLineEdit()
-        self.pw.setEchoMode(2)
-        self.new_pw = QLineEdit()
-        self.new_pw.setEchoMode(2)
-        self.conf_pw = QLineEdit()
-        self.conf_pw.setEchoMode(2)
+        self.pw = PasswordLineEdit()
+        self.new_pw = PasswordLineEdit()
+        self.conf_pw = PasswordLineEdit()
         self.kind = kind
         self.OK_button = OK_button
 
@@ -288,8 +291,7 @@ class PasswordDialog(WindowModalDialog):
     def __init__(self, parent=None, msg=None):
         msg = msg or _('Please enter your password')
         WindowModalDialog.__init__(self, parent, _("Enter Password"))
-        self.pw = pw = QLineEdit()
-        pw.setEchoMode(2)
+        self.pw = pw = PasswordLineEdit()
         vbox = QVBoxLayout()
         vbox.addWidget(QLabel(msg))
         grid = QGridLayout()
['electrum/gui/qt/password_dialog.py']