Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkPropertyItemModel Class Reference

A tree model that exposes the properties of a mitk::PropertyList. More...

#include <QmitkPropertyItemModel.h>

Inheritance diagram for QmitkPropertyItemModel:
Collaboration diagram for QmitkPropertyItemModel:

Public Member Functions

 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QmitkPropertyItemModel()

QmitkPropertyItemModel::QmitkPropertyItemModel ( QObject *  parent = nullptr)
explicit

Constructs the property item model.

Parameters
[in]parentOptional parent QObject.

◆ ~QmitkPropertyItemModel()

QmitkPropertyItemModel::~QmitkPropertyItemModel ( )
override

Member Function Documentation

◆ columnCount()

int QmitkPropertyItemModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Returns the number of columns (always 2: name and value).

Parameters
[in]parentThe 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]indexThe model index.
[in]roleThe 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]indexThe model index.
Returns
The item flags.

◆ GetPropertyList()

mitk::PropertyList* QmitkPropertyItemModel::GetPropertyList ( ) const

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]sectionThe section (0 = "Property", 1 = "Value").
[in]orientationThe orientation.
[in]roleThe 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]rowThe row number.
[in]columnThe column number.
[in]parentThe 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]childThe 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]parentThe 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]indexThe model index (must be in the value column).
[in]valueThe new value.
[in]roleThe 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]propertyListThe property list to display.
[in]classNameOptional 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: