openmw-tes3coop/apps/opencs/model/world/nestedtablemodel.hpp

55 lines
1.5 KiB
C++
Raw Normal View History

#ifndef CSM_WOLRD_NESTEDTABLEMODEL_H
#define CSM_WOLRD_NESTEDTABLEMODEL_H
#include <vector>
#include <QAbstractProxyModel>
#include "universalid.hpp"
#include "columns.hpp"
#include "columnbase.hpp"
/*! \brief
* Proxy model used to connect view in the dialogue into the nested columns of the main model.
*/
namespace CSMWorld
{
class CollectionBase;
class RecordBase;
class IdTable;
class NestedTableModel : public QAbstractProxyModel
{
const int mParentColumn;
std::string mId;
std::vector<std::string> mHeaderTitle;
std::vector<ColumnBase::Display> mHeaderDisplay;
2014-06-18 14:53:46 +00:00
public:
NestedTableModel(const QModelIndex& parent,
ColumnBase::Display displayType,
IdTable* parentModel);
//parent is the parent of columns to work with. Columnid provides information about the column
2014-06-18 14:53:46 +00:00
virtual QModelIndex mapFromSource(const QModelIndex& sourceIndex) const;
2014-06-18 14:53:46 +00:00
virtual QModelIndex mapToSource(const QModelIndex& proxyIndex) const;
2014-06-18 14:53:46 +00:00
virtual int rowCount(const QModelIndex& parent) const;
virtual int columnCount(const QModelIndex& parent) const;
virtual QModelIndex index(int row, int column, const QModelIndex& parent) const;
virtual QModelIndex parent(const QModelIndex& index) const;
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role ) const;
private:
void setupHeaderVectors(ColumnBase::Display columnId);
};
}
#endif