CAD Viewer
Public Member Functions | Private Attributes | List of all members
ModelPartList Class Reference

#include "ModelPartList.h"

Inheritance diagram for ModelPartList:
Inheritance graph
[legend]
Collaboration diagram for ModelPartList:
Collaboration graph
[legend]

Public Member Functions

 ModelPartList (const QString &data, QObject *parent=NULL)
 
 ~ModelPartList ()
 
int columnCount (const QModelIndex &parent) const
 
QVariant data (const QModelIndex &index, int role) const
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
QModelIndex index (int row, int column, const QModelIndex &parent) const
 
QModelIndex parent (const QModelIndex &index) const
 
int rowCount (const QModelIndex &parent) const
 
ModelPartgetRootItem ()
 
QModelIndex appendChild (QModelIndex &parent, const QList< QVariant > &data)
 

Private Attributes

ModelPartrootItem
 

Constructor & Destructor Documentation

◆ ModelPartList()

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

< A special Qt tag used to indicate that this is a special Qt class that might require preprocessing before compiling. Constructor Arguments are standard arguments for this type of class but are not used in this example.

Parameters
datais not used
parentis used by the parent class constructor

◆ ~ModelPartList()

ModelPartList::~ModelPartList ( )

Destructor Frees root item allocated in constructor

Member Function Documentation

◆ appendChild()

QModelIndex ModelPartList::appendChild ( QModelIndex &  parent,
const QList< QVariant > &  data 
)
Here is the call graph for this function:

◆ columnCount()

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

Return column count

Parameters
parentis not used
Returns
number of columns in the tree view - "Part" and "Visible", i.e. 2 in this case
Here is the call graph for this function:

◆ data()

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

This returns the value of a particular row (i.e. the item index) and columns (i.e. either the "Part" or "Visible" property). It is used by QT internally - this is how Qt retrieves the text to display in the TreeView

Parameters
indexin a stucture Qt uses to specify the row and column it wants data for
roleis how Qt specifies what it wants to do with the data
Returns
a QVariant which is a generic variable used to represent any Qt class type, in this case the QVariant will be a string
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

Standard function used by Qt internally.

Parameters
indexin a stucture Qt uses to specify the row and column it wants data for
Returns
a Qt item flags
Here is the call graph for this function:

◆ getRootItem()

ModelPart * ModelPartList::getRootItem ( )

Get a pointer to the root item of the tree

Returns
the root item pointer
Here is the caller graph for this function:

◆ headerData()

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

Standard function used by Qt internally.

Here is the call graph for this function:

◆ index()

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

Get a valid QModelIndex for a location in the tree (row is the row in the tree under "parent" or under the root of the tree if parent isnt specified. Column is either 0 = "Part" or 1 = "Visible" in this example

Parameters
rowis the item index
columnis 0 or 1 - part name or visible stringstream
parentwhere the row is referenced from, usually the tree root
Returns
the QModelIndex structure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parent()

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

Take a QModelIndex for an item, get a QModel Index for its parent

Parameters
indexof item
Returns
index of parent
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowCount()

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

Get number of rows (items) under an item in tree

Parameters
isthe parent, all items under this will be counted
Returns
number of children
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ rootItem

ModelPart* ModelPartList::rootItem
private

This is a pointer to the item at the base of the tree


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