Slicer  5.3
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 = nullptr);
52 
53  QPalette minimumHandlePalette()const;
54  QPalette maximumHandlePalette()const;
55 
56  vtkMRMLScene* mrmlScene()const;
57  QString quantity()const;
58 
61  void setSymmetricMoves(bool symmetry) override;
62 
63 public slots:
65  void setMinimumHandlePalette(const QPalette& palette);
66 
68  void setMaximumHandlePalette(const QPalette& palette);
69 
72  void setQuantity(const QString& baseName);
73 
76  virtual void setMRMLScene(vtkMRMLScene* scene);
77 
78 protected slots:
79  void updateSpinBoxRange(double min, double max);
80  void updateRange();
81  void updateSymmetricMoves(bool symmetric);
82 
83 protected:
84  qMRMLSpinBox* MinSpinBox;
85  qMRMLSpinBox* MaxSpinBox;
86  QAction* SymmetricAction;
87 };
88 
90 class QMRML_WIDGETS_EXPORT qMRMLDoubleRangeSlider : public ctkDoubleRangeSlider
91 {
92  Q_OBJECT;
93 public:
94  qMRMLDoubleRangeSlider(QWidget* parentWidget);
95  QPalette minimumHandlePalette()const;
96  QPalette maximumHandlePalette()const;
97 
98  vtkMRMLScene* mrmlScene()const;
99  QString quantity()const;
100 
101 public slots:
103  void setMinimumHandlePalette(const QPalette& palette);
104 
106  void setMaximumHandlePalette(const QPalette& palette);
107 };
108 
110 class QMRML_WIDGETS_EXPORT qMRMLRangeSlider : public ctkRangeSlider
111 {
112  Q_OBJECT;
113 public:
114  qMRMLRangeSlider(QWidget* parentWidget);
115  ~qMRMLRangeSlider() override;
116  QPalette minimumHandlePalette()const;
117  QPalette maximumHandlePalette()const;
118 
119 public slots:
121  void setMinimumHandlePalette(const QPalette& palette);
122 
124  void setMaximumHandlePalette(const QPalette& palette);
125 protected:
126  void initMinimumSliderStyleOption(QStyleOptionSlider* option) const override;
127  void initMaximumSliderStyleOption(QStyleOptionSlider* option) const override;
128 
129 protected:
130  QScopedPointer<qMRMLRangeSliderPrivate> d_ptr;
131 
132 private:
133  Q_DECLARE_PRIVATE(qMRMLRangeSlider);
134  Q_DISABLE_COPY(qMRMLRangeSlider);
135 };
136 
137 #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:57
qMRMLDoubleRangeSlider is a wrapper around a ctkDoubleRangeSlider
qMRMLRangeSlider is a wrapper around a ctkRangeSlider