Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F580
showHelper.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
ritter
Nov 10 2010, 1:34 PM
2010-11-10 13:34:44 (UTC+1)
Size
9 KB
Referenced Files
None
Subscribers
None
showHelper.patch
View Options
Index: mitk/CoreUI/Qmitk/QmitkDataStorageTreeModel.cpp
===================================================================
--- mitk/CoreUI/Qmitk/QmitkDataStorageTreeModel.cpp (revision 26240)
+++ mitk/CoreUI/Qmitk/QmitkDataStorageTreeModel.cpp (working copy)
@@ -34,27 +34,30 @@
QmitkDataStorageTreeModel::QmitkDataStorageTreeModel( mitk::DataStorage* _DataStorage
, bool _PlaceNewNodesOnTop
+ , bool _ShowHelperObjects
, QObject* parent )
: QAbstractItemModel(parent)
, m_DataStorage(0)
, m_PlaceNewNodesOnTop(_PlaceNewNodesOnTop)
+, m_ShowHelperObjects(_ShowHelperObjects)
, m_Root(0)
{
- mitk::NodePredicateData::Pointer dataIsNull = mitk::NodePredicateData::New(0);
- mitk::NodePredicateNOT::Pointer dataIsNotNull
- = mitk::NodePredicateNOT::New(dataIsNull);// Show only nodes that really contain dat
+ //mitk::NodePredicateData::Pointer dataIsNull = mitk::NodePredicateData::New(0);
+ //mitk::NodePredicateNOT::Pointer dataIsNotNull
+ // = mitk::NodePredicateNOT::New(dataIsNull);// Show only nodes that really contain dat
- mitk::NodePredicateProperty::Pointer isHelperObject = mitk::NodePredicateProperty::New("helper object"
- , mitk::BoolProperty::New(true));
+ //mitk::NodePredicateProperty::Pointer isHelperObject = mitk::NodePredicateProperty::New("helper object"
+ // , mitk::BoolProperty::New(true));
- mitk::NodePredicateNOT::Pointer isNotHelperObject
- = mitk::NodePredicateNOT::New(isHelperObject);// Show only nodes that really contain dat
+ //mitk::NodePredicateNOT::Pointer isNotHelperObject
+ // = mitk::NodePredicateNOT::New(isHelperObject);// Show only nodes that really contain dat
- mitk::NodePredicateAND::Pointer dataIsNotNullAndIsNotHelperObject = mitk::NodePredicateAND::New(dataIsNotNull,
- isNotHelperObject);
+ //mitk::NodePredicateAND::Pointer dataIsNotNullAndIsNotHelperObject = mitk::NodePredicateAND::New(dataIsNotNull,
+ // isNotHelperObject);
- m_Predicate = dataIsNotNullAndIsNotHelperObject;
+ //m_Predicate = dataIsNotNull;
+ this->SetShowHelperObjects(_ShowHelperObjects);
this->SetDataStorage(_DataStorage);
}
@@ -202,7 +205,7 @@
mitk::DataNode* dataNode = this->TreeItemFromIndex(index)->GetDataNode();
// get name of treeItem (may also be edited)
- QString nodeName = QString::fromStdString(dataNode->GetName());
+ QString nodeName = QString::fromLocal8Bit(dataNode->GetName().c_str());
if(nodeName.isEmpty())
nodeName = "unnamed";
@@ -233,7 +236,7 @@
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole && m_Root)
- return QString::fromStdString(m_Root->GetDataNode()->GetName());
+ return QString::fromLocal8Bit(m_Root->GetDataNode()->GetName().c_str());
return QVariant();
}
@@ -290,12 +293,7 @@
mitk::DataStorage::SetOfObjects::ConstPointer _NodeSet = m_DataStorage->GetSubset(m_Predicate);
// finally add all nodes to the model
- for(mitk::DataStorage::SetOfObjects::const_iterator it=_NodeSet->begin(); it!=_NodeSet->end()
- ; it++)
- {
- // save node
- this->AddNode(*it);
- }
+ this->Update();
}
}
}
@@ -361,6 +359,41 @@
m_PlaceNewNodesOnTop = _PlaceNewNodesOnTop;
}
+void QmitkDataStorageTreeModel::SetShowHelperObjects(bool _ShowHelperObjects)
+{
+ m_ShowHelperObjects = _ShowHelperObjects;
+
+ mitk::NodePredicateData::Pointer dataIsNull = mitk::NodePredicateData::New(0);
+ mitk::NodePredicateNOT::Pointer dataIsNotNull = mitk::NodePredicateNOT::New(dataIsNull);// Show only nodes that really contain dat
+ mitk::NodePredicateProperty::Pointer isHelperObject = mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true));
+ mitk::NodePredicateNOT::Pointer isNotHelperObject = mitk::NodePredicateNOT::New(isHelperObject);// Show only nodes that really contain dat
+
+ if (! m_ShowHelperObjects)
+ {
+ m_Predicate = mitk::NodePredicateAND::New(dataIsNotNull, isNotHelperObject);
+ }
+ else
+ {
+ m_Predicate = dataIsNotNull;
+ }
+ this->Update();
+}
+
+void QmitkDataStorageTreeModel::Update()
+{
+ if (m_DataStorage.IsNotNull())
+ {
+ this->reset();
+ mitk::DataStorage::SetOfObjects::ConstPointer _NodeSet = m_DataStorage->GetSubset(m_Predicate);
+
+ for(mitk::DataStorage::SetOfObjects::const_iterator it=_NodeSet->begin(); it!=_NodeSet->end(); it++)
+ {
+ // save node
+ this->AddNode(*it);
+ }
+ }
+}
+
void QmitkDataStorageTreeModel::RemoveNode( const mitk::DataNode* node )
{
if(!m_Root) return;
@@ -435,7 +468,7 @@
if(role == Qt::EditRole && !value.toString().isEmpty())
{
- dataNode->SetStringProperty("name", value.toString().toStdString().c_str());
+ dataNode->SetStringProperty("name", value.toString().toLocal8Bit().data());
}
else if(role == Qt::CheckStateRole)
{
Index: mitk/CoreUI/Qmitk/QmitkDataStorageTreeModel.h
===================================================================
--- mitk/CoreUI/Qmitk/QmitkDataStorageTreeModel.h (revision 26240)
+++ mitk/CoreUI/Qmitk/QmitkDataStorageTreeModel.h (working copy)
@@ -44,6 +44,7 @@
public:
QmitkDataStorageTreeModel(mitk::DataStorage* _DataStorage
, bool _PlaceNewNodesOnTop=false
+ , bool _ShowHelperObjects=false
, QObject* parent = 0);
~QmitkDataStorageTreeModel();
@@ -67,6 +68,8 @@
///
void SetPlaceNewNodesOnTop(bool _PlaceNewNodesOnTop);
+ void SetShowHelperObjects(bool _ShowHelperObjects);
+
//# (Re-)implemented from QAbstractItemModel
//# Read model
Qt::ItemFlags flags(const QModelIndex& index) const;
@@ -217,11 +220,15 @@
/// Adds all Childs in parent to vec. Before a child is added the function is called recursively
///
void TreeToNodeSet(TreeItem* parent, std::vector<mitk::DataNode*>& vec) const;
+
+ void Update();
+
//# ATTRIBUTES
protected:
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
mitk::NodePredicateBase::Pointer m_Predicate;
bool m_PlaceNewNodesOnTop;
+ bool m_ShowHelperObjects;
TreeItem* m_Root;
};
Index: mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp
===================================================================
--- mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp (revision 26240)
+++ mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp (working copy)
@@ -48,10 +48,12 @@
m_MainControl = new QWidget(parent);
m_EnableSingleEditing = new QCheckBox;
m_PlaceNewNodesOnTop = new QCheckBox;
+ m_ShowHelperObjects = new QCheckBox;
QFormLayout *formLayout = new QFormLayout;
formLayout->addRow("&Single click property editing:", m_EnableSingleEditing);
formLayout->addRow("&Place new nodes on top:", m_PlaceNewNodesOnTop);
+ formLayout->addRow("&Show helper objects:", m_ShowHelperObjects);
m_MainControl->setLayout(formLayout);
this->Update();
@@ -68,6 +70,8 @@
, m_EnableSingleEditing->isChecked());
m_DataManagerPreferencesNode->PutBool("Place new nodes on top"
, m_PlaceNewNodesOnTop->isChecked());
+ m_DataManagerPreferencesNode->PutBool("Show helper objects"
+ , m_ShowHelperObjects->isChecked());
return true;
}
@@ -80,4 +84,5 @@
{
m_EnableSingleEditing->setChecked(m_DataManagerPreferencesNode->GetBool("Single click property editing", true));
m_PlaceNewNodesOnTop->setChecked(m_DataManagerPreferencesNode->GetBool("Place new nodes on top", true));
+ m_ShowHelperObjects->setChecked(m_DataManagerPreferencesNode->GetBool("Show helper objects", false));
}
Index: mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h
===================================================================
--- mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h (revision 26240)
+++ mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h (working copy)
@@ -57,6 +57,7 @@
QWidget* m_MainControl;
QCheckBox* m_EnableSingleEditing;
QCheckBox* m_PlaceNewNodesOnTop;
+ QCheckBox* m_ShowHelperObjects;
berry::IPreferences::Pointer m_DataManagerPreferencesNode;
};
Index: mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp
===================================================================
--- mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp (revision 26240)
+++ mitk/Modules/Bundles/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp (working copy)
@@ -128,6 +128,8 @@
m_NodeTreeModel->setParent( parent );
m_NodeTreeModel->SetPlaceNewNodesOnTop(
prefs->GetBool("Place new nodes on top", true) );
+ m_NodeTreeModel->SetShowHelperObjects(
+ prefs->GetBool("Show helper objects", true) );
//# Tree View (experimental)
m_NodeTreeView = new QTreeView;
@@ -312,6 +314,8 @@
void QmitkDataManagerView::OnPreferencesChanged(const berry::IBerryPreferences* prefs)
{
m_NodeTreeModel->SetPlaceNewNodesOnTop( prefs->GetBool("Place new nodes on top", true) );
+ m_NodeTreeModel->SetShowHelperObjects( prefs->GetBool("Show helper objects", true) );
+ m_NodeTreeView->expandAll();
}
void QmitkDataManagerView::NodeTableViewContextMenuRequested( const QPoint & pos )
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557
Default Alt Text
showHelper.patch (9 KB)
Attached To
Mode
T5041: option for showing "helper objects" in datamanager view
Attached
Detach File
Event Timeline
•
ritter
added a comment.
Nov 10 2010, 1:34 PM
2010-11-10 13:34:44 (UTC+1)
Comment Actions
current Progress
Log In to Comment