From d64c32554b901382679128d127f2b7716e578ac7 Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Sat, 14 May 2016 19:21:30 +0200 Subject: [PATCH] Translate text for current Qt(not both Qt4 & Qt5). Check Qt version on compile time, and translate text for current Qt version. --- gui/translationhandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gui/translationhandler.cpp b/gui/translationhandler.cpp index e14577d6eab..498aee15ace 100644 --- a/gui/translationhandler.cpp +++ b/gui/translationhandler.cpp @@ -29,16 +29,19 @@ // Provide own translations for standard buttons. This (garbage) code is needed to enforce them to appear in .ts files even after "lupdate gui.pro" static void unused() { - // Qt4 +#if ((QT_VERSION >= 0x040000)&&(QT_VERSION < 0x050000)) Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "OK")); Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Cancel")); Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Close")); Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Save")); - // Qt5 +#elif ((QT_VERSION >= 0x050000)&&(QT_VERSION < 0x060000)) Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "OK")); Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Cancel")); Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Close")); Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Save")); +#else +#error Unsupported Qt version. +#endif } TranslationHandler::TranslationHandler(QObject *parent) :