Qt's similar function as GetPrivateProfileString and WritePrivateProfileString
Can anyone be so kind enough to tell me Qt's similar function as MFC's GetPrivateProfileString and WritePrivateProfileString?
Thank you very much!
Re: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString
QSettings uses registry by default on Windows but it can also read and write .ini files.
Re: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString
Quote:
Originally Posted by
jpn
QSettings uses registry by default on Windows but it can also read and write .ini files.
Thank you jpn!;)
Re: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString
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!
Re: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString
Yes, you will have to declare functions before passing function pointers to them.