1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00
openmw/apps/opencs/model/world/resourcetable.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
2.3 KiB
C++
Raw Normal View History

2014-07-05 13:50:47 +00:00
#ifndef CSM_WOLRD_RESOURCETABLE_H
#define CSM_WOLRD_RESOURCETABLE_H
#include "idtablebase.hpp"
2022-10-19 17:02:00 +00:00
#include <QModelIndex>
#include <QVariant>
#include <string>
#include <utility>
#include <apps/opencs/model/world/columns.hpp>
2014-07-05 13:50:47 +00:00
namespace CSMWorld
{
class Resources;
2022-10-19 17:02:00 +00:00
class UniversalId;
2014-07-05 13:50:47 +00:00
class ResourceTable : public IdTableBase
{
const Resources* mResources;
public:
/// \note The feature Feature_Constant will be added implicitly.
ResourceTable(const Resources* resources, unsigned int features = 0);
~ResourceTable() override = default;
2014-07-05 13:50:47 +00:00
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
2014-07-05 13:50:47 +00:00
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
2014-07-05 13:50:47 +00:00
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
2014-07-05 13:50:47 +00:00
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
2014-07-05 13:50:47 +00:00
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
2014-07-05 13:50:47 +00:00
Qt::ItemFlags flags(const QModelIndex& index) const override;
2014-07-05 13:50:47 +00:00
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
2014-07-05 13:50:47 +00:00
QModelIndex parent(const QModelIndex& index) const override;
2014-07-05 13:50:47 +00:00
QModelIndex getModelIndex(const std::string& id, int column) const override;
2014-07-05 13:50:47 +00:00
/// Return index of column with the given \a id. If no such column exists, -1 is
2014-07-05 13:50:47 +00:00
/// returned.
int searchColumnIndex(Columns::ColumnId id) const override;
2014-07-05 13:50:47 +00:00
/// Return index of column with the given \a id. If no such column exists, an
/// exception is thrown.
int findColumnIndex(Columns::ColumnId id) const override;
2014-07-05 13:50:47 +00:00
/// Return the UniversalId and the hint for viewing \a row. If viewing is not
/// supported by this table, return (UniversalId::Type_None, "").
std::pair<UniversalId, std::string> view(int row) const override;
2014-07-05 13:50:47 +00:00
/// Is \a id flagged as deleted?
bool isDeleted(const std::string& id) const override;
2014-07-05 13:50:47 +00:00
int getColumnId(int column) const override;
2017-08-19 07:43:31 +00:00
/// Signal Qt that the data is about to change.
void beginReset();
/// Signal Qt that the data has been changed.
void endReset();
2014-07-05 13:50:47 +00:00
};
}
#endif