Results 1 to 2 of 2

Thread: QSetting value() not correct

  1. #1
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSetting value() not correct

    Hey guys. I am having a problem with QSetting. The problem is that I am reading from an ini that looks like this:

    [Current Server Directory]
    current.dir=c:\indir

    I am using the following code:
    Qt Code:
    1. QSettings INConfig(sPath, QSettings::IniFormat);
    2. std::cout << "ServerDir: " << INConfig.value("Current Server Directory/current.dir").toString().toStdString() << std::endl;
    To copy to clipboard, switch view to plain text mode 

    Basically, my problem is that it returns: c:ndir
    I call this a bug... troll tech may call this a feature. Is there anyway to turn this "feature" off?

    Thank,
    Brandon P.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSetting value() not correct

    As the docs say:
    Although backslash is a special character in INI files, most Windows applications don't escape backslashes (\) in file paths:
    windir = C:\Windows
    QSettings always treats backslash as a special character and provides no API for reading or writing such entries.
    All you can do is to use "\\", "/" (this should work under windows too) or write your own format handler.

Similar Threads

  1. What's the correct way of clearing a pixmap?
    By karye in forum Qt Programming
    Replies: 4
    Last Post: 19th January 2006, 17:46

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.