18 #include "ui_QmitkFunctionalityComponentContainerControls.h"
20 #include "mitkDataTreeFilterFunctions.h"
26 #include <itkCommand.h>
27 #include <qcombobox.h>
28 #include <qgroupbox.h>
31 #include <qtabwidget.h>
38 const QSizePolicy
preferred(QSizePolicy::Preferred, QSizePolicy::Preferred);
41 const char *parentName,
44 : QmitkBaseFunctionalityComponent(parent, parentName),
45 m_UpdateSelector(updateSelector),
46 m_ShowSelector(showSelector),
50 m_FunctionalityComponentContainerGUI(NULL),
52 m_ComponentName(
"ComponentContainer"),
56 m_MaximumWidgedStackSize(-1)
58 SetAvailability(
true);
67 m_ComponentName = name;
72 return m_ComponentName;
82 return (QGroupBox *)m_FunctionalityComponentContainerGUI->m_ImageContent;
92 return m_ParentMitkImage;
97 if (m_FunctionalityComponentContainerGUI)
99 return m_FunctionalityComponentContainerGUI->m_TreeNodeSelector;
107 return m_MulitWidget;
124 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
126 m_AddedChildList[i]->TreeChanged();
136 if (m_FunctionalityComponentContainerGUI)
138 connect((QObject *)(m_FunctionalityComponentContainerGUI->m_TreeNodeSelector),
142 connect((QObject *)(m_FunctionalityComponentContainerGUI->m_ContainerBorder),
143 SIGNAL(toggled(
bool)),
161 if (m_FunctionalityComponentContainerGUI != NULL)
163 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
165 QmitkBaseFunctionalityComponent *functionalityComponent =
166 dynamic_cast<QmitkBaseFunctionalityComponent *
>(m_AddedChildList[i]);
167 if (functionalityComponent != NULL)
169 functionalityComponent->DataStorageChanged(ds);
174 if (m_FunctionalityComponentContainerGUI)
176 if (!m_FunctionalityComponentContainerGUI->m_TreeNodeSelector)
178 if (!m_FunctionalityComponentContainerGUI->m_TreeNodeSelector->GetSelectedNode())
180 if (!m_FunctionalityComponentContainerGUI->m_TreeNodeSelector->GetSelectedNode()->GetData())
183 m_FunctionalityComponentContainerGUI->m_TreeNodeSelector->GetSelectedNode()->GetData());
185 if (m_FunctionalityComponentContainerGUI != NULL)
187 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
189 QmitkBaseFunctionalityComponent *functionalityComponent =
190 dynamic_cast<QmitkBaseFunctionalityComponent *
>(m_AddedChildList[i]);
191 if (functionalityComponent != NULL)
193 if (!m_FunctionalityComponentContainerGUI->m_TreeNodeSelector->GetSelectedNode()->GetData())
195 functionalityComponent->m_ParentMitkImage =
static_cast<mitk::Image *
>(
196 m_FunctionalityComponentContainerGUI->m_TreeNodeSelector->GetSelectedNode()->GetData());
205 if (m_FunctionalityComponentContainerGUI != NULL)
210 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
212 QmitkBaseFunctionalityComponent *functionalityComponent =
213 dynamic_cast<QmitkBaseFunctionalityComponent *
>(m_AddedChildList[i]);
214 if (functionalityComponent != NULL)
215 functionalityComponent->ImageSelected(item);
219 if (m_FunctionalityComponentContainerGUI)
223 if (m_FunctionalityComponentContainerGUI != NULL)
225 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
227 QmitkBaseFunctionalityComponent *functionalityComponent =
228 dynamic_cast<QmitkBaseFunctionalityComponent *
>(m_AddedChildList[i]);
229 if (functionalityComponent != NULL)
231 functionalityComponent->m_ParentMitkImage =
static_cast<mitk::Image *
>(item->
GetData());
241 if (m_FunctionalityComponentContainerGUI == NULL)
244 m_FunctionalityComponentContainerGUI =
new Ui::QmitkFunctionalityComponentContainerGUI;
245 m_FunctionalityComponentContainerGUI->setupUi(
m_GUI);
249 m_FunctionalityComponentContainerGUI->m_TreeNodeSelector->SetDataStorage(dataStorage);
252 m_FunctionalityComponentContainerGUI->m_WidgetStack->setCurrentIndex(0);
259 return m_FunctionalityComponentContainerGUI->m_ImageContent;
264 return m_FunctionalityComponentContainerGUI->m_ContainerBorder;
280 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
298 m_FunctionalityComponentContainerGUI->m_ImageContent->setShown(visibility);
306 QmitkBaseFunctionalityComponent::Activated();
308 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
310 m_AddedChildList[i]->Activated();
316 QmitkBaseFunctionalityComponent::Deactivated();
318 for (
unsigned int i = 0; i < m_AddedChildList.size(); i++)
320 m_AddedChildList[i]->Deactivated();
326 if (component != NULL)
328 QWidget *componentWidget = component->CreateControlWidget(
m_GUI);
329 AddComponentListener(component);
330 m_GUI->layout()->addWidget(componentWidget);
332 if (m_Spacer != NULL)
334 m_GUI->layout()->removeItem(m_Spacer);
336 QSpacerItem *spacer =
new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
338 m_GUI->layout()->addItem(m_Spacer);
357 if (component != NULL)
359 QWidget *visibleWidget = m_FunctionalityComponentContainerGUI->m_WidgetStack->currentWidget();
360 int idVisibleWidget = m_FunctionalityComponentContainerGUI->m_WidgetStack->indexOf(visibleWidget);
361 if (idVisibleWidget > m_MaximumWidgedStackSize)
363 m_MaximumWidgedStackSize = idVisibleWidget;
365 if (m_MaximumWidgedStackSize < stackPage)
367 QWidget *w =
new QWidget(m_FunctionalityComponentContainerGUI->m_WidgetStack);
368 m_FunctionalityComponentContainerGUI->m_WidgetStack->insertTab(stackPage, w, label);
369 m_MaximumWidgedStackSize++;
370 m_FunctionalityComponentContainerGUI->m_WidgetStack->setCurrentIndex(stackPage);
371 visibleWidget = m_FunctionalityComponentContainerGUI->m_WidgetStack->currentWidget();
372 idVisibleWidget = m_FunctionalityComponentContainerGUI->m_WidgetStack->indexOf(visibleWidget);
373 new QVBoxLayout(visibleWidget);
377 if (m_FunctionalityComponentContainerGUI->m_WidgetStack->layout() == 0)
379 layout =
new QVBoxLayout((QWidget *)(m_FunctionalityComponentContainerGUI->m_WidgetStack));
383 layout = m_FunctionalityComponentContainerGUI->m_WidgetStack->layout();
386 component->
CreateQtPartControl(m_FunctionalityComponentContainerGUI->m_WidgetStack->currentWidget(),
388 QWidget *componentWidget = component->
GetGUI();
389 AddComponentListener(component);
390 m_FunctionalityComponentContainerGUI->m_WidgetStack->setCurrentIndex(stackPage);
391 QWidget *theCurrentWidget = m_FunctionalityComponentContainerGUI->m_WidgetStack->currentWidget();
392 QLayout *theCurrentLayout = theCurrentWidget->layout();
393 theCurrentLayout->addWidget(componentWidget);
395 m_FunctionalityComponentContainerGUI->m_WidgetStack->setShown(
true);
396 m_FunctionalityComponentContainerGUI->m_WidgetStack->updateGeometry();
397 m_FunctionalityComponentContainerGUI->m_WidgetStack->layout()->activate();
398 componentWidget->setShown(
true);
407 QWidget *funcWidget = (QWidget *)m_FunctionalityComponentContainerGUI;
408 QLayout *functionalityLayout = funcWidget->layout();
409 QBoxLayout *buttonLayout =
new QHBoxLayout(funcWidget);
410 if (QBoxLayout *boxLayout = dynamic_cast<QBoxLayout *>(functionalityLayout))
412 boxLayout->addLayout(buttonLayout);
414 if (m_BackButton == NULL)
416 m_BackButton =
new QPushButton(
"<<", (QWidget *)(m_FunctionalityComponentContainerGUI));
418 if (m_NextButton == NULL)
420 m_NextButton =
new QPushButton(
">>", (QWidget *)(m_FunctionalityComponentContainerGUI));
422 buttonLayout->addWidget(m_BackButton);
423 buttonLayout->addWidget(m_NextButton);
424 m_BackButton->setShown(
true);
425 m_NextButton->setShown(
true);
426 m_GUI->layout()->activate();
429 m_FunctionalityComponentContainerGUI->m_WidgetStack->setCurrentIndex(1);
432 if (m_Spacer != NULL)
434 m_GUI->layout()->removeItem(m_Spacer);
436 QSpacerItem *spacer =
new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
438 m_GUI->layout()->addItem(m_Spacer);
439 m_GUI->updateGeometry();
447 m_GUI->updateGeometry();
448 m_GUI->layout()->activate();
452 Ui::QmitkFunctionalityComponentContainerGUI *
455 return m_FunctionalityComponentContainerGUI;
ContainerClass for components.
void SetSelectedNode(mitk::DataNode::Pointer item)
Slot for signal when user wants to set a node as current selected node.
virtual void SetDataStorage(mitk::DataStorage::Pointer dataStorage)
Method to set the DataStorage.
Ui::QmitkFunctionalityComponentContainerGUI * GetFunctionalityComponentContainerGUI()
also the Graphical User Interface for the component, like m_GUI, but with its specific type ...
virtual void DataStorageChanged(mitk::DataStorage::Pointer ds)
virtual QmitkDataStorageComboBox * GetTreeNodeSelector()
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
void ImageSelected(const mitk::DataNode *item)
Slot method that will be called if TreeNodeSelector widget was activated.
virtual QGroupBox * GetImageContent()
Method to return the group-box that contains the tree-node-selector.
virtual void Deactivated()
virtual void SetComponentName(QString name)
Method to set the Name of the FunctionalityComponent.
virtual void CreateQtPartControl(QWidget *parent, mitk::DataStorage::Pointer dataStorage)
Method to create the GUI-Object.
QPushButton * GetNextButton()
Method to return the NextButton to switch to the next widgetStackPage.
virtual void UpdateDataTreeComboBoxes()
Method to update the content of all DataTreeComboBoxes.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
const QSizePolicy preferred(QSizePolicy::Preferred, QSizePolicy::Preferred)
virtual void SetSelectorVisibility(bool visibility)
Method to set the Image Selector visible or invisible.
virtual QString GetComponentName()
Method to get the Name of the FunctionalityComponent.
virtual mitk::Image * GetParentMitkImage()
Method to return the Image Selected in the Container Combo Box.
virtual void AddComponent(QmitkFunctionalityComponentContainer *componentContainer)
method to add components into this component.
bool m_ShowSelector
Attribute to decide whether the selector shall be shown or not.
virtual void SetShowTreeNodeSelector(bool show)
Method to set the Tree-Node-Selector visible or not as his parent group-box is set shown or not...
virtual QGroupBox * GetMainCheckBoxContainer()
Method to return the outermost checkable ComboBox that is to decide whether the content shall be show...
virtual void TreeChanged()
void SetWizardText(const QString &text)
Method to create a textLabel at the Top of the wizard where a description can be created.
Image class for storing images.
QPushButton * GetBackButton()
Method to return the BackButton to switch to the last widgetStackPage.
virtual QGroupBox * GetContentContainer()
Method to return the ComboBox that includes all GUI-elements instead of the outermost checkable Check...
virtual ~QmitkFunctionalityComponentContainer()
Destructor.
QmitkFunctionalityComponentContainer(QObject *parent=0, const char *parentName=0, bool updateSelector=true, bool showSelector=true)
Standard-Constructor.
static Pointer New(const char *_arg)
QWidget * GetGUI()
Method to get the GUI of this component.
virtual void SetContentContainerVisibility(bool)
Method to set the "GetContentContainer"-visible or not, addicted to the visibility of a parent-compon...
virtual void CreateConnections()
Method to create all Signale-Slot-Connections.
virtual mitk::DataStorage::Pointer GetDataStorage()
Method to get the DataStorage.
QmitkStdMultiWidget * GetMultiWidget()
void CreateNavigationButtons()
Method to create the forward and backward -buttons to navigate through the wizard.
mitk::DataStorage::Pointer m_DataStorage
Class for nodes of the DataTree.