Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLColorPickerWidget.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 Julien Finet, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLColorPickerWidget_h
22 #define __qMRMLColorPickerWidget_h
23 
24 // Qt include
25 #include <QModelIndex>
26 
27 // qMRML includes
28 #include "qMRMLWidget.h"
29 #include "qMRMLWidgetsExport.h"
30 
31 // CTK includes
32 #include <ctkVTKObject.h>
33 
34 class qMRMLColorPickerWidgetPrivate;
35 class vtkMRMLNode;
36 class vtkMRMLColorNode;
37 class vtkMRMLColorLogic;
38 
41 class QMRML_WIDGETS_EXPORT qMRMLColorPickerWidget : public qMRMLWidget
42 {
43  Q_OBJECT
44  QVTK_OBJECT
45 public:
46  qMRMLColorPickerWidget(QWidget *parent=nullptr);
47  ~qMRMLColorPickerWidget() override;
48 
51  Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic* colorLogic);
52  Q_INVOKABLE vtkMRMLColorLogic* mrmlColorLogic()const;
53 
54  Q_INVOKABLE vtkMRMLColorNode* currentColorNode()const;
55 
56  void setMRMLScene(vtkMRMLScene* scene) override;
57  bool eventFilter(QObject* target, QEvent* event) override;
58 
59 public slots:
60  void setCurrentColorNode(vtkMRMLNode* node);
61  void setCurrentColorNodeToDefault();
62 
63 signals:
65  void currentColorNodeChanged(vtkMRMLNode* node);
66 
69  void colorEntrySelected(int index);
70 
72  void colorSelected(const QColor& color);
73 
76  void colorNameSelected(const QString& name);
77 
78 protected slots:
79  void onNodeAdded(vtkObject*, vtkObject*);
80  void onCurrentColorNodeChanged(vtkMRMLNode* node);
81  void onTextChanged(const QString& colorText);
82 
83 protected:
84  QScopedPointer<qMRMLColorPickerWidgetPrivate> d_ptr;
85 
86 private:
87  Q_DECLARE_PRIVATE(qMRMLColorPickerWidget);
88  Q_DISABLE_COPY(qMRMLColorPickerWidget);
89 };
90 
91 #endif
MRML logic class for color manipulation.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
QScopedPointer< qMRMLColorPickerWidgetPrivate > d_ptr
Base class for any widget that requires a MRML Scene.
Definition: qMRMLWidget.h:35
Abstract MRML node to represent color information.
virtual void setMRMLScene(vtkMRMLScene *newScene)
Set the MRML scene associated with the widget.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167