From 11243e3977291c2b7bcacf5be5bbe0bde09ba773 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Tue, 17 Jun 2014 00:20:16 +0200 Subject: [PATCH] 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 --- ui/qt/main_window.cpp | 19 +++++++++++++++++++ ui/qt/main_window.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 9a4adce43e..3dc1efbf79 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -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) { diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 9534d6b2f5..916bbe7d2b 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -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