13 #ifndef QmitkPropertiesTableModel_h
14 #define QmitkPropertiesTableModel_h
21 #include <QAbstractTableModel>
34 static const int PROPERTY_NAME_COLUMN = 0;
35 static const int PROPERTY_VALUE_COLUMN = 1;
59 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
63 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
67 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
71 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
91 virtual void PropertyModified(
const itk::Object *caller,
const itk::EventObject &event);
96 virtual void PropertyDelete(
const itk::Object *caller,
const itk::EventObject &event);
106 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
111 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder)
override;
A table model for showing and editing mitk::Properties.
bool m_BlockEvents
Indicates if this class should neglect all incoming events because the class itself triggered the eve...
QmitkPropertiesTableModel(QObject *parent=nullptr, mitk::PropertyList::Pointer _PropertyList=nullptr)
virtual void SetFilterPropertiesKeyWord(std::string _FilterKeyWord)
Set a keyword for filtering of properties. Only properties beginning with this string will be shown.
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.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view,...
mitk::WeakPointer< mitk::PropertyList > m_PropertyList
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
unsigned long m_PropertyListDeleteObserverTag
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,...
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,...
std::string m_FilterKeyWord
If set to any value, only properties containing the specified keyword in their name will be shown.
std::vector< PropertyDataSet > m_SelectedProperties
Store the properties in a vector so that they may be sorted.
void AddSelectedProperty(PropertyDataSet &_PropertyDataSet)
std::pair< std::string, mitk::BaseProperty::Pointer > PropertyDataSet
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.
~QmitkPropertiesTableModel() override
Standard dtor. Nothing to do here.
mitk::PropertyList::Pointer GetPropertyList() const
std::vector< unsigned long > m_PropertyDeleteObserverTags
Holds all tags of Modified Event Listeners. We need it to remove them again.
std::vector< unsigned long > m_PropertyModifiedObserverTags
Holds all tags of Modified Event Listeners. We need it to remove them again.
void SetPropertyList(mitk::PropertyList *_PropertyList)
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Qt::ItemFlags flags(const QModelIndex &index) const override
Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view,...
int FindProperty(const mitk::BaseProperty *_Property) const
Searches for the specified property and returns the row of the element in this QTableModel....
virtual void PropertyListDelete()
Gets called when the list is about to be deleted.
bool m_SortDescending
The property is true when the property list is sorted in descending order.
void RemoveSelectedProperty(unsigned int _Index)
int columnCount(const QModelIndex &parent) const override
Abstract base class for properties.
Key-value list holding instances of BaseProperty.
A struct that you can use in std::sort algorithm for sorting the property list elements.
CompareCriteria
Specifies field of the property with which it will be sorted.
PropertyDataSetCompareFunction(CompareCriteria _CompareCriteria=CompareByName, CompareOperator _CompareOperator=Less)
Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given.
bool operator()(const PropertyDataSet &_Left, const PropertyDataSet &_Right) const
The reimplemented compare function.
CompareCriteria m_CompareCriteria
CompareOperator m_CompareOperator
CompareOperator
Specifies Ascending/descending ordering.
std::string m_FilterKeyWord
PropertyListElementFilterFunction(const std::string &m_FilterKeyWord)
bool operator()(const PropertyDataSet &_Elem) const
The reimplemented compare function.