考虑以下代码:
static constexpr QString FOO = QStringLiteral("foo"); // erro compile , because QString has not default destructor.
如何在编译时创建QString!?是否可以在编译时创建QString?
在Qt6
之前,您可以使用:
constexpr QStringView FOO = u"foo";
在Qt 6.2中,您可以使用新的u"我的琴弦"_qs语法。https://doc.qt.io/qt-6/qstring.html#operator-22-22_qs