mirror of https://github.com/PCSX2/pcsx2.git
Qt: Add QtUtils::StringViewToQString()
This commit is contained in:
parent
280f5adb22
commit
8b9eee4961
|
@ -690,6 +690,11 @@ namespace QtUtils
|
|||
return OpenURL(parent, QUrl(url));
|
||||
}
|
||||
|
||||
QString StringViewToQString(const std::string_view& str)
|
||||
{
|
||||
return str.empty() ? QString() : QString::fromUtf8(str.data(), str.size());
|
||||
}
|
||||
|
||||
wxString QStringToWxString(const QString& str)
|
||||
{
|
||||
return wxString(str.toStdWString());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QtCore/QString>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
|
||||
Q_DECLARE_METATYPE(std::optional<bool>);
|
||||
|
@ -79,6 +80,9 @@ namespace QtUtils
|
|||
/// Opens a URL string with the default handler.
|
||||
void OpenURL(QWidget* parent, const QString& url);
|
||||
|
||||
/// Converts a std::string_view to a QString safely.
|
||||
QString StringViewToQString(const std::string_view& str);
|
||||
|
||||
// TODO: Get rid of wx interoperability later on.
|
||||
wxString QStringToWxString(const QString& str);
|
||||
QString WxStringToQString(const wxString& str);
|
||||
|
|
Loading…
Reference in New Issue