Where can I find QML Settings file or where is it saved in my device?
-
I am using QtCreator for a C++/QML application on RaspberryPi. I want to save some application settings and I reached this goal using a code that is very similar to the documentation at this link.
... import Qt.labs.settings 1.0 Settings { id: settingsValues property int sliderValue: 300000 property bool checkBoxChecked: true } ...
Question:
Where can I find the file in which these values are stored?
-
This might work:
The actual mechanism for the persistent storage of QSettings data is implementation-
dependent and quite flexible. Some possibilities for its storage include the Win32 reg-
istry (in Windows) and your $HOME/.settings directory (in Linux). -
@Charlie_Hdz I have a .config directory in my Linux OS but there is nothing inside related to Qt or Qml. How can I set the folder where I would like to save this persistent storage?
-
Had you set values like this way?
settings.setValue("pos", pos()); settings.setValue("size", size()); settings.setValue("state", saveState());
-
@Charlie_Hdz No, I have set the values only in the .qml where I needed. For the settings I have not written qml code in .cpp file, I have used the structure shown in the question above.
-
In some way, you need to write those settings after the user wants to quit but before the window is
closed. Can you trigger a QML signal to catch them in the .cpp file? -
I am using QtCreator on Ubuntu 16.04, so I found the configuration file at the following path:
default_Directory_Of_My_Project/.config/Unknown Organization/myProject.conf
-
@emmericatto set the application name and organization: http://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html#application-identifiers