mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-21 20:26:36 +00:00
Do not implicitly convert QByteArray to const char*
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
This commit is contained in:
parent
ef05e089ab
commit
0bae2b14b1
4 changed files with 17 additions and 13 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,12 @@ 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) };
|
||||
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 auto tmp = path.toUtf8();
|
||||
return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) };
|
||||
const QByteArray tmp = path.toUtf8();
|
||||
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue