mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-22 15:56:35 +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();
|
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);
|
QAbstractProxyModel::setSourceModel(parentModel);
|
||||||
|
|
||||||
|
|
|
@ -362,8 +362,8 @@ void CSVWorld::CommandDelegate::setEditorData(QWidget* editor, const QModelIndex
|
||||||
if (!n.isEmpty())
|
if (!n.isEmpty())
|
||||||
{
|
{
|
||||||
if (!variant.isValid())
|
if (!variant.isValid())
|
||||||
variant = QVariant(editor->property(n).metaType(), (const void*)nullptr);
|
variant = QVariant(editor->property(n.constData()).metaType(), (const void*)nullptr);
|
||||||
editor->setProperty(n, variant);
|
editor->setProperty(n.constData(), variant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
#include "qtconversion.hpp"
|
#include "qtconversion.hpp"
|
||||||
|
|
||||||
#include <components/misc/strings/conversion.hpp>
|
#include <components/misc/strings/conversion.hpp>
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
QString Files::pathToQString(const std::filesystem::path& path)
|
QString Files::pathToQString(const std::filesystem::path& path)
|
||||||
{
|
{
|
||||||
const auto tmp = path.u8string();
|
const auto tmp = path.u8string();
|
||||||
|
@ -17,12 +18,12 @@ QString Files::pathToQString(std::filesystem::path&& path)
|
||||||
|
|
||||||
std::filesystem::path Files::pathFromQString(QStringView path)
|
std::filesystem::path Files::pathFromQString(QStringView path)
|
||||||
{
|
{
|
||||||
const auto tmp = path.toUtf8();
|
const QByteArray tmp = path.toUtf8();
|
||||||
return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) };
|
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path Files::pathFromQString(QString&& path)
|
std::filesystem::path Files::pathFromQString(QString&& path)
|
||||||
{
|
{
|
||||||
const auto tmp = path.toUtf8();
|
const QByteArray tmp = path.toUtf8();
|
||||||
return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) };
|
return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
#include "qtconversion.hpp"
|
#include "qtconversion.hpp"
|
||||||
|
|
||||||
#include <components/misc/strings/conversion.hpp>
|
#include <components/misc/strings/conversion.hpp>
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
QString VFS::Path::normalizedToQString(NormalizedView path)
|
QString VFS::Path::normalizedToQString(NormalizedView path)
|
||||||
{
|
{
|
||||||
return QString::fromUtf8(path.value().data(), path.value().size());
|
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)
|
VFS::Path::Normalized VFS::Path::normalizedFromQString(QStringView path)
|
||||||
{
|
{
|
||||||
const auto tmp = path.toUtf8();
|
const QByteArray tmp = path.toUtf8();
|
||||||
return Normalized{ tmp };
|
return Normalized(std::string_view(tmp.constData(), tmp.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
VFS::Path::Normalized VFS::Path::normalizedFromQString(QString&& path)
|
VFS::Path::Normalized VFS::Path::normalizedFromQString(QString&& path)
|
||||||
{
|
{
|
||||||
const auto tmp = path.toUtf8();
|
const QByteArray tmp = std::move(path).toUtf8();
|
||||||
return Normalized{ tmp };
|
return Normalized(std::string_view(tmp.constData(), tmp.size()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue