1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-10 15:45:37 +00:00

Fix(columnimp.hpp): Use QVariant() constructor instead of UserType to

hide unused subs from view and make a member variable to tell if the
column is used for a door or a regular position
This commit is contained in:
Dave Corley 2024-03-26 01:53:25 -05:00
parent 1360eeb839
commit 4e59246d2d

View File

@ -1167,7 +1167,7 @@ namespace CSMWorld
QVariant get(const Record<ESXRecordT>& record) const override QVariant get(const Record<ESXRecordT>& record) const override
{ {
if (!record.get().mTeleport) if (!record.get().mTeleport)
return QVariant(QVariant::UserType); return QVariant();
return QString::fromUtf8(record.get().mDestCell.c_str()); return QString::fromUtf8(record.get().mDestCell.c_str());
} }
@ -1312,21 +1312,21 @@ namespace CSMWorld
{ {
ESM::Position ESXRecordT::*mPosition; ESM::Position ESXRecordT::*mPosition;
int mIndex; int mIndex;
bool mIsDoor;
PosColumn(ESM::Position ESXRecordT::*position, int index, bool door) PosColumn(ESM::Position ESXRecordT::*position, int index, bool door)
: Column<ESXRecordT>((door ? Columns::ColumnId_DoorPositionXPos : Columns::ColumnId_PositionXPos) + index, : Column<ESXRecordT>((door ? Columns::ColumnId_DoorPositionXPos : Columns::ColumnId_PositionXPos) + index,
ColumnBase::Display_Float) ColumnBase::Display_Float)
, mPosition(position) , mPosition(position)
, mIndex(index) , mIndex(index)
, mIsDoor(door)
{ {
} }
QVariant get(const Record<ESXRecordT>& record) const override QVariant get(const Record<ESXRecordT>& record) const override
{ {
int column = this->mColumnId; if (!record.get().mTeleport && mIsDoor)
if (!record.get().mTeleport && column >= Columns::ColumnId_DoorPositionXPos return QVariant();
&& column <= Columns::ColumnId_DoorPositionZPos)
return QVariant(QVariant::UserType);
const ESM::Position& position = record.get().*mPosition; const ESM::Position& position = record.get().*mPosition;
return position.pos[mIndex]; return position.pos[mIndex];
} }
@ -1350,21 +1350,21 @@ namespace CSMWorld
{ {
ESM::Position ESXRecordT::*mPosition; ESM::Position ESXRecordT::*mPosition;
int mIndex; int mIndex;
bool mIsDoor;
RotColumn(ESM::Position ESXRecordT::*position, int index, bool door) RotColumn(ESM::Position ESXRecordT::*position, int index, bool door)
: Column<ESXRecordT>((door ? Columns::ColumnId_DoorPositionXRot : Columns::ColumnId_PositionXRot) + index, : Column<ESXRecordT>((door ? Columns::ColumnId_DoorPositionXRot : Columns::ColumnId_PositionXRot) + index,
ColumnBase::Display_Double) ColumnBase::Display_Double)
, mPosition(position) , mPosition(position)
, mIndex(index) , mIndex(index)
, mIsDoor(door)
{ {
} }
QVariant get(const Record<ESXRecordT>& record) const override QVariant get(const Record<ESXRecordT>& record) const override
{ {
int column = this->mColumnId; if (!record.get().mTeleport && mIsDoor)
if (!record.get().mTeleport && column >= Columns::ColumnId_DoorPositionXRot return QVariant();
&& column <= Columns::ColumnId::ColumnId_DoorPositionZRot)
return QVariant(QVariant::UserType);
const ESM::Position& position = record.get().*mPosition; const ESM::Position& position = record.get().*mPosition;
return osg::RadiansToDegrees(position.rot[mIndex]); return osg::RadiansToDegrees(position.rot[mIndex]);
} }