Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019 #ifndef QmitkPropertiesTableModel_h
00020 #define QmitkPropertiesTableModel_h
00021
00022
00023 #include "mitkDataNode.h"
00024 #include "mitkWeakPointer.h"
00025
00026
00027 #include <QAbstractTableModel>
00028 #include <vector>
00029 #include <string>
00030
00031
00032
00039 class QMITK_EXPORT QmitkPropertiesTableModel : public QAbstractTableModel
00040 {
00041
00042
00043 public:
00044 static const int PROPERTY_NAME_COLUMN = 0;
00045 static const int PROPERTY_VALUE_COLUMN = 1;
00046 static const int PROPERTY_ACTIVE_COLUMN = 2;
00051 typedef std::pair<std::string,std::pair<mitk::BaseProperty::Pointer,bool> > PropertyDataSet;
00052
00056 QmitkPropertiesTableModel(QObject* parent = 0, mitk::PropertyList::Pointer _PropertyList=0);
00057
00060 virtual ~QmitkPropertiesTableModel();
00061
00062
00063 public:
00067 mitk::PropertyList::Pointer GetPropertyList() const;
00068
00071 Qt::ItemFlags flags(const QModelIndex& index) const;
00072
00075 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00076
00079 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
00080
00083 int rowCount(const QModelIndex& parent = QModelIndex()) const;
00084
00088 int columnCount(const QModelIndex &parent) const;
00089
00090
00091 public:
00095 void SetPropertyList(mitk::PropertyList* _PropertyList);
00096
00100 virtual void PropertyListDelete(const itk::Object *_PropertyList);
00101
00105 virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event);
00106
00110 virtual void PropertyDelete(const itk::Object *caller, const itk::EventObject &event);
00111
00115 virtual void SetFilterPropertiesKeyWord(std::string _FilterKeyWord);
00116
00120 bool setData(const QModelIndex &index, const QVariant &value,
00121 int role);
00122
00126 void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
00127
00128
00129 protected:
00134 struct PropertyDataSetCompareFunction
00135 : public std::binary_function<PropertyDataSet, PropertyDataSet, bool>
00136 {
00140 enum CompareCriteria {
00141 CompareByName = 0,
00142 CompareByValue,
00143 CompareByActivity
00144 };
00145
00149 enum CompareOperator {
00150 Less = 0,
00151 Greater
00152 };
00153
00157 PropertyDataSetCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less);
00161 bool operator()(const PropertyDataSet& _Left
00162 , const PropertyDataSet& _Right) const;
00163
00164 protected:
00165 CompareCriteria m_CompareCriteria;
00166 CompareOperator m_CompareOperator;
00167 };
00168
00172 struct PropertyListElementFilterFunction
00173 : public std::unary_function<PropertyDataSet, bool>
00174 {
00175 PropertyListElementFilterFunction(const std::string& m_FilterKeyWord);
00179 bool operator()(const PropertyDataSet& _Elem) const;
00180
00181 protected:
00182 std::string m_FilterKeyWord;
00183 };
00184
00185
00186 protected:
00191 int FindProperty(const mitk::BaseProperty* _Property) const;
00192
00193
00194 protected:
00200 void AddSelectedProperty(PropertyDataSet& _PropertyDataSet);
00206 void RemoveSelectedProperty(unsigned int _Index);
00213 void Reset();
00214
00215
00216 protected:
00220 mitk::WeakPointer<mitk::PropertyList> m_PropertyList;
00221
00224 std::vector<PropertyDataSet > m_SelectedProperties;
00225
00229 std::vector<unsigned long> m_PropertyModifiedObserverTags;
00230
00234 std::vector<unsigned long> m_PropertyDeleteObserverTags;
00235
00240 bool m_BlockEvents;
00241
00245 bool m_SortDescending;
00246
00250 std::string m_FilterKeyWord;
00251 };
00252
00253 #endif