[Interest] QSettings: is a group present? Crash with qWarning.
senseiwa at gmail.com
Thu Aug 23 16:51:17 CEST 2012
Here's again a question, this time on QSettings with INI files. The
question is simple: how do I know if a group exists in my INI file?
Well, I could ask for all groups with childGroups(), and use the
Except that I don't know why this crashes when used inside a qWarning.
This is the very simple INI file:
This is the super simple code I've written:
int main(int argc, char *argv)
QSettings s("/Users/sensei/Desktop/proj.txp", QSettings::IniFormat);
bool x = s.childGroups().contains("first");
qWarning("Number of groups: %d", s.childGroups().size());
qWarning("Contains [first]: %d", x); // OK
qWarning("Contains [first]: %d", s.childGroups().contains("first")); //
and your .pro file:
TEMPLATE = app
SOURCES += main.cpp
I don't know why this happens. Any hints? I might be missing something
PS. My environment is OSX 10.8, the qt installation is the one that I
installed on the previous OSX version. Qt is 4.8.0 (the SDK Maintenance
Tool says I have no updates available).
More information about the Interest