Storing previously entered words in cache



  • In my Qt Desktop app there is a login form! The user has to enter the Username and password to login to the app! The login is working but I want to store the previously entered usernames so that when next time I open the app and enter first letter of a user name the list of user names starting with that letter(which had previously been entered) should appear! How can I achieve this?


  • Moderators

    @Lasith Just write the entered words in a file. When the app later starts it reads the file. Then, depending on what you use to enter username you can use http://doc.qt.io/qt-5/qlineedit.html#setCompleter



  • @jsulm Thanx but if we consider something like a search text box how can we get the list of words without keeping them in a text file?



  • Store a QStringList in QSettings and pass it to a QStringListModel and then to the completer, maybe



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.