OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
idtree.hpp
Go to the documentation of this file.
1 #ifndef CSM_WOLRD_IDTREE_H
2 #define CSM_WOLRD_IDTREE_H
3 
4 #include "idtable.hpp"
5 #include "universalid.hpp"
6 #include "columns.hpp"
7 
19 namespace CSMWorld
20 {
21  class NestedCollection;
22  struct RecordBase;
23  struct NestedTableWrapperBase;
24 
25  class IdTree : public IdTable
26  {
27  Q_OBJECT
28 
29  private:
30 
32 
33  // not implemented
34  IdTree (const IdTree&);
35  IdTree& operator= (const IdTree&);
36 
37  unsigned int foldIndexAddress(const QModelIndex& index) const;
38  std::pair<int, int> unfoldIndexAddress(unsigned int id) const;
39 
40  public:
41 
42  IdTree (NestedCollection *nestedCollection, CollectionBase *idCollection, unsigned int features = 0);
44 
45  virtual ~IdTree();
46 
47  virtual int rowCount (const QModelIndex & parent = QModelIndex()) const;
48 
49  virtual int columnCount (const QModelIndex & parent = QModelIndex()) const;
50 
51  virtual QVariant data (const QModelIndex & index, int role = Qt::DisplayRole) const;
52 
53  virtual bool setData ( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
54 
55  virtual Qt::ItemFlags flags (const QModelIndex & index) const;
56 
57  virtual bool removeRows (int row, int count, const QModelIndex& parent = QModelIndex());
58 
59  virtual QModelIndex index (int row, int column, const QModelIndex& parent = QModelIndex())
60  const;
61 
62  virtual QModelIndex parent (const QModelIndex& index) const;
63 
64  QModelIndex getNestedModelIndex (const std::string& id, int column) const;
65 
66  QVariant nestedHeaderData(int section, int subSection, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
67 
68  NestedTableWrapperBase* nestedTable(const QModelIndex &index) const;
69 
70  void setNestedTable(const QModelIndex &index, const NestedTableWrapperBase& nestedTable);
71 
72  void addNestedRow (const QModelIndex& parent, int position);
73 
74  virtual bool hasChildren (const QModelIndex& index) const;
75 
76  virtual int searchNestedColumnIndex(int parentColumn, Columns::ColumnId id);
78 
79  virtual int findNestedColumnIndex(int parentColumn, Columns::ColumnId id);
81 
82  signals:
83 
84  void resetStart(const QString& id);
85 
86  void resetEnd(const QString& id);
87  };
88 }
89 
90 #endif
Definition: nestedtablewrapper.hpp:6
virtual QModelIndex parent(const QModelIndex &index) const
Definition: idtree.cpp:195
static const struct @2 signals[]
IdTree(const IdTree &)
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Definition: idtree.cpp:136
Definition: idtable.hpp:15
NestedTableWrapperBase * nestedTable(const QModelIndex &index) const
Definition: idtree.cpp:264
NestedCollection * mNestedCollection
Definition: idtree.hpp:31
std::pair< int, int > unfoldIndexAddress(unsigned int id) const
Definition: idtree.cpp:216
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: idtree.cpp:116
virtual int searchNestedColumnIndex(int parentColumn, Columns::ColumnId id)
Definition: idtree.cpp:272
virtual int findNestedColumnIndex(int parentColumn, Columns::ColumnId id)
Definition: idtree.cpp:277
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: idtree.cpp:25
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: idtree.cpp:173
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: idtree.cpp:33
QVariant nestedHeaderData(int section, int subSection, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: idtree.cpp:64
void setNestedTable(const QModelIndex &index, const NestedTableWrapperBase &nestedTable)
Definition: idtree.cpp:241
virtual ~IdTree()
Definition: idtree.cpp:14
IdTree & operator=(const IdTree &)
Base class for record collections.
Definition: collectionbase.hpp:23
void addNestedRow(const QModelIndex &parent, int position)
Definition: idtree.cpp:158
ColumnId
Definition: columns.hpp:13
virtual CollectionBase * idCollection() const
Definition: idtable.cpp:280
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: idtree.cpp:89
Definition: idtree.hpp:25
void resetStart(const QString &id)
QModelIndex getNestedModelIndex(const std::string &id, int column) const
Definition: idtree.cpp:190
Definition: nestedcollection.hpp:13
void resetEnd(const QString &id)
virtual bool hasChildren(const QModelIndex &index) const
Definition: idtree.cpp:233
unsigned int foldIndexAddress(const QModelIndex &index) const
Definition: idtree.cpp:209
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: idtree.cpp:17