Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLNodeAttributeTableView.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
17  and was supported through the Applied Cancer Research Unit program of Cancer Care
18  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
19 
20 ==============================================================================*/
21 
22 #ifndef __qMRMLNodeAttributeTableView_h
23 #define __qMRMLNodeAttributeTableView_h
24 
25 // Qt includes
26 #include <QWidget>
27 
28 // MRMLWidgets includes
29 #include "qMRMLWidgetsExport.h"
30 
31 // CTK includes
32 #include <ctkPimpl.h>
33 #include <ctkVTKObject.h>
34 
35 class vtkMRMLNode;
36 class qMRMLNodeAttributeTableViewPrivate;
37 class QTableWidgetItem;
38 class QItemSelectionModel;
39 
40 class QMRML_WIDGETS_EXPORT qMRMLNodeAttributeTableView : public QWidget
41 {
42  Q_OBJECT
43  QVTK_OBJECT
44 
45 public:
47  explicit qMRMLNodeAttributeTableView(QWidget* parent = 0);
49  virtual ~qMRMLNodeAttributeTableView();
50 
52  void setInspectedNode(vtkMRMLNode* node);
54  vtkMRMLNode* inspectedNode();
55 
57  int attributeCount() const;
58 
60  QStringList attributes() const;
61 
63  QString attributeValue(const QString& attributeName) const;
64 
66  void selectItemRange(const int topRow, const int leftColumn, const int bottomRow, const int rightColumn);
67 
69  QItemSelectionModel* selectionModel();
70 
71 public slots:
76  void addAttribute();
77 
79  void removeSelectedAttributes();
80 
82  void setAttribute(const QString& attributeName, const QString& attributeValue);
83 
85  void renameAttribute(const QString& oldName, const QString& newName);
86 
87 protected:
89  QTableWidgetItem* findAttributeNameItem(const QString& attributeName) const;
90 
92  QString generateNewAttributeName() const;
93 
94 protected slots:
96  void populateAttributeTable();
97 
99  void onAttributeChanged(QTableWidgetItem* changedItem);
100 
102  void storeSelectedAttributeTableItem(QTableWidgetItem* selectedItem, QTableWidgetItem* previousItem);
103 
104 protected:
105  QScopedPointer<qMRMLNodeAttributeTableViewPrivate> d_ptr;
106 
107 private:
108  Q_DECLARE_PRIVATE(qMRMLNodeAttributeTableView);
109  Q_DISABLE_COPY(qMRMLNodeAttributeTableView);
110 };
111 
112 #endif
QScopedPointer< qMRMLNodeAttributeTableViewPrivate > d_ptr
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135