Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
QmitkPropertiesTableModel Class Reference

A table model for showing and editing mitk::Properties. More...

#include <QmitkPropertiesTableModel.h>

Inheritance diagram for QmitkPropertiesTableModel:
Collaboration diagram for QmitkPropertiesTableModel:

Classes

struct  PropertyDataSetCompareFunction
 A struct that you can use in std::sort algorithm for sorting the property list elements. More...
 
struct  PropertyListElementFilterFunction
 

Public Types

typedef std::pair< std::string, mitk::BaseProperty::PointerPropertyDataSet
 

Public Member Functions

 QmitkPropertiesTableModel (QObject *parent=nullptr, mitk::PropertyList::Pointer _PropertyList=nullptr)
 
 ~QmitkPropertiesTableModel () override
 Standard dtor. Nothing to do here. More...
 
mitk::PropertyList::Pointer GetPropertyList () const
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) More...
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) More...
 
int columnCount (const QModelIndex &parent) const override
 
void SetPropertyList (mitk::PropertyList *_PropertyList)
 
virtual void PropertyListDelete ()
 Gets called when the list is about to be deleted. More...
 
virtual void PropertyModified (const itk::Object *caller, const itk::EventObject &event)
 Called when a single property was changed. Send a model changed event to the Qt-outer world. More...
 
virtual void PropertyDelete (const itk::Object *caller, const itk::EventObject &event)
 Called when a single property was changed. Send a model changed event to the Qt-outer world. More...
 
virtual void SetFilterPropertiesKeyWord (std::string _FilterKeyWord)
 Set a keyword for filtering of properties. Only properties beginning with this string will be shown. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
void sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override
 Reimplemented sort function from QAbstractTableModel to enable sorting on the table. More...
 

Static Public Attributes

static const int PROPERTY_NAME_COLUMN
 
static const int PROPERTY_VALUE_COLUMN
 

Protected Member Functions

int FindProperty (const mitk::BaseProperty *_Property) const
 Searches for the specified property and returns the row of the element in this QTableModel. If any errors occur, the function returns -1. More...
 
void AddSelectedProperty (PropertyDataSet &_PropertyDataSet)
 
void RemoveSelectedProperty (unsigned int _Index)
 
void Reset ()
 

Protected Attributes

mitk::WeakPointer< mitk::PropertyListm_PropertyList
 
std::vector< PropertyDataSetm_SelectedProperties
 Store the properties in a vector so that they may be sorted. More...
 
std::vector< unsigned long > m_PropertyModifiedObserverTags
 Holds all tags of Modified Event Listeners. We need it to remove them again. More...
 
std::vector< unsigned long > m_PropertyDeleteObserverTags
 Holds all tags of Modified Event Listeners. We need it to remove them again. More...
 
unsigned long m_PropertyListDeleteObserverTag
 
bool m_BlockEvents
 Indicates if this class should neglect all incoming events because the class itself triggered the event (e.g. when a property was edited). More...
 
bool m_SortDescending
 The property is true when the property list is sorted in descending order. More...
 
std::string m_FilterKeyWord
 If set to any value, only properties containing the specified keyword in their name will be shown. More...
 

Detailed Description

A table model for showing and editing mitk::Properties.

See also
QmitkPropertyDelegate

Definition at line 31 of file QmitkPropertiesTableModel.h.

Member Typedef Documentation

◆ PropertyDataSet

Typedef for the complete Property Datastructure, which may be written as follows: Name->(mitk::BaseProperty::Pointer)

Definition at line 40 of file QmitkPropertiesTableModel.h.

Constructor & Destructor Documentation

◆ QmitkPropertiesTableModel()

QmitkPropertiesTableModel::QmitkPropertiesTableModel ( QObject *  parent = nullptr,
mitk::PropertyList::Pointer  _PropertyList = nullptr 
)

Constructs a new QmitkDataStorageTableModel and sets the DataNode for this TableModel.

◆ ~QmitkPropertiesTableModel()

QmitkPropertiesTableModel::~QmitkPropertiesTableModel ( )
override

Standard dtor. Nothing to do here.

Member Function Documentation

◆ AddSelectedProperty()

void QmitkPropertiesTableModel::AddSelectedProperty ( PropertyDataSet _PropertyDataSet)
protected

Adds a property dataset to the current selection. When a property is added a modified and delete listener is appended.

◆ columnCount()

int QmitkPropertiesTableModel::columnCount ( const QModelIndex &  parent) const
override

Overwritten from QAbstractTableModel. Returns the number of columns. That is usually two in this model: the properties name and its value.

◆ data()

QVariant QmitkPropertiesTableModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)

◆ FindProperty()

int QmitkPropertiesTableModel::FindProperty ( const mitk::BaseProperty _Property) const
protected

Searches for the specified property and returns the row of the element in this QTableModel. If any errors occur, the function returns -1.

◆ flags()

