Unsolved static function and qsettings
-
in my app, in one class i save some settings using QSetting. in another class i have a static member and a static setter function for it which i call in the constructor of this latter class (that has this static member). however, i set the value based on a setting read from the other class i mentioned above. can i be sure that the setting was read before i'm setting the value with the static function? or how can i ensure that?
-
Did you use QSettings sync?
-
no i didn't use that. the docs says it's called automatically so why do i need to call it? should i, anyways?
-
It actually says:
This function is called automatically from QSettings's destructor and by the event loop at regular intervals, so you normally don't need to call it yourself.Therefore, I would suggest to call it. It will not hurt.
If the destructor is actually called in your case, you are the only one able to answer. The case with the regular calls by the event loop leaves evetuallities open, but the intetional call will make sure that the routine is called.
-
okay, i got it, i'll call it. so, that will ensure that settings are loaded before calling the static function?