1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-22 18:26:36 +00:00

Merge branch 'fix_qt_build' into 'master'

Do not implicitly convert QByteArray to const char*

See merge request OpenMW/openmw!4941
This commit is contained in:
Alexei Kotov 2025-10-18 18:41:24 +03:00
commit 1f839d264d
4 changed files with 15 additions and 13 deletions

View file

@ -13,7 +13,9 @@ CSMWorld::NestedTableProxyModel::NestedTableProxyModel(
{
const int parentRow = parent.row();
mId = std::string(parentModel->index(parentRow, 0).data().toString().toUtf8());
const QByteArray utf8 = parentModel->index(parentRow, 0).data().toString().toUtf8();
mId = std::string(utf8.constData(), utf8.size());
QAbstractProxyModel::setSourceModel(parentModel);

View file

@ -362,8 +362,8 @@ void CSVWorld::CommandDelegate::setEditorData(QWidget* editor, const QModelIndex
if (!n.isEmpty())
{
if (!variant.isValid())
variant = QVariant(editor->property(n).metaType(), (const void*)nullptr);
editor->setProperty(n, variant);
variant = QVariant(editor->property(n.constData()).metaType(), (const void*)nullptr);
editor->setProperty(n.constData(), variant);
}
}

View file

@ -1,8 +1,9 @@
#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();
@ -17,12 +18,10 @@ QString Files::pathToQString(std::filesystem::path&& path)
std::filesystem::path Files::pathFromQString(QStringView path)
{
const auto tmp = path.toUtf8();
return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) };
return std::filesystem::path(std::u16string_view(path.utf16(), path.size()));
}
std::filesystem::path Files::pathFromQString(QString&& path)
{
const auto tmp = path.toUtf8();
return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) };
return std::filesystem::path(path.toStdU16String());
}

View file

@ -1,8 +1,9 @@
#include "qtconversion.hpp"
#include <components/misc/strings/conversion.hpp>
#include <string_view>
QString VFS::Path::normalizedToQString(NormalizedView path)
{
return QString::fromUtf8(path.value().data(), path.value().size());
@ -15,12 +16,12 @@ QString VFS::Path::normalizedToQString(Normalized&& path)
VFS::Path::Normalized VFS::Path::normalizedFromQString(QStringView path)
{
const auto tmp = path.toUtf8();
return Normalized{ tmp };
const QByteArray tmp = path.toUtf8();
return Normalized(std::string_view(tmp.constData(), tmp.size()));
}
VFS::Path::Normalized VFS::Path::normalizedFromQString(QString&& path)
{
const auto tmp = path.toUtf8();
return Normalized{ tmp };
const QByteArray tmp = std::move(path).toUtf8();
return Normalized(std::string_view(tmp.constData(), tmp.size()));
}