QSettings - where is the location of the ini file?

dubila picture dubila · Oct 27, 2010 · Viewed 52.7k times · Source

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?

Answer

lucaboni picture lucaboni · Jul 22, 2013

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