Model class used by Qt to display ModelPart objects in a tree view.
More...
#include <ModelPartList.h>
|
| | 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.
|
| |
| ModelPart * | getRootItem () |
| | 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.
|
| |
Model class used by Qt to display ModelPart objects in a tree view.
Implements QAbstractItemModel to provide hierarchical data for the GUI.
◆ 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
-
| data | Initial data (not heavily used) |
| parent | Parent QObject |
◆ appendChild()
| QModelIndex ModelPartList::appendChild |
( |
QModelIndex & |
parent, |
|
|
const QList< QVariant > & |
data |
|
) |
| |
Adds a child item to the tree.
- Parameters
-
| parent | Parent index |
| data | Data for new child |
- Returns
- QModelIndex of new item
◆ columnCount()
| int ModelPartList::columnCount |
( |
const QModelIndex & |
parent | ) |
const |
Returns number of columns in the model.
- Parameters
-
| parent | Parent index (unused) |
- Returns
- Number of columns (e.g. Part, Visible)
◆ data()
| QVariant ModelPartList::data |
( |
const QModelIndex & |
index, |
|
|
int |
role |
|
) |
| const |
Returns data for a given index and role.
- Parameters
-
| index | Specifies row and column |
| role | Specifies how data is used (display/edit) |
- Returns
- Data value as QVariant
◆ flags()
| Qt::ItemFlags ModelPartList::flags |
( |
const QModelIndex & |
index | ) |
const |
Returns flags for an item.
- Parameters
-
- Returns
- Qt item flags (e.g. selectable, editable)
◆ 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
-
| section | Column index |
| orientation | Horizontal/vertical |
| role | Data role |
- Returns
- Header text
◆ index()
| QModelIndex ModelPartList::index |
( |
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent |
|
) |
| const |
Creates an index for a given row and column.
- Parameters
-
| row | Row index |
| column | Column index |
| parent | Parent index |
- Returns
- QModelIndex for the item
◆ parent()
| QModelIndex ModelPartList::parent |
( |
const QModelIndex & |
index | ) |
const |
Returns parent index of a given item.
- Parameters
-
- Returns
- Parent QModelIndex
◆ 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
-
| row | Starting row |
| count | Number of rows to remove |
| parent | Parent index |
- Returns
- True if removal successful
◆ rowCount()
| int ModelPartList::rowCount |
( |
const QModelIndex & |
parent | ) |
const |
Returns number of child rows under a parent.
- Parameters
-
- Returns
- Number of child items
The documentation for this class was generated from the following files: