Mac OS 10.9 QSettings



  • Hi,

    I'm trying to work with .plist file via QSettings.

    I've Users/user/Library/Preferences/com.name.name.plist with following:
    @
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>key2</key>
    <dict>
    <key>key1_1</key>
    <string>value1_1</string>
    </dict>
    <key>key2</key>
    <dict>
    <key>key2_1</key>
    <string>value2_1</string>
    </dict>
    </dict>
    </plist>
    @

    According to http://qt-project.org/doc/qt-5.0/qtcore/qsettings.html#QSettings and Platform-Specific Notes this
    @
    QSettings qs("name", "name");
    @

    should access to ~/Library/Preferences/com.name.name.plist via QSettings::NativeFormat as xml.
    But it work strange:
    @
    qDebug() << qs.filePath(); /// return Users/user/Library/Preferences/com.name.name.plist -- its ok
    qDebug() << qs.allKeys(); /// retun () -- its not ok!!
    @

    If I access to settings by direct path
    @
    QSettings qs("/Users/User/Library/Preferences/com.name.name.plist", QSettings::NativeFormat);
    @

    its return correct file path too (Users/user/Library/Preferences/com.name.name.plist) and its return correct keys
    key1 and key2.

    But!!! When I want work with childs i have nothing:
    @
    QSettings qs("/Users/User/Library/Preferences/com.name.name.plist", QSettings::NativeFormat);
    qDebug() << qs.allChilds(); // return key1 and key2 only -- its not ok
    qs.beginGroup("key1");
    qDebug() << qs.allChilds(); // return empty () -- its not ok
    qs.endGroup();
    @

    Can some body help me with this?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.