24 #include <QHBoxLayout> 28 : QWidgetAction(parent)
35 : QWidgetAction(parent)
46 m_ComponentSlider->setOrientation(Qt::Horizontal);
48 QLabel* componentLabel =
new QLabel(tr(
"Component: "));
49 QHBoxLayout* componentWidgetLayout =
new QHBoxLayout;
50 componentWidgetLayout->setContentsMargins(4, 4, 4, 4);
51 componentWidgetLayout->addWidget(componentLabel);
52 componentWidgetLayout->addWidget(m_ComponentSlider);
53 QLabel* componentValueLabel =
new QLabel();
54 componentWidgetLayout->addWidget(componentValueLabel);
55 connect(m_ComponentSlider, &QmitkNumberPropertySlider::valueChanged, componentValueLabel,
static_cast<void (QLabel::*)(
int)
>(&QLabel::setNum));
57 QWidget* componentWidget =
new QWidget;
58 componentWidget->setLayout(componentWidgetLayout);
60 setDefaultWidget(componentWidget);
62 connect(
this, &QmitkDataNodeComponentAction::changed,
this, &QmitkDataNodeComponentAction::OnActionChanged);
67 if (
nullptr == dataNode)
69 m_ComponentSlider->
SetProperty(static_cast<mitk::IntProperty*>(
nullptr));
76 m_ComponentSlider->
SetProperty(static_cast<mitk::IntProperty*>(
nullptr));
82 int numComponents = 0;
85 if (numComponents <= 1 ||
nullptr == componentProperty)
87 m_ComponentSlider->
SetProperty(static_cast<mitk::IntProperty*>(
nullptr));
96 void QmitkDataNodeComponentAction::OnActionChanged()
mitk::BaseRenderer::Pointer GetBaseRenderer()
Grants access to the base renderer stored for the action. Will return nullptr if renderer was never s...
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
void InitializeWithDataNode(const mitk::DataNode *dataNode) override
void SetProperty(mitk::IntProperty *property)
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
Image class for storing images.
mitk::DataNode::Pointer GetSelectedNode() const
QmitkDataNodeComponentAction(QWidget *parent, berry::IWorkbenchPartSite::Pointer workbenchPartSite)
void InitializeAction() override
Class for nodes of the DataTree.