Qt::ItemFlags QmitkPropertiesTableModel::flags ( const QModelIndex &  index) const
override

Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)

◆ GetPropertyList()

mitk::PropertyList::Pointer QmitkPropertiesTableModel::GetPropertyList ( ) const

Returns the property list of this table model.

◆ headerData()

QVariant QmitkPropertiesTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)

◆ PropertyDelete()

virtual void QmitkPropertiesTableModel::PropertyDelete ( const itk::Object *  caller,
const itk::EventObject &  event 
)
virtual

Called when a single property was changed. Send a model changed event to the Qt-outer world.

◆ PropertyListDelete()

virtual void QmitkPropertiesTableModel::PropertyListDelete ( )
virtual

Gets called when the list is about to be deleted.

◆ PropertyModified()

virtual void QmitkPropertiesTableModel::PropertyModified ( const itk::Object *  caller,
const itk::EventObject &  event 
)
virtual

Called when a single property was changed. Send a model changed event to the Qt-outer world.

◆ RemoveSelectedProperty()

void QmitkPropertiesTableModel::RemoveSelectedProperty ( unsigned int  _Index)
protected

Removes a property dataset from the current selection. When a property is removed the modified and delete listener are also removed.

◆ Reset()

void QmitkPropertiesTableModel::Reset ( )
protected

Reset is called when a new filter keyword is set or a new PropertyList is set. First of all, all priorly selected properties are removed. Then all properties to be selected (specified by the keyword) are added to the selection.

◆ rowCount()

int QmitkPropertiesTableModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)

◆ setData()

bool QmitkPropertiesTableModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
override

Overridden from QAbstractTableModel. Sets data at index for given role.

◆ SetFilterPropertiesKeyWord()

virtual void QmitkPropertiesTableModel::SetFilterPropertiesKeyWord ( std::string  _FilterKeyWord)
virtual

Set a keyword for filtering of properties. Only properties beginning with this string will be shown.

◆ SetPropertyList()

void QmitkPropertiesTableModel::SetPropertyList ( mitk::PropertyList _PropertyList)

Sets the Property List to show. Resets the whole model. If _PropertyList is nullptr the model is empty.

◆ sort()

void QmitkPropertiesTableModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)
override

Reimplemented sort function from QAbstractTableModel to enable sorting on the table.

Member Data Documentation

◆ m_BlockEvents

bool QmitkPropertiesTableModel::m_BlockEvents
protected

Indicates if this class should neglect all incoming events because the class itself triggered the event (e.g. when a property was edited).

Definition at line 220 of file QmitkPropertiesTableModel.h.

◆ m_FilterKeyWord

std::string QmitkPropertiesTableModel::m_FilterKeyWord
protected

If set to any value, only properties containing the specified keyword in their name will be shown.

Definition at line 230 of file QmitkPropertiesTableModel.h.

◆ m_PropertyDeleteObserverTags

std::vector<unsigned long> QmitkPropertiesTableModel::m_PropertyDeleteObserverTags
protected

Holds all tags of Modified Event Listeners. We need it to remove them again.

Definition at line 212 of file QmitkPropertiesTableModel.h.

◆ m_PropertyList

mitk::WeakPointer<mitk::PropertyList> QmitkPropertiesTableModel::m_PropertyList
protected

Holds the pointer to the properties list. Dont use smart pointers here. Instead: Listen to the delete event.

Definition at line 198 of file QmitkPropertiesTableModel.h.

◆ m_PropertyListDeleteObserverTag

unsigned long QmitkPropertiesTableModel::m_PropertyListDeleteObserverTag
protected

Definition at line 214 of file QmitkPropertiesTableModel.h.

◆ m_PropertyModifiedObserverTags

std::vector<unsigned long> QmitkPropertiesTableModel::m_PropertyModifiedObserverTags
protected

Holds all tags of Modified Event Listeners. We need it to remove them again.

Definition at line 207 of file QmitkPropertiesTableModel.h.

◆ m_SelectedProperties

std::vector<PropertyDataSet> QmitkPropertiesTableModel::m_SelectedProperties
protected

Store the properties in a vector so that they may be sorted.

Definition at line 202 of file QmitkPropertiesTableModel.h.

◆ m_SortDescending

bool QmitkPropertiesTableModel::m_SortDescending
protected

The property is true when the property list is sorted in descending order.

Definition at line 225 of file QmitkPropertiesTableModel.h.

◆ PROPERTY_NAME_COLUMN

const int QmitkPropertiesTableModel::PROPERTY_NAME_COLUMN
static

Definition at line 34 of file QmitkPropertiesTableModel.h.

◆ PROPERTY_VALUE_COLUMN

const int QmitkPropertiesTableModel::PROPERTY_VALUE_COLUMN
static

Definition at line 35 of file QmitkPropertiesTableModel.h.


The documentation for this class was generated from the following file: