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, std::pair < mitk::BaseProperty::Pointer, bool > > | PropertyDataSet |
Public Member Functions | |
QmitkPropertiesTableModel (QObject *parent=0, mitk::PropertyList::Pointer _PropertyList=0) | |
virtual | ~QmitkPropertiesTableModel () |
mitk::PropertyList::Pointer | GetPropertyList () const |
Qt::ItemFlags | flags (const QModelIndex &index) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent) const |
void | SetPropertyList (mitk::PropertyList *_PropertyList) |
virtual void | PropertyListDelete (const itk::Object *_PropertyList) |
Gets called when the list is about to be deleted. | |
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. | |
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. | |
virtual void | SetFilterPropertiesKeyWord (std::string _FilterKeyWord) |
Set a keyword for filtering of properties. Only properties beginning with this string will be shown. | |
bool | setData (const QModelIndex &index, const QVariant &value, int role) |
void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) |
Reimplemented sort function from QAbstractTableModel to enable sorting on the table. | |
Static Public Attributes | |
static const int | PROPERTY_NAME_COLUMN = 0 |
static const int | PROPERTY_VALUE_COLUMN = 1 |
static const int | PROPERTY_ACTIVE_COLUMN = 2 |
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. | |
void | AddSelectedProperty (PropertyDataSet &_PropertyDataSet) |
void | RemoveSelectedProperty (unsigned int _Index) |
void | Reset () |
Protected Attributes | |
mitk::WeakPointer < mitk::PropertyList > | m_PropertyList |
std::vector< PropertyDataSet > | m_SelectedProperties |
std::vector< unsigned long > | m_PropertyModifiedObserverTags |
Holds all tags of Modified Event Listeners. We need it to remove them again. | |
std::vector< unsigned long > | m_PropertyDeleteObserverTags |
Holds all tags of Modified Event Listeners. We need it to remove them again. | |
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). | |
bool | m_SortDescending |
The property is true when the property list is sorted in descending order. | |
std::string | m_FilterKeyWord |
If set to any value, only properties containing the specified keyword in their name will be shown. |
Header guard.
A table model for showing and editing mitk::Properties.
Definition at line 39 of file QmitkPropertiesTableModel.h.
typedef std::pair<std::string,std::pair<mitk::BaseProperty::Pointer,bool> > QmitkPropertiesTableModel::PropertyDataSet |
Typedef for the complete Property Datastructure, which may be written as follows: Name->(mitk::BaseProperty::Pointer->ActiveFlag)
Definition at line 51 of file QmitkPropertiesTableModel.h.
QmitkPropertiesTableModel::QmitkPropertiesTableModel | ( | QObject * | parent = 0 , |
mitk::PropertyList::Pointer | _PropertyList = 0 |
||
) |
Constructs a new QmitkDataStorageTableModel and sets the DataNode for this TableModel.
Definition at line 35 of file QmitkPropertiesTableModel.cpp.
References SetPropertyList().
: QAbstractTableModel(parent) , m_PropertyList(0) , m_BlockEvents(false) , m_SortDescending(false) , m_FilterKeyWord("") { this->SetPropertyList(_PropertyList); }
QmitkPropertiesTableModel::~QmitkPropertiesTableModel | ( | ) | [virtual] |
Standard dtor. Nothing to do here.
Definition at line 45 of file QmitkPropertiesTableModel.cpp.
References SetPropertyList().
{ // remove all event listeners by setting the property list to 0 this->SetPropertyList(0); }
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 444 of file QmitkPropertiesTableModel.cpp.
References m_PropertyDeleteObserverTags, m_PropertyModifiedObserverTags, m_SelectedProperties, PropertyDelete(), and PropertyModified().
Referenced by Reset().
{ // subscribe for modified event itk::MemberCommand<QmitkPropertiesTableModel>::Pointer _PropertyDataSetModifiedCommand = itk::MemberCommand<QmitkPropertiesTableModel>::New(); _PropertyDataSetModifiedCommand->SetCallbackFunction(this, &QmitkPropertiesTableModel::PropertyModified); m_PropertyModifiedObserverTags.push_back(_PropertyDataSet.second.first->AddObserver(itk::ModifiedEvent(), _PropertyDataSetModifiedCommand)); // subscribe for delete event itk::MemberCommand<QmitkPropertiesTableModel>::Pointer _PropertyDataSetDeleteCommand = itk::MemberCommand<QmitkPropertiesTableModel>::New(); _PropertyDataSetDeleteCommand->SetCallbackFunction(this, &QmitkPropertiesTableModel::PropertyDelete); m_PropertyDeleteObserverTags.push_back(_PropertyDataSet.second.first->AddObserver(itk::DeleteEvent(), _PropertyDataSetDeleteCommand)); // add to the selection m_SelectedProperties.push_back(_PropertyDataSet); }
int QmitkPropertiesTableModel::columnCount | ( | const QModelIndex & | parent ) | const |
Overwritten from QAbstractTableModel. Returns the number of columns. That is usually two in this model: the properties name and its value.
Definition at line 207 of file QmitkPropertiesTableModel.cpp.
{
return 3;
}
QVariant QmitkPropertiesTableModel::data | ( | const QModelIndex & | index, |
int | role = Qt::DisplayRole |
||
) | const |
Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
Definition at line 106 of file QmitkPropertiesTableModel.cpp.
References mitk::BaseProperty::GetValueAsString(), int(), m_SelectedProperties, PROPERTY_ACTIVE_COLUMN, PROPERTY_NAME_COLUMN, and PROPERTY_VALUE_COLUMN.
{ // empty data by default QVariant data; if(!index.isValid() || m_SelectedProperties.empty() || index.row() > (int)(m_SelectedProperties.size()-1)) return data; // the properties name if(index.column() == PROPERTY_NAME_COLUMN) { if(role == Qt::DisplayRole) data = QString::fromStdString(m_SelectedProperties[index.row()].first); } // the real properties value else if(index.column() == PROPERTY_VALUE_COLUMN) { mitk::BaseProperty* baseProp = m_SelectedProperties[index.row()].second.first; if (const mitk::ColorProperty* colorProp = dynamic_cast<const mitk::ColorProperty*>(baseProp)) { mitk::Color col = colorProp->GetColor(); QColor qcol((int)(col.GetRed() * 255), (int)(col.GetGreen() * 255),(int)( col.GetBlue() * 255)); if(role == Qt::DisplayRole) data.setValue<QColor>(qcol); else if(role == Qt::EditRole) data.setValue<QColor>(qcol); } else if(mitk::BoolProperty* boolProp = dynamic_cast<mitk::BoolProperty*>(baseProp)) { if(role == Qt::CheckStateRole) data = boolProp->GetValue() ? Qt::Checked : Qt::Unchecked; } else if (mitk::StringProperty* stringProp = dynamic_cast<mitk::StringProperty*>(baseProp)) { if(role == Qt::DisplayRole) data.setValue<QString>(QString::fromStdString(stringProp->GetValue())); else if(role == Qt::EditRole) data.setValue<QString>(QString::fromStdString(stringProp->GetValue())); } else if (mitk::IntProperty* intProp = dynamic_cast<mitk::IntProperty*>(baseProp)) { if(role == Qt::DisplayRole) data.setValue<int>(intProp->GetValue()); else if(role == Qt::EditRole) data.setValue<int>(intProp->GetValue()); } else if (mitk::FloatProperty* floatProp = dynamic_cast<mitk::FloatProperty*>(baseProp)) { if(role == Qt::DisplayRole) data.setValue<float>(floatProp->GetValue()); else if(role == Qt::EditRole) data.setValue<float>(floatProp->GetValue()); } else if (mitk::EnumerationProperty* enumerationProp = dynamic_cast<mitk::EnumerationProperty*>(baseProp)) { if(role == Qt::DisplayRole) data.setValue<QString>(QString::fromStdString(baseProp->GetValueAsString())); else if(role == Qt::EditRole) { QStringList values; for(mitk::EnumerationProperty::EnumConstIterator it=enumerationProp->Begin(); it!=enumerationProp->End() ; it++) { values << QString::fromStdString(it->second); } data.setValue<QStringList>(values); } } else { if(role == Qt::DisplayRole) data.setValue<QString>(QString::fromStdString(m_SelectedProperties[index.row()].second.first->GetValueAsString())); } } // enabled/disabled value else if(index.column() == PROPERTY_ACTIVE_COLUMN) { if (role == Qt::CheckStateRole) data = (m_SelectedProperties[index.row()].second.second) ? Qt::Checked : Qt::Unchecked; } return data; }
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 420 of file QmitkPropertiesTableModel.cpp.
References QuadProgPP::distance(), and m_SelectedProperties.
Referenced by PropertyDelete(), and PropertyModified().
{ int row = -1; if(_Property) { // search for property that changed and emit datachanged on the corresponding ModelIndex std::vector<PropertyDataSet >::const_iterator propertyIterator; for( propertyIterator=m_SelectedProperties.begin(); propertyIterator!=m_SelectedProperties.end() ; propertyIterator++) { if(propertyIterator->second.first == _Property) break; } if(propertyIterator != m_SelectedProperties.end()) row = std::distance(m_SelectedProperties.begin(), propertyIterator); } return row; }
Qt::ItemFlags QmitkPropertiesTableModel::flags | ( | const QModelIndex & | index ) | const |
Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
Definition at line 57 of file QmitkPropertiesTableModel.cpp.
References PROPERTY_ACTIVE_COLUMN, and PROPERTY_VALUE_COLUMN.
{ // no editing so far, return default (enabled, selectable) Qt::ItemFlags flags = QAbstractItemModel::flags(index); if (index.column() == PROPERTY_VALUE_COLUMN) { // there are also read only property items -> do not allow editing them if(index.data(Qt::EditRole).isValid()) flags |= Qt::ItemIsEditable; if(index.data(Qt::CheckStateRole).isValid()) flags |= Qt::ItemIsUserCheckable; } if (index.column() == PROPERTY_ACTIVE_COLUMN) { flags |= Qt::ItemIsUserCheckable; } return flags; }
mitk::PropertyList::Pointer QmitkPropertiesTableModel::GetPropertyList | ( | ) | const |
Returns the property list of this table model.
Definition at line 52 of file QmitkPropertiesTableModel.cpp.
References mitk::WeakPointer< TObjectType >::GetPointer(), and m_PropertyList.
{ return m_PropertyList.GetPointer(); }
QVariant QmitkPropertiesTableModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
Definition at line 80 of file QmitkPropertiesTableModel.cpp.
References PROPERTY_ACTIVE_COLUMN, PROPERTY_NAME_COLUMN, and PROPERTY_VALUE_COLUMN.
{ if (role != Qt::DisplayRole) return QVariant(); if (orientation == Qt::Horizontal) { switch (section) { case PROPERTY_NAME_COLUMN: return tr("Name"); case PROPERTY_VALUE_COLUMN: return tr("Value"); case PROPERTY_ACTIVE_COLUMN: return tr("Active"); default: return QVariant(); } } return QVariant(); }
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 263 of file QmitkPropertiesTableModel.cpp.
References FindProperty(), m_BlockEvents, and Reset().
Referenced by AddSelectedProperty().
{ if(!m_BlockEvents) { m_BlockEvents = true; int row = this->FindProperty(dynamic_cast<const mitk::BaseProperty*>(caller)); if(row >= 0) this->Reset(); m_BlockEvents = false; } }
void QmitkPropertiesTableModel::PropertyListDelete | ( | const itk::Object * | _PropertyList ) | [virtual] |
Gets called when the list is about to be deleted.
Definition at line 239 of file QmitkPropertiesTableModel.cpp.
References m_BlockEvents, and Reset().
Referenced by SetPropertyList().
{ if(!m_BlockEvents) { m_BlockEvents = true; this->Reset(); m_BlockEvents = false; } }
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 249 of file QmitkPropertiesTableModel.cpp.
References FindProperty(), and m_BlockEvents.
Referenced by AddSelectedProperty().
{ if(!m_BlockEvents) { m_BlockEvents = true; int row = this->FindProperty(dynamic_cast<const mitk::BaseProperty*>(caller)); QModelIndex indexOfChangedProperty = index(row, 1); emit dataChanged(indexOfChangedProperty, indexOfChangedProperty); m_BlockEvents = false; } }
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 462 of file QmitkPropertiesTableModel.cpp.
References m_PropertyDeleteObserverTags, m_PropertyModifiedObserverTags, and m_SelectedProperties.
Referenced by Reset().
{ PropertyDataSet& _PropertyDataSet = m_SelectedProperties.at(_Index); // remove modified event listener _PropertyDataSet.second.first->RemoveObserver(m_PropertyModifiedObserverTags[_Index]); m_PropertyModifiedObserverTags.erase(m_PropertyModifiedObserverTags.begin()+_Index); // remove delete event listener _PropertyDataSet.second.first->RemoveObserver(m_PropertyDeleteObserverTags[_Index]); m_PropertyDeleteObserverTags.erase(m_PropertyDeleteObserverTags.begin()+_Index); // remove from selection m_SelectedProperties.erase(m_SelectedProperties.begin()+_Index); }
void QmitkPropertiesTableModel::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 476 of file QmitkPropertiesTableModel.cpp.
References AddSelectedProperty(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_FilterKeyWord, m_PropertyList, m_SelectedProperties, m_SortDescending, RemoveSelectedProperty(), and sort().
Referenced by PropertyDelete(), PropertyListDelete(), SetFilterPropertiesKeyWord(), and SetPropertyList().
{ // remove all selected properties while(!m_SelectedProperties.empty()) { this->RemoveSelectedProperty(m_SelectedProperties.size()-1); } std::vector<PropertyDataSet> allPredicates; if(m_PropertyList.IsNotNull()) { // first of all: collect all properties from the list for(mitk::PropertyList::PropertyMap::const_iterator it=m_PropertyList->GetMap()->begin() ; it!=m_PropertyList->GetMap()->end() ; it++) { allPredicates.push_back(*it); } } // make a subselection if a keyword is specified if(!m_FilterKeyWord.empty()) { std::vector<PropertyDataSet> subSelection; for(std::vector<PropertyDataSet>::iterator it=allPredicates.begin() ; it!=allPredicates.end() ; it++) { // add this to the selection if it is matched by the keyword if((*it).first.find(m_FilterKeyWord) != std::string::npos) subSelection.push_back((*it)); } allPredicates.clear(); allPredicates = subSelection; } PropertyDataSet tmpPropertyDataSet; // add all selected now to the Model for(std::vector<PropertyDataSet>::iterator it=allPredicates.begin() ; it!=allPredicates.end() ; it++) { tmpPropertyDataSet = *it; this->AddSelectedProperty(tmpPropertyDataSet); } // sort the list as indicated by m_SortDescending this->sort(m_SortDescending); // model was resetted QAbstractTableModel::reset(); }
int QmitkPropertiesTableModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() ) |
const |
Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
Definition at line 201 of file QmitkPropertiesTableModel.cpp.
References m_SelectedProperties.
{ // return the number of properties in the properties list. return m_SelectedProperties.size(); }
bool QmitkPropertiesTableModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role | ||
) |
Overridden from QAbstractTableModel. Sets data at index for given role.
Definition at line 275 of file QmitkPropertiesTableModel.cpp.
References mitk::RenderingManager::GetInstance(), int(), m_BlockEvents, m_PropertyList, m_SelectedProperties, PROPERTY_ACTIVE_COLUMN, and PROPERTY_VALUE_COLUMN.
{ if (index.isValid() && !m_SelectedProperties.empty() && index.row() < (int)(m_SelectedProperties.size()) && (role == Qt::EditRole || Qt::CheckStateRole)) { // block all events now! m_BlockEvents = true; // the properties name if(index.column() == PROPERTY_VALUE_COLUMN) { mitk::BaseProperty* baseProp = m_SelectedProperties[index.row()].second.first; if (mitk::ColorProperty* colorProp = dynamic_cast<mitk::ColorProperty*>(baseProp)) { QColor qcolor = value.value<QColor>(); if(!qcolor.isValid()) return false; mitk::Color col = colorProp->GetColor(); col.SetRed(qcolor.red() / 255.0); col.SetGreen(qcolor.green() / 255.0); col.SetBlue(qcolor.blue() / 255.0); colorProp->SetColor(col); m_PropertyList->InvokeEvent(itk::ModifiedEvent()); m_PropertyList->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } else if(mitk::BoolProperty* boolProp = dynamic_cast<mitk::BoolProperty*>(baseProp)) { boolProp->SetValue(value.toInt() == Qt::Checked ? true : false); m_PropertyList->InvokeEvent(itk::ModifiedEvent()); m_PropertyList->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } else if (mitk::StringProperty* stringProp = dynamic_cast<mitk::StringProperty*>(baseProp)) { stringProp->SetValue((value.value<QString>()).toStdString()); m_PropertyList->InvokeEvent(itk::ModifiedEvent()); m_PropertyList->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } else if (mitk::IntProperty* intProp = dynamic_cast<mitk::IntProperty*>(baseProp)) { int intValue = value.value<int>(); if (intValue != intProp->GetValue()) { intProp->SetValue(intValue); m_PropertyList->InvokeEvent(itk::ModifiedEvent()); m_PropertyList->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } } else if (mitk::FloatProperty* floatProp = dynamic_cast<mitk::FloatProperty*>(baseProp)) { float floatValue = value.value<float>(); if (floatValue != floatProp->GetValue()) { floatProp->SetValue(floatValue); m_PropertyList->InvokeEvent(itk::ModifiedEvent()); m_PropertyList->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } } else if (mitk::EnumerationProperty* enumerationProp = dynamic_cast<mitk::EnumerationProperty*>(baseProp)) { std::string activatedItem = value.value<QString>().toStdString(); if ( activatedItem != enumerationProp->GetValueAsString() ) { if ( enumerationProp->IsValidEnumerationValue( activatedItem ) ) { enumerationProp->SetValue( activatedItem ); m_PropertyList->InvokeEvent( itk::ModifiedEvent() ); m_PropertyList->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } } } } // enabled/disabled value else if(index.column() == PROPERTY_ACTIVE_COLUMN) { bool active = value.toInt() == Qt::Checked; std::string propertyName = m_SelectedProperties[index.row()].first; m_PropertyList->SetEnabled(propertyName, active); m_SelectedProperties[index.row()].second.second = active; mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } // property was changed by us, now we can accept property changes triggered by someone else m_BlockEvents = false; emit dataChanged(index, index); return true; } return false; }
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 529 of file QmitkPropertiesTableModel.cpp.
References m_FilterKeyWord, and Reset().
Referenced by QmitkPropertiesTableEditor::PropertyFilterKeyWordTextChanged().
{ m_FilterKeyWord = _FilterKeyWord; this->Reset(); }
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 213 of file QmitkPropertiesTableModel.cpp.
References mitk::WeakPointer< TObjectType >::GetPointer(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_PropertyList, mitk::WeakPointer< TObjectType >::ObjectDelete, PropertyListDelete(), and Reset().
Referenced by QmitkPropertiesTableModel(), QmitkPropertiesTableEditor::SetPropertyList(), and ~QmitkPropertiesTableModel().
{ // if propertylist really changed if(m_PropertyList.GetPointer() != _PropertyList) { // Remove delete listener if there was a propertylist before if(m_PropertyList.IsNotNull()) { m_PropertyList.ObjectDelete.RemoveListener (mitk::MessageDelegate1<QmitkPropertiesTableModel , const itk::Object*>( this, &QmitkPropertiesTableModel::PropertyListDelete )); } // set new list m_PropertyList = _PropertyList; if(m_PropertyList.IsNotNull()) { m_PropertyList.ObjectDelete.AddListener (mitk::MessageDelegate1<QmitkPropertiesTableModel , const itk::Object*>( this, &QmitkPropertiesTableModel::PropertyListDelete )); } this->Reset(); } }
void QmitkPropertiesTableModel::sort | ( | int | column, |
Qt::SortOrder | order = Qt::AscendingOrder |
||
) |
Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
Definition at line 389 of file QmitkPropertiesTableModel.cpp.
References QmitkPropertiesTableModel::PropertyDataSetCompareFunction::CompareByActivity, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::CompareByName, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::CompareByValue, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::Greater, QmitkPropertiesTableModel::PropertyDataSetCompareFunction::Less, m_SelectedProperties, m_SortDescending, PROPERTY_ACTIVE_COLUMN, and PROPERTY_VALUE_COLUMN.
Referenced by Reset().
{ bool sortDescending = (order == Qt::DescendingOrder) ? true: false; // do not sort twice !!! (dont know why, but qt calls this func twice. STUPID!) if(sortDescending != m_SortDescending) { m_SortDescending = sortDescending; PropertyDataSetCompareFunction::CompareCriteria _CompareCriteria = PropertyDataSetCompareFunction::CompareByName; PropertyDataSetCompareFunction::CompareOperator _CompareOperator = m_SortDescending ? PropertyDataSetCompareFunction::Greater: PropertyDataSetCompareFunction::Less; if(column == PROPERTY_VALUE_COLUMN) _CompareCriteria = PropertyDataSetCompareFunction::CompareByValue; else if(column == PROPERTY_ACTIVE_COLUMN) _CompareCriteria = PropertyDataSetCompareFunction::CompareByActivity; PropertyDataSetCompareFunction compareFunc(_CompareCriteria, _CompareOperator); std::sort(m_SelectedProperties.begin(), m_SelectedProperties.end(), compareFunc); QAbstractTableModel::reset(); } }
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 240 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 250 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 234 of file QmitkPropertiesTableModel.h.
Referenced by AddSelectedProperty(), and RemoveSelectedProperty().
Holds the pointer to the properties list. Dont use smart pointers here. Instead: Listen to the delete event.
Definition at line 220 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 229 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 224 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 245 of file QmitkPropertiesTableModel.h.
const int QmitkPropertiesTableModel::PROPERTY_ACTIVE_COLUMN = 2 [static] |
Definition at line 46 of file QmitkPropertiesTableModel.h.
Referenced by data(), flags(), headerData(), setData(), and sort().
const int QmitkPropertiesTableModel::PROPERTY_NAME_COLUMN = 0 [static] |
Definition at line 44 of file QmitkPropertiesTableModel.h.
Referenced by data(), and headerData().
const int QmitkPropertiesTableModel::PROPERTY_VALUE_COLUMN = 1 [static] |
Definition at line 45 of file QmitkPropertiesTableModel.h.
Referenced by data(), flags(), headerData(), setData(), and sort().