PDA

View Full Version : Qt's similar function as GetPrivateProfileString and WritePrivateProfileString



hiuao
2nd May 2007, 12:18
Can anyone be so kind enough to tell me Qt's similar function as MFC's GetPrivateProfileString and WritePrivateProfileString?
Thank you very much!

jpn
2nd May 2007, 12:24
QSettings uses registry by default on Windows but it can also read and write .ini files.

hiuao
3rd May 2007, 04:24
QSettings uses registry by default on Windows but it can also read and write .ini files.
Thank you jpn!;)

hiuao
3rd May 2007, 06:33
I use QSettings as the document said:
const QSettings::Format XmlFormat =
QSettings::registerFormat("xml", readXmlFile, writeXmlFile);
QSettings settings(XmlFormat, QSettings::UserScope, "MySoft",
"Star Runner");
the error is no matching function for call to `QSettings::registerFormat(const char[4], <unknown type>, <unknown type>)
and I have to define
bool readXmlFile(QIODevice &device, QSettings::SettingsMap &map);
bool writeXmlFile(QIODevice &device, const QSettings::SettingsMap &map);
in the head file,because define in the .cpp file there will be errors,and ask for their definitions.
How to deal with such a question?Thank you very much!

jpn
3rd May 2007, 08:15
Yes, you will have to declare functions before passing function pointers to them.