How to clear Settings (QtCore) from inside QML?
-
Each time I open my app, the Settings component reads saved values from the registry (or so I think). How can I reset all the values that are saved there? So it would work like "Revert to default" in other applications.
It's based on QSettings which has
clear()
method though I can't call it from inside QML (such method is just not defined) -
@Ntachy I did this by creating my own clear function (I name it reset() ), where I set all the properties to their default values. In my case I had a button where the user would click to reset the values, dont know your use case, where you would called it is up to you.
If you want to clear the values "outside" the running app, check here for where the values are stored:
https://doc.qt.io/qt-6/qsettings.html#platform-specific-notes