mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-23 20:56:41 +00:00
Operators supporting this conversion can be disabled via QT_NO_CAST_FROM_BYTEARRAY breaking the build. For example: https://koschei.fedoraproject.org//package/openmw https://kojipkgs.fedoraproject.org/work/tasks/5096/137735096/build.log
29 lines
948 B
C++
29 lines
948 B
C++
#include "qtconversion.hpp"
|
|
|
|
#include <components/misc/strings/conversion.hpp>
|
|
|
|
#include <string_view>
|
|
|
|
QString Files::pathToQString(const std::filesystem::path& path)
|
|
{
|
|
const auto tmp = path.u8string();
|
|
return QString::fromUtf8(Misc::StringUtils::u8StringToString(tmp.data()), tmp.size());
|
|
}
|
|
|
|
QString Files::pathToQString(std::filesystem::path&& path)
|
|
{
|
|
const auto tmp = path.u8string();
|
|
return QString::fromUtf8(Misc::StringUtils::u8StringToString(tmp.data()), tmp.size());
|
|
}
|
|
|
|
std::filesystem::path Files::pathFromQString(QStringView path)
|
|
{
|
|
const QByteArray tmp = path.toUtf8();
|
|
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
|
|
}
|
|
|
|
std::filesystem::path Files::pathFromQString(QString&& path)
|
|
{
|
|
const QByteArray tmp = path.toUtf8();
|
|
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
|
|
}
|