Saving data to files



  • Hi,

    I created a program in QML that calculates and keeps score in a game called marias (it is a popular cad game in Czech Republic). I would like to save the scores to an external text file. Can I do this in JavaScript in QML?

    I have absolutely no experiences in C++ programming, so I would like to avoid using C++ functions to save the file. I have experiences with PySide/QML but I would also like to avoid Python for this program.

    Btw. I plan to use the application mainly on my Windows 7 UMPC and Android phone. So I probably need to distinguish between these two platforms and choose the right folder to save the files.



  • Hi,

    You can use SQL database. I think it would be the easies way. Take a look at "this example":http://doc.qt.nokia.com/4.7-snapshot/declarative-tutorials-samegame-samegame4.html#keeping-a-high-scores-table



  • It it doen not have to be text, I would go for the SQL stuff task_struct suggests. If you need to go with a text file, you have little choice but to use either C++ or Python.



  • Thank you for the advice to use SQL. I didn't think about storing the data in database, but it is the best solution for me. Btw. where is the database physically stored?


Log in to reply
 

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