Gui: Add translations for color bar labels
This commit is contained in:
@@ -319,7 +319,7 @@ void SoFCColorBar::handleEvent (SoHandleEventAction *action)
|
||||
QMenu menu;
|
||||
int i=0;
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it) {
|
||||
QAction* item = menu.addAction(QLatin1String((*it)->getColorBarName()));
|
||||
QAction* item = menu.addAction(QObject::tr((*it)->getColorBarName()));
|
||||
item->setCheckable(true);
|
||||
item->setChecked((*it) == current);
|
||||
item->setData(QVariant(i++));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <QCoreApplication>
|
||||
# include <Inventor/fields/SoMFString.h>
|
||||
# include <Inventor/nodes/SoBaseColor.h>
|
||||
# include <Inventor/nodes/SoCoordinate3.h>
|
||||
@@ -83,6 +84,11 @@ void SoFCColorGradient::finish()
|
||||
atexit_cleanup();
|
||||
}
|
||||
|
||||
const char* SoFCColorGradient::getColorBarName() const
|
||||
{
|
||||
return QT_TRANSLATE_NOOP("QObject", "Color Gradient");
|
||||
}
|
||||
|
||||
void SoFCColorGradient::setMarkerLabel(const SoMFString& label)
|
||||
{
|
||||
coinRemoveAllChildren(labels);
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include <Inventor/SbBox2f.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
|
||||
#include <QCoreApplication> // For translation functions
|
||||
|
||||
#include "SoFCColorBar.h"
|
||||
|
||||
|
||||
@@ -42,7 +40,6 @@ class GuiExport SoFCColorGradient : public SoFCColorBarBase {
|
||||
using inherited = SoFCColorBarBase;
|
||||
|
||||
SO_NODE_HEADER(Gui::SoFCColorGradient);
|
||||
Q_DECLARE_TR_FUNCTIONS(SoFCColorGradient);
|
||||
|
||||
public:
|
||||
static void initClass();
|
||||
@@ -74,7 +71,7 @@ public:
|
||||
*/
|
||||
void customize(SoFCColorBarBase*) override;
|
||||
/** Returns the name of the color bar. */
|
||||
const char* getColorBarName() const override { return tr("Color Gradient").toStdString().c_str(); }
|
||||
const char* getColorBarName() const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <QCoreApplication>
|
||||
# include <Inventor/fields/SoMFString.h>
|
||||
# include <Inventor/nodes/SoBaseColor.h>
|
||||
# include <Inventor/nodes/SoCoordinate3.h>
|
||||
@@ -81,6 +82,11 @@ void SoFCColorLegend::finish()
|
||||
atexit_cleanup();
|
||||
}
|
||||
|
||||
const char* SoFCColorLegend::getColorBarName() const
|
||||
{
|
||||
return QT_TRANSLATE_NOOP("QObject", "Color Legend");
|
||||
}
|
||||
|
||||
namespace {
|
||||
std::vector<SbVec3f> getLabelPositions(int num, const SbBox2f& bbox)
|
||||
{
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include <Inventor/SbBox2f.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
|
||||
#include <QCoreApplication> // For translation functions
|
||||
|
||||
#include "SoFCColorBar.h"
|
||||
|
||||
|
||||
@@ -41,7 +39,6 @@ class GuiExport SoFCColorLegend : public SoFCColorBarBase {
|
||||
using inherited = SoFCColorBarBase;
|
||||
|
||||
SO_NODE_HEADER(Gui::SoFCColorLegend);
|
||||
Q_DECLARE_TR_FUNCTIONS(SoFCColorLegend);
|
||||
|
||||
public:
|
||||
static void initClass();
|
||||
@@ -69,7 +66,7 @@ public:
|
||||
std::size_t countColors () const { return _currentLegend.hasNumberOfFields(); }
|
||||
|
||||
void customize(SoFCColorBarBase*) override { }
|
||||
const char* getColorBarName() const override { return tr("Color Legend").toStdString().c_str(); }
|
||||
const char* getColorBarName() const override;
|
||||
|
||||
// virtual void handleEvent(SoHandleEventAction * action);
|
||||
// virtual void GLRenderBelowPath(SoGLRenderAction * action);
|
||||
|
||||
Reference in New Issue
Block a user