2022-06-23 21:36:00 -04:00
|
|
|
#ifndef CHUNKMODEL_H
|
|
|
|
#define CHUNKMODEL_H
|
|
|
|
|
2022-07-10 23:51:49 -04:00
|
|
|
#include <chunk.h>
|
|
|
|
#include <QAbstractItemModel>
|
2022-06-23 21:36:00 -04:00
|
|
|
|
2022-07-10 23:51:49 -04:00
|
|
|
class ChunkModel : public QAbstractItemModel
|
2022-06-23 21:36:00 -04:00
|
|
|
{
|
2022-07-03 23:45:57 -04:00
|
|
|
Q_OBJECT
|
2022-06-23 21:36:00 -04:00
|
|
|
public:
|
|
|
|
enum Columns
|
|
|
|
{
|
|
|
|
kColType,
|
2022-06-27 12:44:50 -04:00
|
|
|
kColOffset,
|
2022-06-23 21:36:00 -04:00
|
|
|
kColDesc,
|
2022-07-04 02:33:56 -04:00
|
|
|
kColObjectID,
|
2022-06-23 21:36:00 -04:00
|
|
|
|
|
|
|
kColCount
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit ChunkModel(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
virtual QModelIndex parent(const QModelIndex &index) const override;
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
|
|
|
2022-07-10 23:51:49 -04:00
|
|
|
void SetChunk(si::Chunk *c);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
si::Chunk *GetChunkFromIndex(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
si::Chunk *root() const { return chunk_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
si::Chunk *chunk_;
|
|
|
|
|
2022-06-23 21:36:00 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CHUNKMODEL_H
|