mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
added hidden hint column to report model
This commit is contained in:
parent
6c18a3b0b5
commit
350b0cb93c
3 changed files with 28 additions and 9 deletions
|
@ -16,7 +16,7 @@ int CSMTools::ReportModel::columnCount (const QModelIndex & parent) const
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CSMTools::ReportModel::data (const QModelIndex & index, int role) const
|
QVariant CSMTools::ReportModel::data (const QModelIndex & index, int role) const
|
||||||
|
@ -26,8 +26,11 @@ QVariant CSMTools::ReportModel::data (const QModelIndex & index, int role) const
|
||||||
|
|
||||||
if (index.column()==0)
|
if (index.column()==0)
|
||||||
return static_cast<int> (mRows.at (index.row()).first.getType());
|
return static_cast<int> (mRows.at (index.row()).first.getType());
|
||||||
else
|
|
||||||
return mRows.at (index.row()).second.c_str();
|
if (index.column()==1)
|
||||||
|
return QString::fromUtf8 (mRows.at (index.row()).second.first.c_str());
|
||||||
|
|
||||||
|
return QString::fromUtf8 (mRows.at (index.row()).second.second.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orientation, int role) const
|
QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orientation, int role) const
|
||||||
|
@ -38,7 +41,13 @@ QVariant CSMTools::ReportModel::headerData (int section, Qt::Orientation orienta
|
||||||
if (orientation==Qt::Vertical)
|
if (orientation==Qt::Vertical)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return tr (section==0 ? "Type" : "Description");
|
if (section==0)
|
||||||
|
return "Type";
|
||||||
|
|
||||||
|
if (section==1)
|
||||||
|
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)
|
||||||
|
@ -51,11 +60,12 @@ bool CSMTools::ReportModel::removeRows (int row, int count, const QModelIndex& p
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReportModel::add (const CSMWorld::UniversalId& id, const std::string& message)
|
void CSMTools::ReportModel::add (const CSMWorld::UniversalId& id, const std::string& message,
|
||||||
|
const std::string& hint)
|
||||||
{
|
{
|
||||||
beginInsertRows (QModelIndex(), mRows.size(), mRows.size());
|
beginInsertRows (QModelIndex(), mRows.size(), mRows.size());
|
||||||
|
|
||||||
mRows.push_back (std::make_pair (id, message));
|
mRows.push_back (std::make_pair (id, std::make_pair (message, hint)));
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
@ -64,3 +74,8 @@ const CSMWorld::UniversalId& CSMTools::ReportModel::getUniversalId (int row) con
|
||||||
{
|
{
|
||||||
return mRows.at (row).first;
|
return mRows.at (row).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CSMTools::ReportModel::getHint (int row) const
|
||||||
|
{
|
||||||
|
return mRows.at (row).second.second;
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ namespace CSMTools
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
std::vector<std::pair<CSMWorld::UniversalId, std::string> > mRows;
|
std::vector<std::pair<CSMWorld::UniversalId, std::pair<std::string, std::string> > > mRows;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -28,9 +28,12 @@ namespace CSMTools
|
||||||
|
|
||||||
virtual bool removeRows (int row, int count, const QModelIndex& parent = QModelIndex());
|
virtual bool removeRows (int row, int count, const QModelIndex& parent = QModelIndex());
|
||||||
|
|
||||||
void add (const CSMWorld::UniversalId& id, const std::string& message);
|
void add (const CSMWorld::UniversalId& id, const std::string& message,
|
||||||
|
const std::string& hint = "");
|
||||||
|
|
||||||
const CSMWorld::UniversalId& getUniversalId (int row) const;
|
const CSMWorld::UniversalId& getUniversalId (int row) const;
|
||||||
|
|
||||||
|
std::string getHint (int row) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
||||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
setModel (mModel);
|
setModel (mModel);
|
||||||
|
setColumnHidden (2, true);
|
||||||
|
|
||||||
mIdTypeDelegate = CSVWorld::IdTypeDelegateFactory().makeDelegate (
|
mIdTypeDelegate = CSVWorld::IdTypeDelegateFactory().makeDelegate (
|
||||||
document, this);
|
document, this);
|
||||||
|
@ -55,5 +56,5 @@ void CSVTools::ReportTable::updateUserSetting (const QString& name, const QStrin
|
||||||
|
|
||||||
void CSVTools::ReportTable::show (const QModelIndex& index)
|
void CSVTools::ReportTable::show (const QModelIndex& index)
|
||||||
{
|
{
|
||||||
emit editRequest (mModel->getUniversalId (index.row()), "");
|
emit editRequest (mModel->getUniversalId (index.row()), mModel->getHint (index.row()));
|
||||||
}
|
}
|
Loading…
Reference in a new issue