[QtEI] Translation suggestion

Roland qtextended.kossel at web.de
Thu Apr 30 15:47:43 CEST 2009

> > Another consideration is that tr() is only available in classes
> derived
> > from
> > QObject - but since normally the strings you want to translate are
> > generated
> > in Gui-classes this is normally the case.
> iirc tr is a static method of QObject, ie QObject::tr() should be
> possible
> regardless of inheritance.

Sorry. Of course you are correct.
The disadvantage of using QObject::tr() compared to qApp->translate() (or to
be more exact the static function QCoreApplication::translate()) is that you
can not specify a context and that it is not set automatically if the class
is not inheriting QObject.


More information about the community mailing list