Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Header guard. More...
#include <QmitkPropertiesTableModel.h>
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::Pointer > | PropertyDataSet |
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::PropertyList > | m_PropertyList |
std::vector< PropertyDataSet > | m_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... | |
Header guard.
A table model for showing and editing mitk::Properties.
Definition at line 40 of file QmitkPropertiesTableModel.h.
typedef std::pair<std::string, mitk::BaseProperty::Pointer> QmitkPropertiesTableModel::PropertyDataSet |
Typedef for the complete Property Datastructure, which may be written as follows: Name->(mitk::BaseProperty::Pointer)
Definition at line 50 of file QmitkPropertiesTableModel.h.
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().
|
virtual |
Standard dtor. Nothing to do here.
Definition at line 44 of file QmitkPropertiesTableModel.cpp.
References SetPropertyList().
|
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().
|
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.
|
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.
|
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().
|
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.
|
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.
|
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().
|
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().
|
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().
|
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().
|
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().
|
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.
|
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().
|
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::SetPropertyList | ( | mitk::PropertyList * | _PropertyList | ) |
Sets the Property List to show. Resets the whole model. If _PropertyList is NULL the model is empty.
Definition at line 193 of file QmitkPropertiesTableModel.cpp.
References mitk::MessageBase< AbstractDelegate >::AddListener(), mitk::WeakPointer< TObjectType >::GetPointer(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_PropertyList, mitk::WeakPointer< TObjectType >::ObjectDelete, PropertyListDelete(), mitk::MessageBase< AbstractDelegate >::RemoveListener(), and Reset().
Referenced by QmitkPropertiesTableModel(), QmitkPropertiesTableEditor::SetPropertyList(), and ~QmitkPropertiesTableModel().
|
override |
Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
Definition at line 353 of file QmitkPropertiesTableModel.cpp.
References QmitkPropertiesTableModel::PropertyDataSetCompareFunction::CompareByName, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::CompareByValue, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::Greater, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::Less, m_SelectedProperties, m_SortDescending, and PROPERTY_VALUE_COLUMN.
Referenced by Reset().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
protected |
The property is true when the property list is sorted in descending order.
Definition at line 243 of file QmitkPropertiesTableModel.h.
|
static |
Definition at line 44 of file QmitkPropertiesTableModel.h.
Referenced by data(), and headerData().
|
static |
Definition at line 45 of file QmitkPropertiesTableModel.h.
Referenced by data(), flags(), headerData(), setData(), and sort().