Medical Imaging Interaction Toolkit  2016.11.0
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)
 
virtual ~QmitkPropertiesTableModel ()
 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 (const itk::Object *_PropertyList)
 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...
 
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 40 of file QmitkPropertiesTableModel.h.

Member Typedef Documentation

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

Definition at line 50 of file QmitkPropertiesTableModel.h.

Constructor & Destructor Documentation

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

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

Definition at line 34 of file QmitkPropertiesTableModel.cpp.

References SetPropertyList().

QmitkPropertiesTableModel::~QmitkPropertiesTableModel ( )
virtual

Standard dtor. Nothing to do here.

Definition at line 44 of file QmitkPropertiesTableModel.cpp.

References SetPropertyList().

Member Function Documentation

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 403 of file QmitkPropertiesTableModel.cpp.

References m_PropertyDeleteObserverTags, m_PropertyModifiedObserverTags, m_SelectedProperties, mitk::New(), PropertyDelete(), and PropertyModified().

Referenced by Reset().

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 187 of file QmitkPropertiesTableModel.cpp.

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 97 of file QmitkPropertiesTableModel.cpp.

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

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 379 of file QmitkPropertiesTableModel.cpp.

References m_SelectedProperties.

Referenced by PropertyDelete(), and PropertyModified().

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 56 of file QmitkPropertiesTableModel.cpp.

References PROPERTY_VALUE_COLUMN.

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

Returns the property list of this table model.

Definition at line 51 of file QmitkPropertiesTableModel.cpp.

References mitk::WeakPointer< TObjectType >::GetPointer(), and m_PropertyList.

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 74 of file QmitkPropertiesTableModel.cpp.

References PROPERTY_NAME_COLUMN, and PROPERTY_VALUE_COLUMN.

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 241 of file QmitkPropertiesTableModel.cpp.

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

Referenced by AddSelectedProperty().

void QmitkPropertiesTableModel::PropertyListDelete ( const itk::Object *  _PropertyList)
virtual

Gets called when the list is about to be deleted.

Definition at line 217 of file QmitkPropertiesTableModel.cpp.

References m_BlockEvents, and Reset().

Referenced by SetPropertyList().

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 227 of file QmitkPropertiesTableModel.cpp.

References FindProperty(), and m_BlockEvents.

Referenced by AddSelectedProperty().

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 423 of file QmitkPropertiesTableModel.cpp.

References m_PropertyDeleteObserverTags, m_PropertyModifiedObserverTags, and m_SelectedProperties.

Referenced by 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 437 of file QmitkPropertiesTableModel.cpp.

References AddSelectedProperty(), mitk::PropertyList::GetMap(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_FilterKeyWord, m_PropertyList, m_SelectedProperties, m_SortDescending, RemoveSelectedProperty(), and sort().

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

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 181 of file QmitkPropertiesTableModel.cpp.

References m_SelectedProperties.

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

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

Definition at line 253 of file QmitkPropertiesTableModel.cpp.

References mitk::RenderingManager::GetInstance(), Json::intValue, m_BlockEvents, m_PropertyList, m_SelectedProperties, PROPERTY_VALUE_COLUMN, and mitk::RenderingManager::RequestUpdateAll().

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 485 of file QmitkPropertiesTableModel.cpp.

References m_FilterKeyWord, and Reset().

Referenced by QmitkPropertiesTableEditor::PropertyFilterKeyWordTextChanged().

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

Member Data Documentation

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

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

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

Referenced by QmitkPropertiesTableModel::PropertyListElementFilterFunction::operator()(), Reset(), and SetFilterPropertiesKeyWord().

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

Referenced by AddSelectedProperty(), and RemoveSelectedProperty().

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

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

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

Referenced by AddSelectedProperty(), and RemoveSelectedProperty().

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

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

Definition at line 222 of file QmitkPropertiesTableModel.h.

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

bool QmitkPropertiesTableModel::m_SortDescending
protected

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

Definition at line 243 of file QmitkPropertiesTableModel.h.

Referenced by Reset(), and sort().

const int QmitkPropertiesTableModel::PROPERTY_NAME_COLUMN
static

Definition at line 44 of file QmitkPropertiesTableModel.h.

Referenced by data(), and headerData().

const int QmitkPropertiesTableModel::PROPERTY_VALUE_COLUMN
static

Definition at line 45 of file QmitkPropertiesTableModel.h.

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


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