mirror of
https://github.com/isledecomp/SIEdit.git
synced 2024-11-23 15:48:03 -05:00
26 lines
480 B
C++
26 lines
480 B
C++
#include "abstractsiitemmodel.h"
|
|
|
|
using namespace si;
|
|
|
|
AbstractSIItemModel::AbstractSIItemModel(QObject *parent) :
|
|
QAbstractItemModel{parent},
|
|
chunk_(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
void AbstractSIItemModel::SetChunk(si::Chunk *c)
|
|
{
|
|
beginResetModel();
|
|
chunk_ = c;
|
|
endResetModel();
|
|
}
|
|
|
|
si::Chunk *AbstractSIItemModel::GetChunkFromIndex(const QModelIndex &index) const
|
|
{
|
|
if (!index.isValid()) {
|
|
return chunk_;
|
|
} else {
|
|
return static_cast<Chunk*>(index.internalPointer());
|
|
}
|
|
}
|