2014-06-08 02:58:49 +02:00
|
|
|
#ifndef ITEMLISTMODEL_HPP
|
|
|
|
#define ITEMLISTMODEL_HPP
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
|
|
|
|
#include <engine/GameWorld.hpp>
|
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
class ItemListModel : public QAbstractTableModel {
|
|
|
|
Q_OBJECT
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
GameWorld* _world;
|
2014-06-08 02:58:49 +02:00
|
|
|
|
|
|
|
public:
|
2016-09-09 22:13:21 +02:00
|
|
|
explicit ItemListModel(GameWorld* _world, QObject* parent = 0);
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
GameWorld* world() const {
|
|
|
|
return _world;
|
|
|
|
}
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
qint16 getIDOf(unsigned int row) const;
|
2014-06-10 01:46:48 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
virtual QVariant data(const QModelIndex& index,
|
|
|
|
int role = Qt::DisplayRole) const;
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const;
|
2014-06-10 01:46:48 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
QModelIndex index(int row, int column, const QModelIndex& parent) const;
|
2014-06-08 02:58:49 +02:00
|
|
|
};
|
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
#endif // ITEMLISTMODEL_HPP
|