c++/feature: add qstring conversation helper
@@ -29,6 +29,12 @@ struct RustStrView {
return boost::string_view{ data, len };
}
#endif
+#if QT_VERSION >= 0x050000 && defined(QSTRING_H)
+ QString to_qstring() const
+ {
+ return QString::fromUtf8(data, len);
+ }
+#endif
};
struct CRustString {
@@ -98,6 +104,12 @@ public:
return boost::string_view{ data, len };
}
#endif
+#if QT_VERSION >= 0x050000 && defined(QSTRING_H)
+ QString to_qstring() const
+ {
+ return QString::fromUtf8(data, len);
+ }
+#endif
private:
void free_mem() noexcept
{
