Enabling Qt-less DB plugins for Qt-enabled applications

This commit is contained in:
Matthias Koefferlein 2025-06-26 20:35:39 +02:00
parent eb3be68030
commit f3cc7cadc0
2 changed files with 17 additions and 6 deletions

View File

@ -119,12 +119,12 @@ std::string tr (const char *s)
}
#if ! defined(HAVE_QT)
std::string tr (const char *s)
std::string tr_fallback (const char *s)
{
#if defined(HAVE_QT)
return tl::to_string (QObject::tr (s));
#else
// TODO: this is a fallback implementation without translation
return std::string (s);
}
#endif
}

View File

@ -43,7 +43,18 @@ inline QString tr (const char *s)
return QObject::tr (s);
}
#else
std::string TL_PUBLIC tr (const char *s);
// NOTE: with this definition in place, we can build plugins without Qt,
// by using "tr" and falling back here, even if Qt is enabled
#define __KLAYOUT_TL_HAVE_TR_FALLBACK
std::string TL_PUBLIC tr_fallback (const char *s);
inline std::string tr (const char *s)
{
return tl::tr_fallback (s);
}
#endif
namespace tl