Consider below code:
static constexpr QString FOO = QStringLiteral("foo"); // erro compile , because QString has not default destructor.
How I can create QString at compile time!? is it possible to create QString at compile time?
In Qt 6.2, you can use the u"my string"_qs
syntax.
However, that has been deprecated in Qt 6.8, see Obsolete Members for QtLiterals — QtLiterals::operator""_qs(const char16_t *str, size_t size)
Since Qt 6.4, you can use the new u"my string"_s
syntax from the Qt::Literals::StringLiterals
namespace.
using namespace Qt::Literals::StringLiterals;
auto str = u"hello"_s;