Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkPropertiesTableEditor.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
16 #include "QmitkPropertyDelegate.h"
17 
18 #include "mitkBaseRenderer.h"
19 
20 #include <QHBoxLayout>
21 #include <QHeaderView>
22 #include <QLabel>
23 #include <QLineEdit>
24 #include <QTableView>
25 #include <QVBoxLayout>
26 
27 #include <vtkRenderWindow.h>
28 
30  Qt::WindowFlags f,
31  mitk::DataNode::Pointer /*_Node*/)
32  : QWidget(parent, f), m_NodePropertiesTableView(nullptr), m_Model(nullptr)
33 {
34  // set up empty gui elements
35  this->init();
36 
37  // set up model
40 }
41 
43 {
44 }
45 
47 {
48  if (_List.IsNotNull())
49  {
50  m_Model->SetPropertyList(_List);
51  m_NodePropertiesTableView->resizeColumnsToContents();
52  m_NodePropertiesTableView->resizeRowsToContents();
53  m_NodePropertiesTableView->horizontalHeader()->setStretchLastSection(true);
54  m_NodePropertiesTableView->setEditTriggers(QAbstractItemView::CurrentChanged);
55  }
56  else
57  {
58  m_Model->SetPropertyList(nullptr);
59  }
60 }
61 
63 {
64  return m_Model;
65 }
66 
68 {
69  // read/ dim
70  QVBoxLayout *_NodePropertiesLayout = new QVBoxLayout;
71  QWidget *_PropertyFilterKeyWordPane = new QWidget(QWidget::parentWidget());
72  QHBoxLayout *_PropertyFilterKeyWordLayout = new QHBoxLayout;
73  QLabel *_LabelPropertyFilterKeyWord = new QLabel("Filter: ", _PropertyFilterKeyWordPane);
74  m_TxtPropertyFilterKeyWord = new QLineEdit(_PropertyFilterKeyWordPane);
75  m_NodePropertiesTableView = new QTableView(QWidget::parentWidget());
76 
77  // write
78  setLayout(_NodePropertiesLayout);
79 
80  _PropertyFilterKeyWordPane->setLayout(_PropertyFilterKeyWordLayout);
81 
82  _PropertyFilterKeyWordLayout->setMargin(0);
83  _PropertyFilterKeyWordLayout->addWidget(_LabelPropertyFilterKeyWord);
84  _PropertyFilterKeyWordLayout->addWidget(m_TxtPropertyFilterKeyWord);
85 
86  _NodePropertiesLayout->setMargin(0);
87  _NodePropertiesLayout->addWidget(_PropertyFilterKeyWordPane);
88  _NodePropertiesLayout->addWidget(m_NodePropertiesTableView);
89 
90  m_NodePropertiesTableView->setSelectionMode(QAbstractItemView::SingleSelection);
91  m_NodePropertiesTableView->setSelectionBehavior(QAbstractItemView::SelectItems);
92  m_NodePropertiesTableView->verticalHeader()->hide();
93  m_NodePropertiesTableView->setItemDelegate(new QmitkPropertyDelegate(this));
94  m_NodePropertiesTableView->setAlternatingRowColors(true);
95  m_NodePropertiesTableView->setSortingEnabled(true);
96  m_NodePropertiesTableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
97 
98  QObject::connect(m_TxtPropertyFilterKeyWord,
99  SIGNAL(textChanged(const QString &)),
100  this,
101  SLOT(PropertyFilterKeyWordTextChanged(const QString &)));
102 }
103 
105 {
107 }
108 
110 {
112 }
virtual void SetFilterPropertiesKeyWord(std::string _FilterKeyWord)
Set a keyword for filtering of properties. Only properties beginning with this string will be shown...
void SetPropertyList(mitk::PropertyList::Pointer _List)
QmitkPropertiesTableModel * getModel() const
void PropertyFilterKeyWordTextChanged(const QString &text)
QmitkPropertiesTableModel * m_Model
void SetPropertyList(mitk::PropertyList *_PropertyList)
~QmitkPropertiesTableEditor() override
Standard dtor. Nothing to do here.
QmitkPropertiesTableEditor(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr, mitk::DataNode::Pointer _Node=nullptr)