mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-04 06:49:43 +00:00
added ID column to report table
This commit is contained in:
parent
4042b12013
commit
a8cdd30124
2 changed files with 37 additions and 12 deletions
|
@ -22,7 +22,7 @@ int CSMTools::ReportModel::columnCount (const QModelIndex & parent) const
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CSMTools::ReportModel::data (const QModelIndex & index, int role) const
|
QVariant CSMTools::ReportModel::data (const QModelIndex & index, int role) const
|
||||||
|
@ -30,13 +30,32 @@ QVariant CSMTools::ReportModel::data (const QModelIndex & index, int role) const
|
||||||
if (role!=Qt::DisplayRole)
|
if (role!=Qt::DisplayRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (index.column()==0)
|
switch (index.column())
|
||||||
return static_cast<int> (mRows.at (index.row()).mId.getType());
|
{
|
||||||
|
case Column_Type:
|
||||||
|
|
||||||
if (index.column()==1)
|
return static_cast<int> (mRows.at (index.row()).mId.getType());
|
||||||
return QString::fromUtf8 (mRows.at (index.row()).mMessage.c_str());
|
|
||||||
|
|
||||||
return QString::fromUtf8 (mRows.at (index.row()).mHint.c_str());
|
case Column_Id:
|
||||||
|
{
|
||||||
|
CSMWorld::UniversalId id = mRows.at (index.row()).mId;
|
||||||
|
|
||||||
|
if (id.getArgumentType()==CSMWorld::UniversalId::ArgumentType_Id)
|
||||||
|
return QString::fromUtf8 (id.getId().c_str());
|
||||||
|
|
||||||
|
return QString ("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
case Column_Description:
|
||||||
|
|
||||||
|
return QString::fromUtf8 (mRows.at (index.row()).mMessage.c_str());
|
||||||
|
|
||||||
|
case Column_Hint:
|
||||||
|
|
||||||
|
return QString::fromUtf8 (mRows.at (index.row()).mHint.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orientation, int role) const
|
QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orientation, int role) const
|
||||||
|
@ -47,13 +66,14 @@ QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orienta
|
||||||
if (orientation==Qt::Vertical)
|
if (orientation==Qt::Vertical)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (section==0)
|
switch (section)
|
||||||
return "Type";
|
{
|
||||||
|
case Column_Type: return "Type";
|
||||||
|
case Column_Id: return "ID";
|
||||||
|
case Column_Description: return "Description";
|
||||||
|
}
|
||||||
|
|
||||||
if (section==1)
|
return "-";
|
||||||
return "Description";
|
|
||||||
|
|
||||||
return "Hint";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSMTools::ReportModel::removeRows (int row, int count, const QModelIndex& parent)
|
bool CSMTools::ReportModel::removeRows (int row, int count, const QModelIndex& parent)
|
||||||
|
|
|
@ -26,6 +26,11 @@ namespace CSMTools
|
||||||
|
|
||||||
std::vector<Line> mRows;
|
std::vector<Line> mRows;
|
||||||
|
|
||||||
|
enum Columns
|
||||||
|
{
|
||||||
|
Column_Type = 0, Column_Id = 1, Column_Hint = 2, Column_Description = 3
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual int rowCount (const QModelIndex & parent = QModelIndex()) const;
|
virtual int rowCount (const QModelIndex & parent = QModelIndex()) const;
|
||||||
|
|
Loading…
Reference in a new issue