[SOLVED] QT on Android: Where to save data, eg. setting or highscore list
-
I'm developing a small game with QT on Android, and I've been wondering that where and how I should save highscore list? Highscores should (of course) stay in the memory even if user quits the app.
I might also need to save a few settings, but they will probably go same way as the highscores?
-
Hi and welcome to devnet,
You can use either QSettings or depending on the volume of data you could use a SQLite database which location you can retrieve using QStandardPaths.
Hope it helps
-
QSettings seems to do the trick - at least in Windows environment. Thanks!
But before I'll mark this as solved, I'll still ask two questions. ;)
- Which is the correct way to reset/empty the whole QSettings "file"?
Is it
@myQSettingsPointer->remove("");@
or
@myQSettingsPointer->clear();@or something else?
(I tried to find that .ini file from my computer at the app's path, but I weren't there...)- How easy it is for the end user with Android to modify QSettings's saved data, e.g. tweak his highscores?
- Which is the correct way to reset/empty the whole QSettings "file"?
-
1.AFAIK, clear is the right way.
Depending on how you setup QSettings there's just no ini file.
- If you provide an editor for that, it should be pretty easy.
-
For question 2, I think you mean how easy is for a user to open the QSettings file from outside the app and change it maliciously, right ?!?!
If yes, then on Android it is possible only on rooted devices because the QSettings are stored in a private directory of the app not accessible from outside and from others app (unless the device is rooted).On iOS it is the same.
-
Yeah… I misread high score, I thought you wanted to provide a mean to modify some aspect of your game for testing...