mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
Fix Qt6 deprecation warning (QString::fromUcs4(uint))
This commit is contained in:
parent
15c6d4c6b3
commit
52dff70641
@ -47,13 +47,21 @@ QString toqstr(docstring const & ucs4)
|
|||||||
// need to be superfast.
|
// need to be superfast.
|
||||||
if (ucs4.empty())
|
if (ucs4.empty())
|
||||||
return QString();
|
return QString();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return QString::fromStdWString(ucs4);
|
||||||
|
#else
|
||||||
return QString::fromUcs4((uint const *)ucs4.data(), ucs4.length());
|
return QString::fromUcs4((uint const *)ucs4.data(), ucs4.length());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString toqstr(char_type ucs4)
|
QString toqstr(char_type ucs4)
|
||||||
{
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return QString::fromWCharArray(&ucs4, 1);
|
||||||
|
#else
|
||||||
union { char_type c; uint i; } u = { ucs4 };
|
union { char_type c; uint i; } u = { ucs4 };
|
||||||
return QString::fromUcs4(&u.i, 1);
|
return QString::fromUcs4(&u.i, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
docstring qstring_to_ucs4(QString const & qstr)
|
docstring qstring_to_ucs4(QString const & qstr)
|
||||||
|
Loading…
Reference in New Issue
Block a user