35 #include <QVBoxLayout>
36 #include <QTreeWidget>
37 #include <QTreeWidgetItem>
46 BaseWidget(parent,
"FrameTreeWidget",
"Frame Tree"),
47 mPatientService(patientService)
49 QVBoxLayout* layout =
new QVBoxLayout(
this);
52 this->setToolTip(
"A tree displaying relations between coordinate spaces");
53 mTreeWidget =
new QTreeWidget(
this);
54 layout->addWidget(mTreeWidget);
55 mTreeWidget->setHeaderLabels(QStringList() <<
"Frame");
58 connect(mPatientService.get(), SIGNAL(dataAddedOrRemoved()),
this, SLOT(dataLoadedSlot()));
61 void FrameTreeWidget::dataLoadedSlot()
63 for (std::map<QString, DataPtr>::iterator iter=mConnectedData.begin(); iter!=mConnectedData.end(); ++iter)
65 disconnect(iter->second.get(), SIGNAL(transformChanged()),
this, SLOT(
setModified()));
68 mConnectedData = mPatientService->getData();
70 for (std::map<QString, DataPtr>::iterator iter=mConnectedData.begin(); iter!=mConnectedData.end(); ++iter)
72 connect(iter->second.get(), SIGNAL(transformChanged()),
this, SLOT(
setModified()));
83 void FrameTreeWidget::rebuild()
88 QDomElement root = forest.
getDocument().documentElement();
90 this->fill(mTreeWidget->invisibleRootItem(), root);
92 mTreeWidget->expandToDepth(10);
93 mTreeWidget->resizeColumnToContents(0);
96 void FrameTreeWidget::fill(QTreeWidgetItem* parent, QDomNode node)
98 for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling())
100 QString frameName = child.toElement().tagName();
103 DataPtr data = mPatientService->getData(frameName);
105 frameName = data->getName();
107 QTreeWidgetItem* item =
new QTreeWidgetItem(parent, QStringList() << frameName);
108 this->fill(item, child);
A graph combining Space dependencies between all Data.Relations between coordinate spaces among Data ...
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
QDomDocument getDocument()
cxLogicManager_EXPORT PatientModelServicePtr patientService()