Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLRangeWidget.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 __qMRMLRangeWidget_h
22 #define __qMRMLRangeWidget_h
23 
24 // CTK includes
25 #include <ctkDoubleRangeSlider.h>
26 #include <ctkRangeSlider.h>
27 #include <ctkRangeWidget.h>
28 
29 // qMRML includes
30 #include "qMRMLWidgetsExport.h"
31 
32 class qMRMLRangeSliderPrivate;
33 class qMRMLSpinBox;
34 class vtkMRMLScene;
35 
39 class QMRML_WIDGETS_EXPORT qMRMLRangeWidget : public ctkRangeWidget
40 {
41  Q_OBJECT
42  Q_PROPERTY(QPalette minimumHandlePalette READ minimumHandlePalette WRITE setMinimumHandlePalette)
43  Q_PROPERTY(QPalette maximumHandlePalette READ maximumHandlePalette WRITE setMaximumHandlePalette)
44  Q_PROPERTY(vtkMRMLScene* mrmlScene READ mrmlScene WRITE setMRMLScene)
45  Q_PROPERTY(QString quantity READ quantity WRITE setQuantity)
46 
47 public:
51  explicit qMRMLRangeWidget(QWidget* parent = 0);
52 
53  QPalette minimumHandlePalette()const;
54  QPalette maximumHandlePalette()const;
55 
56  vtkMRMLScene* mrmlScene()const;
57  QString quantity()const;
58 
59 public slots:
61  void setMinimumHandlePalette(const QPalette& palette);
62 
64  void setMaximumHandlePalette(const QPalette& palette);
65 
68  void setQuantity(const QString& baseName);
69 
72  virtual void setMRMLScene(vtkMRMLScene* scene);
73 
74 protected slots:
75  void updateSpinBoxRange(double min, double max);
76  void updateRange();
77  void updateSymmetricMoves(bool symmetric);
78 
79 protected:
80  qMRMLSpinBox* MinSpinBox;
81  qMRMLSpinBox* MaxSpinBox;
82 };
83 
85 class QMRML_WIDGETS_EXPORT qMRMLDoubleRangeSlider : public ctkDoubleRangeSlider
86 {
87  Q_OBJECT;
88 public:
89  qMRMLDoubleRangeSlider(QWidget* parentWidget);
90  QPalette minimumHandlePalette()const;
91  QPalette maximumHandlePalette()const;
92 
93  vtkMRMLScene* mrmlScene()const;
94  QString quantity()const;
95 
96 public slots:
98  void setMinimumHandlePalette(const QPalette& palette);
99 
101  void setMaximumHandlePalette(const QPalette& palette);
102 };
103 
105 class QMRML_WIDGETS_EXPORT qMRMLRangeSlider : public ctkRangeSlider
106 {
107  Q_OBJECT;
108 public:
109  qMRMLRangeSlider(QWidget* parentWidget);
110  virtual ~qMRMLRangeSlider();
111  QPalette minimumHandlePalette()const;
112  QPalette maximumHandlePalette()const;
113 
114 public slots:
116  void setMinimumHandlePalette(const QPalette& palette);
117 
119  void setMaximumHandlePalette(const QPalette& palette);
120 protected:
121  virtual void initMinimumSliderStyleOption(QStyleOptionSlider* option) const;
122  virtual void initMaximumSliderStyleOption(QStyleOptionSlider* option) const;
123 
124 protected:
125  QScopedPointer<qMRMLRangeSliderPrivate> d_ptr;
126 
127 private:
128  Q_DECLARE_PRIVATE(qMRMLRangeSlider);
129  Q_DISABLE_COPY(qMRMLRangeSlider);
130 };
131 
132 #endif
QScopedPointer< qMRMLRangeSliderPrivate > d_ptr
Extend the ctkDoubleSpinBox to integrate units support.
Definition: qMRMLSpinBox.h:55
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
qMRMLDoubleRangeSlider is a wrapper around a ctkDoubleRangeSlider
qMRMLRangeSlider is a wrapper around a ctkRangeSlider