VR CAD Viewer 1.0
Qt and VTK application for loading and visualising CAD models with VR support
Loading...
Searching...
No Matches
ModelPartList.h
Go to the documentation of this file.
1
10#ifndef VIEWER_MODELPARTLIST_H
11#define VIEWER_MODELPARTLIST_H
12
13
14#include "ModelPart.h"
15
16#include <QAbstractItemModel>
17#include <QModelIndex>
18#include <QVariant>
19#include <QString>
20#include <QList>
21
22class ModelPart;
23
24
30class ModelPartList : public QAbstractItemModel {
31 Q_OBJECT
33public:
34
40 ModelPartList( const QString& data, QObject* parent = NULL );
41
46
52 int columnCount( const QModelIndex& parent ) const;
53
60 QVariant data( const QModelIndex& index, int role ) const;
61
67 Qt::ItemFlags flags( const QModelIndex& index ) const;
68
69
77 QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
78
79
87 QModelIndex index( int row, int column, const QModelIndex& parent ) const;
88
89
95 QModelIndex parent( const QModelIndex& index ) const;
96
102 int rowCount( const QModelIndex& parent ) const;
103
109
116 QModelIndex appendChild( QModelIndex& parent, const QList<QVariant>& data );
117
118
126 bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
127
128
129private:
130
132 ModelPart *rootItem;
133};
134#endif
135
Defines the ModelPart class used to represent CAD model parts in the tree view and VTK renderer.
Model class used by Qt to display ModelPart objects in a tree view.
Definition ModelPartList.h:30
int rowCount(const QModelIndex &parent) const
Returns number of child rows under a parent.
Definition ModelPartList.cpp:110
ModelPart * getRootItem()
Returns pointer to root item.
Definition ModelPartList.cpp:124
QModelIndex parent(const QModelIndex &index) const
Returns parent index of a given item.
Definition ModelPartList.cpp:96
int columnCount(const QModelIndex &parent) const
Returns number of columns in the model.
Definition ModelPartList.cpp:27
QModelIndex index(int row, int column, const QModelIndex &parent) const
Creates an index for a given row and column.
Definition ModelPartList.cpp:79
QVariant data(const QModelIndex &index, int role) const
Returns data for a given index and role.
Definition ModelPartList.cpp:34
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Returns header data for the model.
Definition ModelPartList.cpp:71
~ModelPartList()
Destructor.
Definition ModelPartList.cpp:22
Qt::ItemFlags flags(const QModelIndex &index) const
Returns flags for an item.
Definition ModelPartList.cpp:63
QModelIndex appendChild(QModelIndex &parent, const QList< QVariant > &data)
Adds a child item to the tree.
Definition ModelPartList.cpp:130
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Removes rows from the model.
Definition ModelPartList.cpp:161
Represents one CAD model part in the application.
Definition ModelPart.h:30