Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
35class vtkMRMLNode;
36class qMRMLNodeAttributeTableViewPrivate;
37class QTableWidgetItem;
38class QItemSelectionModel;
39
40class QMRML_WIDGETS_EXPORT qMRMLNodeAttributeTableView : public QWidget
41{
42 Q_OBJECT
43 QVTK_OBJECT
44
45public:
47 explicit qMRMLNodeAttributeTableView(QWidget* parent = nullptr);
50
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
71public slots:
77
80
82 void setAttribute(const QString& attributeName, const QString& attributeValue);
83
85 void renameAttribute(const QString& oldName, const QString& newName);
86
87protected:
89 QTableWidgetItem* findAttributeNameItem(const QString& attributeName) const;
90
92 QString generateNewAttributeName() const;
93
94protected slots:
97
99 void onAttributeChanged(QTableWidgetItem* changedItem);
100
102
103protected:
104 QScopedPointer<qMRMLNodeAttributeTableViewPrivate> d_ptr;
105
106private:
107 Q_DECLARE_PRIVATE(qMRMLNodeAttributeTableView);
108 Q_DISABLE_COPY(qMRMLNodeAttributeTableView);
109};
110
111#endif
QItemSelectionModel * selectionModel()
Get item selection model (for testing purposes)
void populateAttributeTable()
Populate attribute table according to the inspected node.
void setAttribute(const QString &attributeName, const QString &attributeValue)
Set value of an attribute with a given name.
void onAttributeChanged(QTableWidgetItem *changedItem)
Handles changing of text in a cell (attribute name or value)
QString attributeValue(const QString &attributeName) const
Get value of an attribute with a given name.
void selectItemRange(const int topRow, const int leftColumn, const int bottomRow, const int rightColumn)
Make an item range selected (for testing purposes)
~qMRMLNodeAttributeTableView() override
Destructor.
void removeSelectedAttributes()
Remove selected attributes.
QString generateNewAttributeName() const
Generate the next new attribute name that is added.
QTableWidgetItem * findAttributeNameItem(const QString &attributeName) const
Get table widget item of an attribute name cell containing the given attribute name.
QScopedPointer< qMRMLNodeAttributeTableViewPrivate > d_ptr
QStringList attributes() const
Return lost of names of all attributes in the table.
vtkMRMLNode * inspectedNode()
Get the inspected MRML node.
int attributeCount() const
Return number of attributes (rows) in the table.
void setInspectedNode(vtkMRMLNode *node)
Set the inspected MRML node.
qMRMLNodeAttributeTableView(QWidget *parent=nullptr)
Constructor.
void renameAttribute(const QString &oldName, const QString &newName)
Rename an attribute with a given name.
Abstract Superclass for all specific types of MRML nodes.