Qt qsettings save value in quotes

1k views Asked by At

I try to save some values in ini file, it's ok while i save only one value, like:

  • AAA=BBB

but i found a problem, when i try to save several values like this:

  • AAA=BBB;CCC

it's ok, if i want to save, but if i want to read this value, i will get only BBB. I found solution of this problem, if value was saved in quotes it will be read normally:

  • AAA="BBB;CCC"

but, i don't know how to save value in quotes. I use following code, to save values:

configs.setValue("Settings/name", value);

I tried to save with ASCII symbol and with "\"", but it's not work. Save code:

if (!Ui->commonIncludesLineEdit->text().isEmpty()) {
        value = Ui->commonIncludesLineEdit->text();
        configs.setValue("Settings/CommonIncludes", value);
    } else {
        if (configs.contains("Settings/CommonIncludes"))
            configs.remove("Settings/CommonIncludes");
    }

read code:

if (configs.contains("Settings/CommonIncludes"))
        Ui->commonIncludesLineEdit->setText(configs.value(
                                                "Settings/CommonIncludes",
                                                "Open problems").toString());

ini file:

[Settings]

CommonIncludes="C:/dev/ObfOr/Workset_latest;C:/dev/ObfOr/Workset_latest/Demo"

0

There are 0 answers