Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

QSettings - get setting value of form x,x|x,x|x,x|x,x| fails

$
0
0
I am using QSettings to parse an ini file, which works fine except for one particular entry in the ini file (which I don’t control). [Key] KeyValue=7,10|4,6|3,3|2,2| using QSettings settings(cfgPath, QSettings::IniFormat); settings.beginGroup("Key"); QString KeyValue_= settings.value("KeyValue", "").toString(); qDebug() << KeyValue_ ; but this fails to return the value. All other values of a more traditional form Var = Value. I presume it is something to do with the way QSettings parses this, is there anyway around it? Also, the ini file starts with a general section. [General] The parser returns values from this outside of a beginGroup, but not if I do a setting.beginGroup(“General”) ? e.g. Works QString regCode_ = settings.value("RegistrationCode", "").toString();  qDebug() << regCode_ ; Doesnt’ work settings.beginGroup("Database"); QString regCode_ = settings.value("RegistrationCode", "").toString();  qDebug() << regCode_ ; settings.endGroup(); Finally, is there a simple way to test for the existence of a particular setting (beyond doing a settings.value, with default value “” and testing for that? The ini file I am parsing may or not have any combination of the following keyvalues. [Key] KeyValue1=7 KeyValue2=10 KeyValue3=22 … KeyValueX

Viewing all articles
Browse latest Browse all 13965

Trending Articles