Slicer 4.2
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.
00001 /*==============================================================================
00002 
00003   Program: 3D Slicer
00004 
00005   Copyright (c) Kitware Inc.
00006 
00007   See COPYRIGHT.txt
00008   or http://www.slicer.org/copyright/copyright.txt for details.
00009 
00010   Unless required by applicable law or agreed to in writing, software
00011   distributed under the License is distributed on an "AS IS" BASIS,
00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013   See the License for the specific language governing permissions and
00014   limitations under the License.
00015 
00016   This file was originally developed by Csaba Pinter, PerkLab, Queen's University
00017   and was supported through the Applied Cancer Research Unit program of Cancer Care
00018   Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
00019 
00020 ==============================================================================*/
00021 
00022 #ifndef __qMRMLNodeAttributeTableView_h
00023 #define __qMRMLNodeAttributeTableView_h
00024 
00025 // Qt includes
00026 #include <QWidget>
00027 
00028 // DataWidgets includes
00029 #include "qSlicerDataModuleWidgetsExport.h"
00030 
00031 // CTK includes
00032 #include <ctkPimpl.h>
00033 #include <ctkVTKObject.h>
00034 
00035 class vtkMRMLNode;
00036 class qMRMLNodeAttributeTableViewPrivate;
00037 class QTableWidgetItem;
00038 class QItemSelectionModel;
00039 
00040 class Q_SLICER_MODULE_DATA_WIDGETS_EXPORT qMRMLNodeAttributeTableView : public QWidget
00041 {
00042   Q_OBJECT
00043   QVTK_OBJECT
00044 
00045 public:
00047   explicit qMRMLNodeAttributeTableView(QWidget* parent = 0);
00049   virtual ~qMRMLNodeAttributeTableView();
00050 
00052   void setInspectedNode(vtkMRMLNode* node);
00054   vtkMRMLNode* inspectedNode();
00055 
00057   int attributeCount() const;
00058 
00060   QStringList attributes() const;
00061 
00063   QString attributeValue(const QString& attributeName) const;
00064 
00066   void selectItemRange(const int topRow, const int leftColumn, const int bottomRow, const int rightColumn);
00067 
00069   QItemSelectionModel* selectionModel();
00070 
00071 public slots:
00076   void addAttribute();
00077 
00079   void removeSelectedAttributes();
00080 
00082   void setAttribute(const QString& attributeName, const QString& attributeValue);
00083 
00085   void renameAttribute(const QString& oldName, const QString& newName);
00086 
00087 protected:
00089   QTableWidgetItem* findAttributeNameItem(const QString& attributeName) const;
00090 
00092   QString generateNewAttributeName() const;
00093 
00094 protected slots:
00096   void populateAttributeTable();
00097 
00099   void onAttributeChanged(QTableWidgetItem* changedItem);
00100 
00102   void storeSelectedAttributeTableItem(QTableWidgetItem* selectedItem, QTableWidgetItem* previousItem);
00103 
00104 protected:
00105   QScopedPointer<qMRMLNodeAttributeTableViewPrivate> d_ptr;
00106 
00107 private:
00108   Q_DECLARE_PRIVATE(qMRMLNodeAttributeTableView);
00109   Q_DISABLE_COPY(qMRMLNodeAttributeTableView);
00110 };
00111 
00112 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines