Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkPropertiesTableModel Class Reference

Header guard. More...

#include <QmitkPropertiesTableModel.h>

Inheritance diagram for QmitkPropertiesTableModel:
Collaboration diagram for QmitkPropertiesTableModel:

Classes

struct  PropertyDataSetCompareFunction
 A struct that inherits from std::binary_function. You can use it 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

Header guard.

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

See also
QmitkPropertyDelegate

Definition at line 36 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 46 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.

Definition at line 30 of file QmitkPropertiesTableModel.cpp.

References SetPropertyList().

◆ ~QmitkPropertiesTableModel()

QmitkPropertiesTableModel::~QmitkPropertiesTableModel ( )
override

Standard dtor. Nothing to do here.

Definition at line 40 of file QmitkPropertiesTableModel.cpp.

References SetPropertyList().

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.

Definition at line 400 of file QmitkPropertiesTableModel.cpp.

References m_PropertyDeleteObserverTags, m_PropertyModifiedObserverTags, m_SelectedProperties, PropertyDelete(), and PropertyModified().

Referenced by Reset().

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

Definition at line 183 of file QmitkPropertiesTableModel.cpp.

◆ 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, ...)

Definition at line 93 of file QmitkPropertiesTableModel.cpp.

References mitk::BaseProperty::GetValueAsString(), m_SelectedProperties, PROPERTY_NAME_COLUMN, and PROPERTY_VALUE_COLUMN.

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

Definition at line 376 of file QmitkPropertiesTableModel.cpp.

References m_SelectedProperties.

Referenced by PropertyDelete(), and PropertyModified().

◆ 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, ...)

Definition at line 52 of file QmitkPropertiesTableModel.cpp.

References PROPERTY_VALUE_COLUMN.

◆ GetPropertyList()

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

Returns the property list of this table model.

Definition at line 47 of file QmitkPropertiesTableModel.cpp.

References mitk::WeakPointer< T >::Lock(), and m_PropertyList.

◆ 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, ...)

Definition at line 70 of file QmitkPropertiesTableModel.cpp.

References PROPERTY_NAME_COLUMN, and PROPERTY_VALUE_COLUMN.

◆ PropertyDelete()

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.

Definition at line 235 of file QmitkPropertiesTableModel.cpp.

References FindProperty(), m_BlockEvents, and Reset().

Referenced by AddSelectedProperty().

◆ PropertyListDelete()

void QmitkPropertiesTableModel::PropertyListDelete ( )
virtual

Gets called when the list is about to be deleted.

Definition at line 211 of file QmitkPropertiesTableModel.cpp.

References m_BlockEvents, and Reset().

Referenced by SetPropertyList().

◆ PropertyModified()

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.

Definition at line 221 of file QmitkPropertiesTableModel.cpp.

References FindProperty(), and m_BlockEvents.

Referenced by AddSelectedProperty().

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

Definition at line 420 of file QmitkPropertiesTableModel.cpp.

References m_PropertyDeleteObserverTags, m_PropertyModifiedObserverTags, and m_SelectedProperties.

Referenced by Reset().

◆ Reset()

void QmitkPropertiesTableModel::Reset ( void  )
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.

Definition at line 434 of file QmitkPropertiesTableModel.cpp.

References AddSelectedProperty(), mitk::WeakPointer< T >::IsExpired(), mitk::WeakPointer< T >::Lock(), m_FilterKeyWord, m_PropertyList, m_SelectedProperties, m_SortDescending, RemoveSelectedProperty(), and sort().

Referenced by PropertyDelete(), PropertyListDelete(), SetFilterPropertiesKeyWord(), and SetPropertyList().

◆ 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, ...)

Definition at line 177 of file QmitkPropertiesTableModel.cpp.

References m_SelectedProperties.

◆ setData()

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

◆ SetFilterPropertiesKeyWord()

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

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

Definition at line 484 of file QmitkPropertiesTableModel.cpp.

References m_FilterKeyWord, and Reset().

Referenced by QmitkPropertiesTableEditor::PropertyFilterKeyWordTextChanged().

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

Definition at line 189 of file QmitkPropertiesTableModel.cpp.

References mitk::WeakPointer< T >::IsExpired(), mitk::WeakPointer< T >::Lock(), m_PropertyList, m_PropertyListDeleteObserverTag, PropertyListDelete(), and Reset().

Referenced by QmitkPropertiesTableModel(), QmitkPropertiesTableEditor::SetPropertyList(), and ~QmitkPropertiesTableModel().

◆ sort()

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

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 236 of file QmitkPropertiesTableModel.h.

Referenced by PropertyDelete(), PropertyListDelete(), PropertyModified(), and setData().

◆ 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 246 of file QmitkPropertiesTableModel.h.

Referenced by Reset(), and SetFilterPropertiesKeyWord().

◆ 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 228 of file QmitkPropertiesTableModel.h.

Referenced by AddSelectedProperty(), and RemoveSelectedProperty().

◆ 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 214 of file QmitkPropertiesTableModel.h.

Referenced by GetPropertyList(), Reset(), setData(), and SetPropertyList().

◆ m_PropertyListDeleteObserverTag

unsigned long QmitkPropertiesTableModel::m_PropertyListDeleteObserverTag
protected

Definition at line 230 of file QmitkPropertiesTableModel.h.

Referenced by SetPropertyList().

◆ 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 223 of file QmitkPropertiesTableModel.h.

Referenced by AddSelectedProperty(), and RemoveSelectedProperty().

◆ m_SelectedProperties

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

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

Definition at line 218 of file QmitkPropertiesTableModel.h.

Referenced by AddSelectedProperty(), data(), FindProperty(), RemoveSelectedProperty(), Reset(), rowCount(), setData(), and sort().

◆ m_SortDescending

bool QmitkPropertiesTableModel::m_SortDescending
protected

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

Definition at line 241 of file QmitkPropertiesTableModel.h.

Referenced by Reset(), and sort().

◆ PROPERTY_NAME_COLUMN

const int QmitkPropertiesTableModel::PROPERTY_NAME_COLUMN
static

Definition at line 40 of file QmitkPropertiesTableModel.h.

Referenced by data(), and headerData().

◆ PROPERTY_VALUE_COLUMN

const int QmitkPropertiesTableModel::PROPERTY_VALUE_COLUMN
static

Definition at line 41 of file QmitkPropertiesTableModel.h.

Referenced by data(), flags(), headerData(), setData(), and sort().


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