I have no problems with an INI file being written by Windows 7 to any allowable location (code below). The location you are reporting is not the default location for QSettings file store, so something about how you are setting the QSettings path is likely the problem. Attempting to write an INI file to the program's install directory screams two things to me;- the file name is not fully qualified, and
- the program's install directory is the default working directory for application.
#include <QtGui>
#include <QDebug>
int main(int argc, char *argv[])
{
"Save settings",
"Settings files (*.ini)" );
qDebug() << fileName; // Fully qualified path is output
s.setValue("TestKey", "TestValue");
s.sync();
return 0;
}
#include <QtGui>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString fileName =
QFileDialog::getSaveFileName(0,
"Save settings",
QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation),
"Settings files (*.ini)" );
qDebug() << fileName; // Fully qualified path is output
QSettings s(fileName, QSettings::IniFormat);
s.setValue("TestKey", "TestValue");
s.sync();
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks