I'm using QSettings
to store some data as ini file in Windows. I want to see the ini file, but I don't know what is the location of the ini file.
This is my code:
QSettings *set = new QSettings(QSettings::IniFormat, QSettings::UserScope, "bbb", "aaa"); set->setValue("size", size()); set->setValue("pos", pos());
Where do I have to look? Or may be I miss the code which write it to the file? When does the QSettings
write its values?
If you create a QSettings without giving any specific path, the ini file will be located in the application path. QSettings Settings("myapp. ini", QSettings::IniFormat); Settings.
$HOME/. config/MySoft. conf (Qt for Embedded Linux: $HOME/Settings/MySoft. conf )
An . INI file is a type of file that contains configuration information in a simple, predefined format. It is used by Windows OSs and Windows-based applications to store information about the user's preferences and operating environment.
To print out the exact location of your settings file use method fileName method of QSettings class.
QSettings settings("folderName", "fileName"); qDebug() << settings.fileName();
Console output looks then like:
/home/user/.config/folderName/fileName.conf
I think you'll find everything you're looking for here : http://doc.qt.io/archives/qt-4.7/qsettings.html
It's plateform specific, see under :
Platform-Specific Notes Locations Where Application Settings Are Stored
You can store Settings in files as well :
QSettings settings("/home/petra/misc/myapp.ini", QSettings::IniFormat);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With