What is the difference when creating a QString
of the Qt 5 framework when using tr("...")
or not, for example:
QString("texto");
QString(tr("texto"));
What is the tr()
good for?
What is the difference when creating a QString
of the Qt 5 framework when using tr("...")
or not, for example:
QString("texto");
QString(tr("texto"));
What is the tr()
good for?
tr()
is a function of Qt that gives you the multilanguage support of your application. All text that will be visible to the user should be displayed as QString(tr("texto"));
. In this way, with the help of the QtLinguist library, it is very easy to create multilanguage applications by creating the translation files. Here I leave a link to a tutorial / example of what I'm telling you.
I hope it serves you. Greetings