Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLLabelComboBox.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 Johan Andruejol, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLLabelComboBox_h
22 #define __qMRMLLabelComboBox_h
23 
24 // CTK includes
25 #include <ctkPimpl.h>
26 #include <ctkVTKObject.h>
27 
28 // qMRML includes
29 #include "qMRMLWidgetsExport.h"
30 #include "qMRMLWidget.h"
31 
32 class vtkMRMLNode;
33 class vtkMRMLColorNode;
34 class qMRMLLabelComboBoxPrivate;
35 
36 class QMRML_WIDGETS_EXPORT qMRMLLabelComboBox : public qMRMLWidget
37 {
38  Q_OBJECT
39  QVTK_OBJECT
40  Q_PROPERTY(bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
41  Q_PROPERTY(int currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged USER true)
42  Q_PROPERTY(QString currentColorName READ currentColorName WRITE setCurrentColor NOTIFY currentColorChanged STORED false)
43  Q_PROPERTY(int maximumColorCount READ maximumColorCount WRITE setMaximumColorCount)
44  Q_PROPERTY(bool colorNameVisible READ colorNameVisible WRITE setColorNameVisible)
45  Q_PROPERTY(bool labelValueVisible READ labelValueVisible WRITE setLabelValueVisible)
46 
47 public:
48 
50 
53  explicit qMRMLLabelComboBox(QWidget* newParent = nullptr);
54  ~qMRMLLabelComboBox() override;
55 
58  bool noneEnabled()const;
59  void setNoneEnabled(bool enable);
60 
62  bool colorNameVisible() const;
63  void setColorNameVisible(bool visible);
64 
66  bool labelValueVisible() const;
67  void setLabelValueVisible(bool visible);
68 
69  virtual void printAdditionalInfo();
70 
71  vtkMRMLColorNode* mrmlColorNode()const;
72 
73  int currentColor()const;
74  QString currentColorName()const;
75 
76  int maximumColorCount()const;
77  void setMaximumColorCount(int maximum);
78 
79 public slots:
80 
81  void setMRMLColorNode(vtkMRMLNode * newMRMLColorNode);
82 
83  void setCurrentColor(int index);
84  void setCurrentColor(const QString& colorName);
85 
86  void updateWidgetFromMRML();
87 
88 signals:
89 
90  void currentColorChanged(const QColor& color);
91  void currentColorChanged(const QString& name);
92  void currentColorChanged(int index);
93 
94 private slots:
95 
96  void onCurrentIndexChanged(int index);
97 
98 protected:
99  QScopedPointer<qMRMLLabelComboBoxPrivate> d_ptr;
100 private:
101  Q_DECLARE_PRIVATE(qMRMLLabelComboBox);
102  Q_DISABLE_COPY(qMRMLLabelComboBox);
103 };
104 
105 #endif
Base class for any widget that requires a MRML Scene.
Definition: qMRMLWidget.h:35
Abstract MRML node to represent color information.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167