LabelModel Class Reference
A tree modle for the hierarchical Label structure.
More...
#include <labelmodel.h>
List of all members.
Public Member Functions |
| LabelModel (QObject *parent=0) |
QVariant | data (const QModelIndex &index, int role) const |
Qt::ItemFlags | flags (const QModelIndex &index) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
QModelIndex | parent (const QModelIndex &index) const |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
bool | insertRows (int position, int rows, const QModelIndex &parent=QModelIndex()) |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
bool | removeRows (int position, int rows, const QModelIndex &parent=QModelIndex()) |
Label * | getItem (const QModelIndex &index) const |
Detailed Description
A tree modle for the hierarchical Label structure.
This model is a implementation of the QAbstractItemModel. For more information take a look at the QT documentation.
- Author:
- Manuel Unglaub
Constructor & Destructor Documentation
LabelModel::LabelModel |
( |
QObject * |
parent = 0 |
) |
|
The constructor.
Constructs the LabelModel which is a child of parent.
- Parameters:
-
Member Function Documentation
int LabelModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() |
) |
const |
Get the number of columns for the children of the given parent.
- Parameters:
-
| parent | The number of columns for the children under the given parent. (not used) |
- Returns:
- The number of columns for the children of the given parent. Always 1 because there is only one column.
QVariant LabelModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role | |
|
) |
| | const |
Get the data of a Label specified by an index and a role.
- Parameters:
-
| index | The index of the requested data. |
| role | The role of the requested data. |
- Returns:
- The data stored under the given role for the item referred to by the index.
- See also:
- setData()
Qt::ItemFlags LabelModel::flags |
( |
const QModelIndex & |
index |
) |
const |
Get the item flags for the given index.
- Parameters:
-
| index | The index of the requested flags. |
- Returns:
- If the index is valid a combination of the following flags: Qt::ItemIsEnabled, Qt::ItemIsSelectable.
Label * LabelModel::getItem |
( |
const QModelIndex & |
index |
) |
const |
Get the Label from a specified index.
- Parameters:
-
| index | The index of the requested Label. |
- Returns:
- The Label specified by the given index.
QVariant LabelModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole | |
|
) |
| | const |
Returns the data for the header.
- Parameters:
-
| section | The section of the requested data. |
| orientation | The orientation of the requested data. |
| role | The role of the requested data. |
- Returns:
- The header data.
QModelIndex LabelModel::index |
( |
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent = QModelIndex() | |
|
) |
| | const |
Get a specified index.
- Parameters:
-
| row | The row of the requested index. |
| column | The column of the requested index. |
| parent | The parent of the requested index. |
- Returns:
- The requested index.
bool LabelModel::insertRows |
( |
int |
position, |
|
|
int |
rows, |
|
|
const QModelIndex & |
parent = QModelIndex() | |
|
) |
| | |
Insert rows at a specified position to a given parent.
- Parameters:
-
| position | The position in the list of children of the parent. |
| rows | The number of rows to insert. |
| parent | The parent to insert the rows. |
- Returns:
- True if successfull.
QModelIndex LabelModel::parent |
( |
const QModelIndex & |
index |
) |
const |
Get the parent of a specified index.
- Parameters:
-
| index | The child of the requested index. |
- Returns:
- The parent index of the specified index.
bool LabelModel::removeRows |
( |
int |
position, |
|
|
int |
rows, |
|
|
const QModelIndex & |
parent = QModelIndex() | |
|
) |
| | |
Remove rows at a specified position from a given parent.
- Parameters:
-
| position | The position in th list of children of the parent. |
| rows | The number of rows to remove. |
| parent | The parent to remove the rows from. |
- Returns:
- True if successfull.
- See also:
- insertRows()
int LabelModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() |
) |
const |
Get the number of children of a specified index.
- Parameters:
-
| parent | The index for the request of the number of its children. |
- Returns:
- The number of rows under the given parent.
bool LabelModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole | |
|
) |
| | |
Sets the role data for the item at index to value.
- Parameters:
-
| index | The index of the Label. |
| value | The name of the Label. |
| role | The role the data is for. Only Qt:EditRole will have any effect. |
- Returns:
- True if successfull.
- See also:
- data()
The documentation for this class was generated from the following files: