From 7e6f5544012da8aebafabd3e2337c39f7c914c21 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 16 Apr 2023 20:37:32 -0500 Subject: [PATCH] Gui: Add translations for color bar labels --- src/Gui/SoFCColorGradient.h | 5 ++++- src/Gui/SoFCColorLegend.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Gui/SoFCColorGradient.h b/src/Gui/SoFCColorGradient.h index 01bcd95e5e..12f7d54b12 100644 --- a/src/Gui/SoFCColorGradient.h +++ b/src/Gui/SoFCColorGradient.h @@ -27,6 +27,8 @@ #include #include +#include // For translation functions + #include "SoFCColorBar.h" @@ -40,6 +42,7 @@ class GuiExport SoFCColorGradient : public SoFCColorBarBase { using inherited = SoFCColorBarBase; SO_NODE_HEADER(Gui::SoFCColorGradient); + Q_DECLARE_TR_FUNCTIONS(SoFCColorGradient); public: static void initClass(); @@ -71,7 +74,7 @@ public: */ void customize(SoFCColorBarBase*) override; /** Returns the name of the color bar. */ - const char* getColorBarName() const override { return "Color Gradient"; } + const char* getColorBarName() const override { return tr("Color Gradient").toStdString().c_str(); } protected: /** diff --git a/src/Gui/SoFCColorLegend.h b/src/Gui/SoFCColorLegend.h index 3c6c0bedbe..96980e6f9c 100644 --- a/src/Gui/SoFCColorLegend.h +++ b/src/Gui/SoFCColorLegend.h @@ -26,6 +26,8 @@ #include #include +#include // For translation functions + #include "SoFCColorBar.h" @@ -39,6 +41,7 @@ class GuiExport SoFCColorLegend : public SoFCColorBarBase { using inherited = SoFCColorBarBase; SO_NODE_HEADER(Gui::SoFCColorLegend); + Q_DECLARE_TR_FUNCTIONS(SoFCColorLegend); public: static void initClass(); @@ -66,7 +69,7 @@ public: std::size_t countColors () const { return _currentLegend.hasNumberOfFields(); } void customize(SoFCColorBarBase*) override { } - const char* getColorBarName() const override { return "Color Legend"; } + const char* getColorBarName() const override { return tr("Color Legend").toStdString().c_str(); } // virtual void handleEvent(SoHandleEventAction * action); // virtual void GLRenderBelowPath(SoGLRenderAction * action);