35 #include <QAbstractItemModel> 40 #include "pqComponentsModule.h" 41 #include "vtkObject.h" 42 #include "vtkSmartPointer.h" 47 class PQCOMPONENTS_EXPORT
pqSILModel :
public QAbstractItemModel
50 typedef QAbstractItemModel Superclass;
57 virtual int rowCount(
const QModelIndex &parent=QModelIndex())
const;
69 virtual int columnCount(
const QModelIndex &parent=QModelIndex())
const;
76 virtual bool hasChildren(
const QModelIndex &parent=QModelIndex())
const;
85 virtual QModelIndex index(
int row,
int column,
86 const QModelIndex &parent=QModelIndex())
const;
93 virtual QModelIndex parent(
const QModelIndex &index)
const;
101 virtual QVariant data(
const QModelIndex &index,
102 int role=Qt::DisplayRole)
const;
112 virtual Qt::ItemFlags flags(
const QModelIndex &index)
const;
117 bool setData(
const QModelIndex &index,
const QVariant& value,
118 int role = Qt::EditRole);
124 QModelIndex hierarchyIndex(
const QString& hierarchyName)
const;
126 virtual QVariant
headerData (
int, Qt::Orientation,
int role = Qt::DisplayRole )
const 128 if (role == Qt::DisplayRole)
136 QList<QVariant> status(
const QString& hierarchyName)
const;
137 void setStatus(
const QString& hierarchyName,
const QList<QVariant>& values);
140 QModelIndex makeIndex(vtkIdType vertexid)
const;
144 vtkIdType findVertex(
const char* name)
const;
147 void checkStatusChanged();
151 void update(vtkGraph* sil);
156 void checkStateUpdated(vtkObject* caller,
157 unsigned long eventid,
void* calldata);
160 bool isLeaf(vtkIdType vertexid)
const;
164 vtkIdType parent(vtkIdType vertexid)
const;
167 int childrenCount(vtkIdType vertexid)
const;
171 void collectLeaves(vtkIdType vertexid, std::set<vtkIdType>& list);
183 vtkSmartPointer<vtkGraph>
SIL;
QMap< vtkIdType, QModelIndex > * ModelIndexCache
Cache used by makeIndex() to avoid iterating over the edges each time.
vtkSmartPointer< vtkGraph > SIL
QMap< QString, std::set< vtkIdType > > HierarchyVertexIds
This map keeps a list of vertex ids that refer to the leaves in the hierarchy.
QMap< QString, QModelIndex > Hierarchies
virtual QVariant headerData(int, Qt::Orientation, int role=Qt::DisplayRole) const