Hello!
Normally somewhat big applications have a specific dialog window for Options and/or Configuration, accessible by the menu bar, where the user may configure the software as it pleases him. Sometimes part of the configuration data are values that are used elsewhere in the software (i.e. during the usage of the software it will ask "have the user checked that combobox with that option or not? If yes, I'll do something; if not, I'll do something else").
The problem is that since the configuration is done in a dialog "appart" from the software itself, I'm dealing with the problem of how exactly make the rest of the application to know the settings that were put by the user.
I imagined using QSettings to do this, since thoose configuration should be avaliable in the next opening. So when the settings dialog window is closed, the close method would save the values with QSettings and each time the software wants to know the definition, it would open a new QSettings and find the configuration that was set. The problem with this method is that it doesn't seem right to use QSettings this way; I learned that QSettings was created to save configuration between usages of the software (so when it opens it will have the previous configuration), not to access configuration during the software usages.
But if QSettings is not appropriate for that, which other way should I use? I thought about saving all data into a large Settings struct, but it seems that would have a problem if a needed that configuration data in child widgets - for I would have to send all the struct to the child widget or between threads in order for it to access that data, what seems to much memory comsumption.
So my question would be: which is the best way to handle this configuration data in Qt? I remember also reading in the QSettings manual:
but that would give the same problems that I have with the struct method.If all you need is a non-persistent memory-based structure, consider using QMap<QString, QVariant> instead.
Thanks,
Momergil
Bookmarks