[Qt-interest] static struct of QIcons?
Gordon Schumacher
gordons at valleyhold.org
Tue Mar 30 16:44:38 CEST 2010
On 3/29/2010 5:42 PM, "Malyushytsky, Alex" <alex at wai.com> wrote:
> Using static is evil by nature.
> You want to be able to control when objects are created/destroyed to avoid problems they are constructed before the objects they depends on.
>
To be slightly more specific - static *global* variables are bad, and do
not (sanely) allow you to control initialization order.
I will even agree with your statement of "evil", on the grounds that
like the Black Magic of fantasy novels, once you start using it you will
only need more... because it *is* possible to control startup
initialization order in all the compilers one is likely to need to use
with Qt; it's just non-portable, ugly, and (for many compilers)
undocumented. :)
> If you want to localize resources I would suggest to create instance of your class inside main after QApplication is constructed or better
> override QApplication and make it a member of your application class.
>
Or better yet, put the icons etc. in a .qrc file named by locale, and
switch it along with the translator.
I have also put *all* the internationalization stuff in a single qrc,
including .ts files, and switched the whole thing in the qrc!
More information about the Qt-interest-old
mailing list