QSettings - What is the way to read the path value?

Using windows xp, I want to read the value from the .ini file. Meaning is the way. Using QSettings, the result of calling "settings.value" ("key"). ToString () "is the path excluding the backslash because the backslash is an escape character. What is the way to read the path from the ini file using QSettings?

+3


source to share


1 answer


Although the backslash is a special character in INI files, most Windows applications do not avoid backslashes () in file paths [...]

QSettings always treats backslashes as special characters and does not provide an API to read or write such records.

This is what the documentation has to say about it. This is a polite way of saying, "If some other code does this, they are not following the WINAPI specification and it is broken and we won't have to deal with it." To a large extent, your .ini files are corrupted.



If you want to read them, you may need to provide your own backend for QSettings

. Such a backend can be easily obtained by copying the one that comes with Qt and not letting it slip away.

You will need to examine if your own is written for you QTextCodec

and submit it to QSettings::setIniCodec

. If that's enough, you won't need to provide the entire backend.

+3


source







All Articles