#include "ModelPartList.h"
◆ 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
-
data | is not used |
parent | is used by the parent class constructor |
◆ ~ModelPartList()
ModelPartList::~ModelPartList |
( |
| ) |
|
Destructor Frees root item allocated in constructor
◆ appendChild()
QModelIndex ModelPartList::appendChild |
( |
QModelIndex & |
parent, |
|
|
const QList< QVariant > & |
data |
|
) |
| |
◆ columnCount()
int ModelPartList::columnCount |
( |
const QModelIndex & |
parent | ) |
const |
Return column count
- Parameters
-
- Returns
- number of columns in the tree view - "Part" and "Visible", i.e. 2 in this case
◆ 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
-
index | in a stucture Qt uses to specify the row and column it wants data for |
role | is 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
◆ flags()
Qt::ItemFlags ModelPartList::flags |
( |
const QModelIndex & |
index | ) |
const |
Standard function used by Qt internally.
- Parameters
-
index | in a stucture Qt uses to specify the row and column it wants data for |
- Returns
- a Qt item flags
◆ getRootItem()
Get a pointer to the root item of the tree
- Returns
- the root item pointer
◆ headerData()
QVariant ModelPartList::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role |
|
) |
| const |
Standard function used by Qt internally.
◆ 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
-
row | is the item index |
column | is 0 or 1 - part name or visible stringstream |
parent | where the row is referenced from, usually the tree root |
- Returns
- the QModelIndex structure
◆ parent()
QModelIndex ModelPartList::parent |
( |
const QModelIndex & |
index | ) |
const |
Take a QModelIndex for an item, get a QModel Index for its parent
- Parameters
-
- Returns
- index of parent
◆ rowCount()
int ModelPartList::rowCount |
( |
const QModelIndex & |
parent | ) |
const |
Get number of rows (items) under an item in tree
- Parameters
-
is | the parent, all items under this will be counted |
- Returns
- number of children
◆ rootItem
This is a pointer to the item at the base of the tree
The documentation for this class was generated from the following files: