Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLTableView.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright 2015 Brigham and Women's Hospital (BWH) All Rights Reserved.
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 Andras Lasso (PerkLab, Queen's
17  University) and Kevin Wang (Princess Margaret Hospital, Toronto) and was
18  supported through OCAIRO and the Applied Cancer Research Unit program of
19  Cancer Care Ontario.
20 
21 ==============================================================================*/
22 
23 #ifndef __qMRMLTableView_h
24 #define __qMRMLTableView_h
25 
26 // Qt includes
27 #include <QTableView>
28 
29 // qMRML includes
30 #include "qMRMLWidgetsExport.h"
31 
32 class QSortFilterProxyModel;
33 class qMRMLTableViewPrivate;
34 class qMRMLTableModel;
35 class vtkMRMLNode;
36 class vtkMRMLScene;
37 class vtkMRMLTableNode;
39 
42 class QMRML_WIDGETS_EXPORT qMRMLTableView : public QTableView
43 {
44  Q_OBJECT
45  Q_PROPERTY(bool transposed READ transposed WRITE setTransposed)
46  Q_PROPERTY(bool firstRowLocked READ firstRowLocked WRITE setFirstRowLocked)
47  Q_PROPERTY(bool firstColumnLocked READ firstColumnLocked WRITE setFirstColumnLocked)
48 public:
49  qMRMLTableView(QWidget *parent=nullptr);
50  ~qMRMLTableView() override;
51 
53  Q_INVOKABLE vtkMRMLScene* mrmlScene() const;
54 
56  Q_INVOKABLE vtkMRMLTableViewNode* mrmlTableViewNode()const;
57 
58  Q_INVOKABLE vtkMRMLTableNode* mrmlTableNode()const;
59 
60  Q_INVOKABLE qMRMLTableModel* tableModel()const;
61  Q_INVOKABLE QSortFilterProxyModel* sortFilterProxyModel()const;
62 
63  bool transposed()const;
64  bool firstRowLocked()const;
65  bool firstColumnLocked()const;
66 
67  QList<int> selectedMRMLTableColumnIndices()const;
68 
69 public slots:
73  void setMRMLScene(vtkMRMLScene* newScene);
74 
76  void setMRMLTableViewNode(vtkMRMLTableViewNode* newTableViewNode);
77 
78  void setMRMLTableNode(vtkMRMLTableNode* tableNode);
80  void setMRMLTableNode(vtkMRMLNode* tableNode);
81 
85  void setTransposed(bool transposed);
86 
87  void setFirstRowLocked(bool locked);
88  void setFirstColumnLocked(bool locked);
89 
90  void copySelection();
91  void pasteSelection();
92  void plotSelection();
93 
94  void insertRow();
95  void insertColumn();
96 
97  void deleteRow();
98  void deleteColumn();
99 
100 signals:
101 
105  void mrmlSceneChanged(vtkMRMLScene*);
106 
108  void selectionChanged();
109 
110 protected:
111  void keyPressEvent(QKeyEvent* event) override;
112 
113  QScopedPointer<qMRMLTableViewPrivate> d_ptr;
114 
115  void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) override;
116 
117 private:
118  Q_DECLARE_PRIVATE(qMRMLTableView);
119  Q_DISABLE_COPY(qMRMLTableView);
120 };
121 
122 #endif
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
MRML node to represent table view parameters.
Spreadsheet view for table nodes. Allow view/edit of a vtkMRMLTableNode.
MRML node to represent a table object.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167