Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
20 #include "QmitkPropertyDelegate.h"
21 
22 #include "mitkBaseRenderer.h"
23 
24 #include <QHBoxLayout>
25 #include <QHeaderView>
26 #include <QLabel>
27 #include <QLineEdit>
28 #include <QTableView>
29 #include <QVBoxLayout>
30 
31 #include <vtkRenderWindow.h>
32 
34  Qt::WindowFlags f,
35  mitk::DataNode::Pointer /*_Node*/)
36  : QWidget(parent, f), m_NodePropertiesTableView(0), m_Model(0)
37 {
38  // set up empty gui elements
39  this->init();
40 
41  // set up model
44 }
45 
47 {
48 }
49 
51 {
52  if (_List.IsNotNull())
53  {
54  m_Model->SetPropertyList(_List);
55  m_NodePropertiesTableView->resizeColumnsToContents();
56  m_NodePropertiesTableView->resizeRowsToContents();
57  m_NodePropertiesTableView->horizontalHeader()->setStretchLastSection(true);
58  m_NodePropertiesTableView->setEditTriggers(QAbstractItemView::CurrentChanged);
59  }
60  else
61  {
63  }
64 }
65 
67 {
68  return m_Model;
69 }
70 
72 {
73  // read/ dim
74  QVBoxLayout *_NodePropertiesLayout = new QVBoxLayout;
75  QWidget *_PropertyFilterKeyWordPane = new QWidget(QWidget::parentWidget());
76  QHBoxLayout *_PropertyFilterKeyWordLayout = new QHBoxLayout;
77  QLabel *_LabelPropertyFilterKeyWord = new QLabel("Filter: ", _PropertyFilterKeyWordPane);
78  m_TxtPropertyFilterKeyWord = new QLineEdit(_PropertyFilterKeyWordPane);
79  m_NodePropertiesTableView = new QTableView(QWidget::parentWidget());
80 
81  // write
82  setLayout(_NodePropertiesLayout);
83 
84  _PropertyFilterKeyWordPane->setLayout(_PropertyFilterKeyWordLayout);
85 
86  _PropertyFilterKeyWordLayout->setMargin(0);
87  _PropertyFilterKeyWordLayout->addWidget(_LabelPropertyFilterKeyWord);
88  _PropertyFilterKeyWordLayout->addWidget(m_TxtPropertyFilterKeyWord);
89 
90  _NodePropertiesLayout->setMargin(0);
91  _NodePropertiesLayout->addWidget(_PropertyFilterKeyWordPane);
92  _NodePropertiesLayout->addWidget(m_NodePropertiesTableView);
93 
94  m_NodePropertiesTableView->setSelectionMode(QAbstractItemView::SingleSelection);
95  m_NodePropertiesTableView->setSelectionBehavior(QAbstractItemView::SelectItems);
96  m_NodePropertiesTableView->verticalHeader()->hide();
97  m_NodePropertiesTableView->setItemDelegate(new QmitkPropertyDelegate(this));
98  m_NodePropertiesTableView->setAlternatingRowColors(true);
99  m_NodePropertiesTableView->setSortingEnabled(true);
100  m_NodePropertiesTableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
101 
102  QObject::connect(m_TxtPropertyFilterKeyWord,
103  SIGNAL(textChanged(const QString &)),
104  this,
105  SLOT(PropertyFilterKeyWordTextChanged(const QString &)));
106 }
107 
109 {
111 }
112 
114 {
116 }
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)
void PropertyFilterKeyWordTextChanged(const QString &text)
QmitkPropertiesTableModel * getModel() const
QmitkPropertiesTableModel * m_Model
QmitkPropertiesTableEditor(QWidget *parent=0, Qt::WindowFlags f=0, mitk::DataNode::Pointer _Node=0)
void SetPropertyList(mitk::PropertyList *_PropertyList)
virtual ~QmitkPropertiesTableEditor()
Standard dtor. Nothing to do here.