QtQuickAutofill: password manager autofill for Qt Quick fields on Android and iOS
-
Hi everyone,
QtQuick's text fields don't work with system password managers (Google Password Manager, iCloud Keychain, 1Password, ...), because the platform doesn't know which field is the username and which is the password. There's an open ticket for it (QTBUG-114578), but no API yet, so I wrote a small library as a workaround:https://github.com/DeiVadder/QtQuickAutofill
You attach a role to your fields and call commit() after a successful sign-in:
TextField { Autofill.role: Autofill.Username } TextField { echoMode: TextInput.Password Autofill.role: Autofill.Password } // after sign-in succeeded: AutofillService.commit()On iOS it adds the missing textContentType to Qt's input responder at runtime, so the QuickType bar offers saved passwords. On Android an invisible overlay view reports the Qt Quick fields to the autofill framework, and after commit() Android offers to save the credentials.
This is not a biometric login. Any Face ID or fingerprint prompt while filling comes from the password manager, not from your app.
So far I've tested it with Qt 6.8 on a Pixel 3 (Android 12) and an iPhone 13. It's experimental and MIT licensed.
-
J J.Hilk marked this topic as a regular topic
-
Hi,
Nice ! Thanks