Re: Saving settings to XML
well, you must not close all the group-tags
Code:
foreach( std::string groupName, groups )
{
xmlWriter.writeStartElement( groupName.c_str() );
}
xmlWriter.writeCharacters( mi.value().toString() );
foreach( std::string groupName, groups )
{
xmlWriter.writeEndElement();
}
instead, you need to store the "current" group path in a variable.
Then calculate the path for the next setting: close only the tags (list suffix) no longer in the new path; open the new suffix path tags...
I once posted something like that in http://www.qtcentre.org/forum/f-qt-programming-2/t-qabstractitemmodel-subclass-duplicate-entries-14453.html
HTH
Re: Saving settings to XML
Yes that could work if I had similiar paths next to each other, but if I had something like this:
Code:
settings->setValue("themes/author/name", "arturo182");
settings->setValue("something/else", "test");
settings->setValue("themes/author/email", "arturo182@qwerty.com");
I think I should sort the SettingsMap by key before saving, is there a way to do it with one of QT's functions or do I have to do it by myself?