[PATCH v2] Translate using tr() to be Qt5-compatible

Anton Lundin glance at acc.umu.se
Mon Mar 17 14:58:34 PDT 2014


On 17 March, 2014 - Anton Lundin wrote:

> There are no utf8 in those strings, and we can translate them as
> everything else with tr() instead.
> QApplication::UnicodeUTF8-part is deprecated and removed in Qt5.
> 
> Signed-off-by: Anton Lundin <glance at acc.umu.se>
> ---
>  qt-ui/maintab.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
> index 378ee61..00f1de5 100644
> --- a/qt-ui/maintab.cpp
> +++ b/qt-ui/maintab.cpp
> @@ -229,11 +229,11 @@ void MainTab::displayMessage(QString str)
>  void MainTab::updateTextLabels(bool showUnits)
>  {
>  	if (showUnits && prefs.text_label_with_units) {
> -		ui.airTempLabel->setText(QApplication::translate("MainTab", "Air temp [%1]").arg(get_temp_unit()));
> -		ui.waterTempLabel->setText(QApplication::translate("MainTab", "Water temp [%1]").arg(get_temp_unit()));
> +		ui.airTempLabel->setText(tr("Air temp [%1]").arg(get_temp_unit()));
> +		ui.waterTempLabel->setText(tr("Water temp [%1]").arg(get_temp_unit()));
>  	} else {
> -		ui.airTempLabel->setText(QApplication::translate("MainTab", "Air temp", 0, QApplication::UnicodeUTF8));
> -		ui.waterTempLabel->setText(QApplication::translate("MainTab", "Water temp", 0, QApplication::UnicodeUTF8));
> +		ui.airTempLabel->setText(tr("MainTab", "Air temp"));

...Bork Bork...

I even managed to bork the resent v2 so it became a v3 before everything
looked right.

> +		ui.waterTempLabel->setText(tr("Water temp"));
>  	}
>  }
>  
> -- 
> 1.8.3.2

-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list