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;
67 virtual int rowCount(
const QModelIndex& parent = QModelIndex())
const;
76 virtual int columnCount(
const QModelIndex& parent = QModelIndex())
const;
85 virtual bool hasChildren(
const QModelIndex& parent = QModelIndex())
const;
96 virtual QModelIndex index(
int row,
int column,
const QModelIndex& parent = QModelIndex())
const;
105 virtual QModelIndex parent(
const QModelIndex& index)
const;
115 virtual QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const;
127 virtual Qt::ItemFlags flags(
const QModelIndex& index)
const;
134 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole);
142 QModelIndex hierarchyIndex(
const QString& hierarchyName)
const;
144 virtual QVariant
headerData(
int, Qt::Orientation,
int role = Qt::DisplayRole)
const 146 if (role == Qt::DisplayRole)
156 QList<QVariant> status(
const QString& hierarchyName)
const;
157 void setStatus(
const QString& hierarchyName,
const QList<QVariant>& values);
162 QModelIndex makeIndex(vtkIdType vertexid)
const;
168 vtkIdType findVertex(
const char* name)
const;
171 void checkStatusChanged();
177 void update(vtkGraph* sil);
184 void checkStateUpdated(vtkObject* caller,
unsigned long eventid,
void* calldata);
189 bool isLeaf(vtkIdType vertexid)
const;
195 vtkIdType parent(vtkIdType vertexid)
const;
200 int childrenCount(vtkIdType vertexid)
const;
206 void collectLeaves(vtkIdType vertexid, std::set<vtkIdType>& list);
222 vtkSmartPointer<vtkGraph>
SIL;
QMap< vtkIdType, QModelIndex > * ModelIndexCache
Cache used by makeIndex() to avoid iterating over the edges each time.
vtkSmartPointer< vtkGraph > SIL
is a helper for to work with SILs.
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