VR CAD Viewer 1.0
Qt and VTK application for loading and visualising CAD models with VR support
Loading...
Searching...
No Matches
ModelPartList Class Reference

Model class used by Qt to display ModelPart objects in a tree view. More...

#include <ModelPartList.h>

Inheritance diagram for ModelPartList:
Collaboration diagram for ModelPartList:

Public Member Functions

 ModelPartList (const QString &data, QObject *parent=NULL)
 Constructor.
 
 ~ModelPartList ()
 Destructor.
 
int columnCount (const QModelIndex &parent) const
 Returns number of columns in the model.
 
QVariant data (const QModelIndex &index, int role) const
 Returns data for a given index and role.
 
Qt::ItemFlags flags (const QModelIndex &index) const
 Returns flags for an item.
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 Returns header data for the model.
 
QModelIndex index (int row, int column, const QModelIndex &parent) const
 Creates an index for a given row and column.
 
QModelIndex parent (const QModelIndex &index) const
 Returns parent index of a given item.
 
int rowCount (const QModelIndex &parent) const
 Returns number of child rows under a parent.
 
ModelPartgetRootItem ()
 Returns pointer to root item.
 
QModelIndex appendChild (QModelIndex &parent, const QList< QVariant > &data)
 Adds a child item to the tree.
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 Removes rows from the model.
 

Detailed Description

Model class used by Qt to display ModelPart objects in a tree view.

Implements QAbstractItemModel to provide hierarchical data for the GUI.

Constructor & Destructor Documentation

◆ ModelPartList()

ModelPartList::ModelPartList ( const QString &  data,
QObject *  parent = NULL 
)

Constructor.

< A special Qt tag used to indicate that this is a special Qt class that might require preprocessing before compiling.

Parameters
dataInitial data (not heavily used)
parentParent QObject

Member Function Documentation

◆ appendChild()

QModelIndex ModelPartList::appendChild ( QModelIndex &  parent,
const QList< QVariant > &  data 
)

Adds a child item to the tree.

Parameters
parentParent index
dataData for new child
Returns
QModelIndex of new item
Here is the call graph for this function:
Here is the caller graph for this function:

◆ columnCount()

int ModelPartList::columnCount ( const QModelIndex &  parent) const

Returns number of columns in the model.

Parameters
parentParent index (unused)
Returns
Number of columns (e.g. Part, Visible)
Here is the call graph for this function:

◆ data()

QVariant ModelPartList::data ( const QModelIndex &  index,
int  role 
) const

Returns data for a given index and role.

Parameters
indexSpecifies row and column
roleSpecifies how data is used (display/edit)
Returns
Data value as QVariant
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flags()

Qt::ItemFlags ModelPartList::flags ( const QModelIndex &  index) const

Returns flags for an item.

Parameters
indexItem index
Returns
Qt item flags (e.g. selectable, editable)
Here is the call graph for this function:

◆ getRootItem()

ModelPart * ModelPartList::getRootItem ( )

Returns pointer to root item.

Returns
Root ModelPart pointer

◆ headerData()

QVariant ModelPartList::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Returns header data for the model.

Parameters
sectionColumn index
orientationHorizontal/vertical
roleData role
Returns
Header text
Here is the call graph for this function:

◆ index()

QModelIndex ModelPartList::index ( int  row,
int  column,
const QModelIndex &  parent 
) const

Creates an index for a given row and column.

Parameters
rowRow index
columnColumn index
parentParent index
Returns
QModelIndex for the item
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parent()

QModelIndex ModelPartList::parent ( const QModelIndex &  index) const

Returns parent index of a given item.

Parameters
indexChild index
Returns
Parent QModelIndex
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeRows()

bool ModelPartList::removeRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
override

Removes rows from the model.

‍** Remove a child item from the tree

Parameters
rowStarting row
countNumber of rows to remove
parentParent index
Returns
True if removal successful
Here is the call graph for this function:

◆ rowCount()

int ModelPartList::rowCount ( const QModelIndex &  parent) const

Returns number of child rows under a parent.

Parameters
parentParent index
Returns
Number of child items
Here is the call graph for this function:

The documentation for this class was generated from the following files: