oswalidos
18th May 2012, 11:41
Hello,
I want to put all messages and labels, sql queries ... in external files so i won't dive in the code to change a label or an url later, i think i'll use Qsettings, now the problem is :
1) is it good (http://c2.com/cgi/wiki?GlobalVariablesAreBad) to make Qsettings instance as global instance using Q_GLOBAL_STATIC ? i think it's bad it. (actually target platforms are mac and windows but laters it'll be mobile, so probably performance is important)
2) I have an idea that may appear weird : to make all my classes which need Qsettings instance inherits from a class that contains qsettings instance ready for use, if it's bad, why ?
I googled for some hours and i didn't find a good solution, i found someone trying to implement dependency injection by editing the singleton pattern but honestly i didn't get it,
There is certainly many who faced the same problem, would you tell me please what is the best approach ?
Thanks in advance.
I want to put all messages and labels, sql queries ... in external files so i won't dive in the code to change a label or an url later, i think i'll use Qsettings, now the problem is :
1) is it good (http://c2.com/cgi/wiki?GlobalVariablesAreBad) to make Qsettings instance as global instance using Q_GLOBAL_STATIC ? i think it's bad it. (actually target platforms are mac and windows but laters it'll be mobile, so probably performance is important)
2) I have an idea that may appear weird : to make all my classes which need Qsettings instance inherits from a class that contains qsettings instance ready for use, if it's bad, why ?
I googled for some hours and i didn't find a good solution, i found someone trying to implement dependency injection by editing the singleton pattern but honestly i didn't get it,
There is certainly many who faced the same problem, would you tell me please what is the best approach ?
Thanks in advance.