We are in the process of upgrading from Qt 4.8.7 to Qt 5.5.1. In our software, I have a class derived from QTranslator. The class overrides the translate function. We do this to keep the last untranslated string in memory. This works fine in Qt4.8.7. The overridden translate function is called during program execution. Going to Qt5, a parameter is added, but otherwise the function looks the same. We we adjusted the override for this parameter. Yet when running the software the overridden translate function is never called. I'm at a loss why this is happening. Any ideas?
Basically, something like this:
{
public:
// Constructors and Destructors
CTranslationManager();
virtual ~CTranslationManager();
//virtual QString translate(const char* context, const char* sourceText, const char* disambiguation = 0) const override; // Qt4 code
virtual QString translate
(const char* context,
const char* sourceText,
const char* disambiguation
= 0,
int n
= -1) const override
{
m_CurrentUntranslated = sourceText;
return QTranslator::translate(context, sourceText, disambiguation, n
);
}
private:
mutable
QString m_CurrentUntranslated;
};
class CTranslationManager : public QTranslator
{
public:
// Constructors and Destructors
CTranslationManager();
virtual ~CTranslationManager();
//virtual QString translate(const char* context, const char* sourceText, const char* disambiguation = 0) const override; // Qt4 code
virtual QString translate(const char* context, const char* sourceText, const char* disambiguation = 0, int n = -1) const override
{
m_CurrentUntranslated = sourceText;
return QTranslator::translate(context, sourceText, disambiguation, n);
}
private:
mutable QString m_CurrentUntranslated;
};
To copy to clipboard, switch view to plain text mode
Bookmarks