Results 1 to 5 of 5

Thread: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString

  1. #1
    Join Date
    Feb 2007
    Posts
    47
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question 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!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default 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.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    hiuao (3rd May 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    47
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString

    Quote Originally Posted by jpn View Post
    QSettings uses registry by default on Windows but it can also read and write .ini files.
    Thank you jpn!

  5. #4
    Join Date
    Feb 2007
    Posts
    47
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default 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!

  6. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt's similar function as GetPrivateProfileString and WritePrivateProfileString

    Yes, you will have to declare functions before passing function pointers to them.
    J-P Nurmi

Similar Threads

  1. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13
  2. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 23:04
  3. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 13:52
  4. Qt 4.1.4 plugin QPSQL
    By jcr in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd June 2006, 23:55
  5. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 09:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.