Computer Assisted Medical Intervention Tool Kit  version 5.2
SliderSpinBoxWidget.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef SLIDER_SPIN_BOX_WIDGET_H
27 #define SLIDER_SPIN_BOX_WIDGET_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 
32 // -- QT stuff
33 #include <QSpinBox>
34 #include <QSlider>
35 
36 
37 namespace camitk {
45 class CAMITK_API SliderSpinBoxWidget : public QWidget {
46  Q_OBJECT
47 
48 public:
50  SliderSpinBoxWidget(QWidget* parent = nullptr);
51 
53  ~SliderSpinBoxWidget() override = default;
54 
56  int getValue() const;
57 
59  void setValue(int value);
60 
62  void setRange(int min, int max);
63 
65  void addSingleStep();
66 
68  void subSingleStep();
69 
71  void addPageStep();
72 
74  void subPageStep();
75 
77  QSpinBox* getSpinBox() {
78  return spinBox;
79  }
80 
82  QSlider* getSlider() {
83  return slider;
84  }
85 
86 
87 signals:
91  void valueChanged(int);
92 
93 protected slots:
95  void spinBoxValueChanged(int);
96 
98  void sliderValueChanged(int);
99 
100 private:
102  QSpinBox* spinBox;
103 
105  QSlider* slider;
106 
108  void updateSpinBoxValue(int);
109 
111  void updateSliderValue(int);
112 
113 };
114 
115 }
116 
117 #endif
#define CAMITK_API
Definition: CamiTKAPI.h:49
A utility class to have QSpinBox and QSlider synchronized.
Definition: SliderSpinBoxWidget.h:45
void valueChanged(int)
if the user change the value either in the slider or the spinBox, this signal is emitted with the new...
~SliderSpinBoxWidget() override=default
destructor
QSpinBox * getSpinBox()
the QSpinBox instance
Definition: SliderSpinBoxWidget.h:77
QSlider * getSlider()
the QSlider instance
Definition: SliderSpinBoxWidget.h:82
Definition: Action.cpp:36
static Value getValue(const QMap< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())
Definition: qtpropertymanager.cpp:222