There are two possible ways:
- load all settings into some struct
- load values on-demand
Which approach is better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on the way you will use your settings file. Do you want to allow the user of your application to dynamically change the settings in the file (.ini file for example) ? Or the settings have to be set by the GUI ?
If you are using some GUI to change the settings, I advice you you to load the main settings at the start of your application from a static class for example.
Then, there is no problem to save your changed values on-demand because of the QSettings optimization.