2014-06-18 13:35:31 +00:00
|
|
|
#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;
|
2014-06-19 16:46:09 +00:00
|
|
|
IdTable* mMainModel;
|
2014-06-18 13:35:31 +00:00
|
|
|
std::string mId;
|
2014-06-18 14:53:46 +00:00
|
|
|
|
2014-06-18 13:35:31 +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
|
|
|
|
2014-06-18 13:35:31 +00:00
|
|
|
virtual QModelIndex mapFromSource(const QModelIndex& sourceIndex) const;
|
2014-06-18 14:53:46 +00:00
|
|
|
|
2014-06-18 13:35:31 +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;
|
2014-06-18 15:34:21 +00:00
|
|
|
|
|
|
|
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role ) const;
|
|
|
|
|
2014-06-30 12:12:57 +00:00
|
|
|
virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
|
|
|
|
|
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
|
|
|
|
|
2014-06-18 15:34:21 +00:00
|
|
|
private:
|
|
|
|
void setupHeaderVectors(ColumnBase::Display columnId);
|
2014-06-18 13:35:31 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|