Qt: fix loading of language translation

But need always restart to apply change...

Based on http://qt-project.org/wiki/How_to_create_a_multi_language_application


Change-Id: I0f95afb68aa5b125e0707b0af1ce096dab9c29e4
Reviewed-on: https://code.wireshark.org/review/2286
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Alexis La Goutte 2014-06-17 00:20:16 +02:00
parent 923cf412f1
commit 11243e3977
2 changed files with 21 additions and 0 deletions

View File

@ -1545,6 +1545,25 @@ void MainWindow::updateForUnsavedChanges() {
}
void MainWindow::changeEvent(QEvent* event)
{
if(0 != event)
{
switch(event->type())
{
// this event is send if a translator is loaded
case QEvent::LanguageChange:
main_ui_->retranslateUi(this);
break;
default:
break;
}
}
QMainWindow::changeEvent(event);
}
/* Update main window items based on whether there's a capture in progress. */
void MainWindow::setForCaptureInProgress(gboolean capture_in_progress)
{

View File

@ -377,6 +377,8 @@ private slots:
void on_actionTelephonyRTSPPacketCounter_triggered();
void on_actionTelephonySMPPOperations_triggered();
void on_actionTelephonyUCPMessages_triggered();
void changeEvent(QEvent* event);
};
#endif // MAINWINDOW_H