added ID column to report table

search
Marc Zinnschlag 10 years ago
parent 4042b12013
commit a8cdd30124

@ -22,7 +22,7 @@ int CSMTools::ReportModel::columnCount (const QModelIndex & parent) const
if (parent.isValid())
return 0;
return 3;
return 4;
}
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)
return QVariant();
if (index.column()==0)
return static_cast<int> (mRows.at (index.row()).mId.getType());
switch (index.column())
{
case Column_Type:
return static_cast<int> (mRows.at (index.row()).mId.getType());
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());
if (index.column()==1)
return QString::fromUtf8 (mRows.at (index.row()).mMessage.c_str());
return QString ("-");
}
case Column_Description:
return QString::fromUtf8 (mRows.at (index.row()).mHint.c_str());
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
@ -47,13 +66,14 @@ QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orienta
if (orientation==Qt::Vertical)
return QVariant();
if (section==0)
return "Type";
if (section==1)
return "Description";
switch (section)
{
case Column_Type: return "Type";
case Column_Id: return "ID";
case Column_Description: return "Description";
}
return "Hint";
return "-";
}
bool CSMTools::ReportModel::removeRows (int row, int count, const QModelIndex& parent)

@ -26,6 +26,11 @@ namespace CSMTools
std::vector<Line> mRows;
enum Columns
{
Column_Type = 0, Column_Id = 1, Column_Hint = 2, Column_Description = 3
};
public:
virtual int rowCount (const QModelIndex & parent = QModelIndex()) const;

Loading…
Cancel
Save