PDA

View Full Version : Translations for tool tips don't show up



magicp7
18th November 2015, 08:09
Hello,

I'm relatively new to Qt and I'm having some problems with the translations of my tool tips into other languages.
I've written a method that sets the tool tips on start up. Afterwards I'm loading my .qm file with the translations
and set up the translator. This works fine for everything that isn't a tooltip; all texts are translated, only the tool tips
are shown in the original language.
The tool tip texts are also contained in the .ts file, a translation is available, but it just doesn't use the translation when
I change the language.

Does anyone have an idea what could be causing this?

I added a part of the of the method that sets my tool tips. All my tool tips are set in this way.


void MainWindow::InitToolTips(void) // Set Tool-tips
{
const QString TStart = "<b><span style=\"color:green;\">";
const QString TEnd = "</span></b>";

ui->btn_StartTab->setToolTip(TStart + tr("Kopieren von Einstellungen zwischen Drehmomentschlüssel und Datenbank") + TEnd);
ui->btn_WrenchTab->setToolTip(TStart + tr("Einstellungen für aktuell angeschlossenen Drehmomentschlüssel") + TEnd);
ui->btn_ProgramsTab->setToolTip(TStart + tr("Schraubfälle und Ablaufpläne verwalten") + TEnd);
ui->btn_DataTab->setToolTip(TStart + tr("In die Datenbank geladene Verschraubungsdaten verwalten") + TEnd);
ui->btn_Workflows->setToolTip(TStart + tr("Einstellen von Premium-Workflows") + TEnd);
ui->btn_LiveMode->setToolTip(TStart + tr("Live-Anzeige aktivieren") + TEnd);
ui->tbtn_ProgramSettings->setToolTip(TStart + tr("Zeige den Dialog zur Programmkonfiguration") + TEnd);
ui->tbtn_RadioConfig->setToolTip(TStart + tr("Zeige den Dialog zur Funkschnittstelle") + TEnd);
ui->tbtn_Help->setToolTip(TStart + tr("Zeige die Programmhilfedatei an") + TEnd);
}

anda_skoa
18th November 2015, 09:25
The tool tip texts are also contained in the .ts file, a translation is available, but it just doesn't use the translation when
I change the language.

You mean you change the language after these "setToolTip" methods have been executed?
If so, how would that code miraculously run again?

Cheers,
_