A tree model that exposes the properties of a mitk::PropertyList.
More...
#include <QmitkPropertyItemModel.h>
|
| | QmitkPropertyItemModel (QObject *parent=nullptr) |
| | Constructs the property item model. More...
|
| |
| | ~QmitkPropertyItemModel () override |
| |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| | Returns the number of columns (always 2: name and value). More...
|
| |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| | Returns data for the given index and role. More...
|
| |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| | Returns item flags. The value column is editable for leaf items. More...
|
| |
| mitk::PropertyList * | GetPropertyList () const |
| | Returns the currently associated property list. More...
|
| |
| QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
| | Returns header data for the given section. More...
|
| |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| | Returns the model index for the given row and column. More...
|
| |
| QModelIndex | parent (const QModelIndex &child) const override |
| | Returns the parent index for the given child index. More...
|
| |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| | Returns the number of rows (child properties) under the given parent. More...
|
| |
| bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
| | Sets the property value at the given index. More...
|
| |
| void | SetPropertyList (mitk::PropertyList *propertyList, const QString &className="") |
| | Sets the property list and optional class name for filtering. More...
|
| |
| void | Update () |
| | Forces a complete rebuild of the model from the current property list. More...
|
| |
A tree model that exposes the properties of a mitk::PropertyList.
This model builds a two-column tree (property name and value) from a mitk::PropertyList. Property names containing dots are automatically grouped into a tree hierarchy. The model supports editing via QmitkPropertyItemDelegate, filters properties based on the configured class name via mitk::IPropertyFilters, and resolves property aliases via mitk::IPropertyAliases.
- See also
- QmitkPropertyItemDelegate
-
QmitkPropertyItem
-
QmitkPropertiesTableEditor
Definition at line 51 of file QmitkPropertyItemModel.h.
◆ QmitkPropertyItemModel()
| QmitkPropertyItemModel::QmitkPropertyItemModel |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
Constructs the property item model.
- Parameters
-
| [in] | parent | Optional parent QObject. |
◆ ~QmitkPropertyItemModel()
| QmitkPropertyItemModel::~QmitkPropertyItemModel |
( |
| ) |
|
|
override |
◆ columnCount()
| int QmitkPropertyItemModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of columns (always 2: name and value).
- Parameters
-
| [in] | parent | The parent index. |
- Returns
- 2.
◆ data()
| QVariant QmitkPropertyItemModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
override |
Returns data for the given index and role.
- Parameters
-
| [in] | index | The model index. |
| [in] | role | The data role (Qt::DisplayRole, Qt::EditRole, mitk::PropertyRole, etc.). |
- Returns
- The data as QVariant.
◆ flags()
| Qt::ItemFlags QmitkPropertyItemModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
override |
Returns item flags. The value column is editable for leaf items.
- Parameters
-
| [in] | index | The model index. |
- Returns
- The item flags.
◆ GetPropertyList()
Returns the currently associated property list.
- Returns
- Pointer to the property list, or nullptr.
◆ headerData()
| QVariant QmitkPropertyItemModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role |
|
) |
| const |
|
override |
Returns header data for the given section.
- Parameters
-
| [in] | section | The section (0 = "Property", 1 = "Value"). |
| [in] | orientation | The orientation. |
| [in] | role | The data role. |
- Returns
- The header data as QVariant.
◆ index()
| QModelIndex QmitkPropertyItemModel::index |
( |
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent = QModelIndex() |
|
) |
| const |
|
override |
Returns the model index for the given row and column.
- Parameters
-
| [in] | row | The row number. |
| [in] | column | The column number. |
| [in] | parent | The parent index. |
- Returns
- The model index.
◆ parent()
| QModelIndex QmitkPropertyItemModel::parent |
( |
const QModelIndex & |
child | ) |
const |
|
override |
Returns the parent index for the given child index.
- Parameters
-
| [in] | child | The child index. |
- Returns
- The parent index.
◆ rowCount()
| int QmitkPropertyItemModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of rows (child properties) under the given parent.
- Parameters
-
| [in] | parent | The parent index. |
- Returns
- The row count.
◆ setData()
| bool QmitkPropertyItemModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
override |
Sets the property value at the given index.
- Parameters
-
| [in] | index | The model index (must be in the value column). |
| [in] | value | The new value. |
| [in] | role | The data role (must be Qt::EditRole). |
- Returns
- True if the value was set successfully.
◆ SetPropertyList()
| void QmitkPropertyItemModel::SetPropertyList |
( |
mitk::PropertyList * |
propertyList, |
|
|
const QString & |
className = "" |
|
) |
| |
Sets the property list and optional class name for filtering.
- Parameters
-
| [in] | propertyList | The property list to display. |
| [in] | className | Optional class name used for property filtering and alias resolution. |
◆ Update()
| void QmitkPropertyItemModel::Update |
( |
| ) |
|
Forces a complete rebuild of the model from the current property list.
The documentation for this class was generated from the following file: