Add qstringFromStdStringView()
This commit is contained in:
parent
25062fcf01
commit
abb9f5790a
|
@ -9,8 +9,8 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||||
set(META_APP_DESCRIPTION
|
set(META_APP_DESCRIPTION
|
||||||
"Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
|
"Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
|
||||||
set(META_VERSION_MAJOR 6)
|
set(META_VERSION_MAJOR 6)
|
||||||
set(META_VERSION_MINOR 3)
|
set(META_VERSION_MINOR 4)
|
||||||
set(META_VERSION_PATCH 4)
|
set(META_VERSION_PATCH 0)
|
||||||
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
||||||
|
|
||||||
project(${META_PROJECT_NAME})
|
project(${META_PROJECT_NAME})
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
namespace QtUtilities {
|
namespace QtUtilities {
|
||||||
|
|
||||||
|
@ -36,6 +37,11 @@ inline QString fromNativeFileName(const std::string &nativeFileName)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QString qstringFromStdStringView(std::string_view stringView)
|
||||||
|
{
|
||||||
|
return QString::fromUtf8(stringView.data(), static_cast<QString::size_type>(stringView.size()));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QtUtilities
|
} // namespace QtUtilities
|
||||||
|
|
||||||
#endif // QT_UTILITIES_CONVERSION_H
|
#endif // QT_UTILITIES_CONVERSION_H
|
||||||
|
|
Loading…
Reference in New Issue