diff --git a/Modules/SegmentationUI/Qmitk/QmitkMultiLabelSegmentationTreeView.cpp b/Modules/SegmentationUI/Qmitk/QmitkMultiLabelSegmentationTreeView.cpp new file mode 100644 index 0000000000..ac3c50c7e2 --- /dev/null +++ b/Modules/SegmentationUI/Qmitk/QmitkMultiLabelSegmentationTreeView.cpp @@ -0,0 +1,31 @@ +/*============================================================================ + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center (DKFZ) +All rights reserved. + +Use of this source code is governed by a 3-clause BSD license that can be +found in the LICENSE file. + +============================================================================*/ + +#include + +#include + +QmitkMultiLabelSegmentationTreeView::QmitkMultiLabelSegmentationTreeView(QWidget* parent) : QTreeView(parent) +{ +} + +QItemSelectionModel::SelectionFlags QmitkMultiLabelSegmentationTreeView::selectionCommand(const QModelIndex& index, const QEvent* event) const +{ + auto value = index.data(QmitkMultiLabelSegmentationTreeModel::ItemModelRole::LabelValueRole); + if (index.column()!=0 || !value.isValid()) + { + return QItemSelectionModel::NoUpdate; + } + + return QAbstractItemView::selectionCommand(index, event); +} + diff --git a/Modules/SegmentationUI/Qmitk/QmitkMultiLabelSegmentationTreeView.h b/Modules/SegmentationUI/Qmitk/QmitkMultiLabelSegmentationTreeView.h new file mode 100644 index 0000000000..9f4e426494 --- /dev/null +++ b/Modules/SegmentationUI/Qmitk/QmitkMultiLabelSegmentationTreeView.h @@ -0,0 +1,34 @@ +/*============================================================================ + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center (DKFZ) +All rights reserved. + +Use of this source code is governed by a 3-clause BSD license that can be +found in the LICENSE file. + +============================================================================*/ + +#ifndef QMITKMULTILABELSEGMENTATIONTREEVIEW_H +#define QMITKMULTILABELSEGMENTATIONTREEVIEW_H + +#include + +#include + +/* +* @brief This is an inspector that offers a simple list view on a data storage. +*/ +class MITKSEGMENTATIONUI_EXPORT QmitkMultiLabelSegmentationTreeView : public QTreeView +{ + Q_OBJECT + +public: + QmitkMultiLabelSegmentationTreeView(QWidget* parent = nullptr); + +protected: + QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index, const QEvent* event = nullptr) const override; +}; + +#endif // QMITKDATASTORAGELISTINSPECTOR_H