Question

I am working on a mobile app using Qt, in which user needs to log in by using Ip, Port, Username and Password values. Each time app is closed those values are lost. I want to be able to store the last login values for the user.

I did try to use LocalStorage 2.0 but I got it really messed up, I couldn't figure out how to keep a single row updated and instead I was inserting new row every time user saved his settings. What I wanted to do each time user pressed save settings just update that first row.

Could anyone advice me on what could I do to store just 4 values of user settings and update them if need be.

Thank you

Was it helpful?

Solution

1. Check the code details here :

They have given clear instructions on how to create/insert values etc.

I couldn't figure out how to keep a single row updated and instead I was inserting new row every time user saved his settings. What I wanted to do each time user pressed save settings just update that first row.

I will write a rough algorithm :

If you create the table at the installation time itself and insert rows in the table later :

if ( NUMBER_OF_ROWS_IN_TABLE == 0 )
   Execute Insertion Query. // (To be used when your app runs for the first time)
else
   Execute Updation Query. // (To be used afterwards)

or

If you create the table at the time you are storing the data:

if ( TABLE_EXIST == false )
   Execute Create table Query. // (To be used when your app runs for the first time)
   Execute Insertion Query. // (To be used when your app runs for the first time)
else
   Execute Updation Query. // (To be used afterwards)

2. You could possibly use a combination of qml and C++ as well as your data set is not too large . You can use C++ in doing some file handling (preferable encrypt the data), and then use qml to do the necessary save and retrieve operations as required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top