Computer Assited Medical Intervention Tool Kit  version 5.0
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-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, 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
camitk::SliderSpinBoxWidget::addSingleStep
void addSingleStep()
add 1 to the value
Definition: SliderSpinBoxWidget.cpp:159
camitk::SliderSpinBoxWidget::addPageStep
void addPageStep()
add a larger number of natural steps to the value, for information exact number of added step is min(...
Definition: SliderSpinBoxWidget.cpp:180
camitk::SliderSpinBoxWidget::spinBox
QSpinBox * spinBox
the QSpinBox instance
Definition: SliderSpinBoxWidget.h:148
CamiTKAPI.h
camitk::SliderSpinBoxWidget::setValue
void setValue(int value)
set the value (force)
Definition: SliderSpinBoxWidget.cpp:90
getValue
static Value getValue(const QMap< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())
Definition: qtpropertymanager.cpp:222
camitk::SliderSpinBoxWidget::getValue
int getValue() const
get the current value
Definition: SliderSpinBoxWidget.cpp:85
camitk::SliderSpinBoxWidget::slider
QSlider * slider
the QSlider instance
Definition: SliderSpinBoxWidget.h:151
camitk::SliderSpinBoxWidget::setRange
void setRange(int min, int max)
set the range
Definition: SliderSpinBoxWidget.cpp:98
camitk::SliderSpinBoxWidget::valueChanged
void valueChanged(int)
if the user change the value either in the slider or the spinBox, this signal is emitted with the new...
camitk::SliderSpinBoxWidget::subSingleStep
void subSingleStep()
subtract 1 to the value
Definition: SliderSpinBoxWidget.cpp:169
camitk::SliderSpinBoxWidget::updateSliderValue
void updateSliderValue(int)
update the slider value (block signals)
Definition: SliderSpinBoxWidget.cpp:142
camitk::SliderSpinBoxWidget::sliderValueChanged
void sliderValueChanged(int)
any change in the slider value is connected to this slot (update the spinBox)
Definition: SliderSpinBoxWidget.cpp:120
SliderSpinBoxWidget.h
camitk::setObjectName
setObjectName("RendererWidget")
camitk::SliderSpinBoxWidget::SliderSpinBoxWidget
SliderSpinBoxWidget(QWidget *parent=nullptr)
constructor (have to give the parent widget)
Definition: SliderSpinBoxWidget.cpp:59
camitk::SliderSpinBoxWidget::subPageStep
void subPageStep()
subtract a larger number of natural steps to the value, for information exact number of added step is...
Definition: SliderSpinBoxWidget.cpp:190
camitk::SliderSpinBoxWidget::updateSpinBoxValue
void updateSpinBoxValue(int)
update the spinBox value (block signals)
Definition: SliderSpinBoxWidget.cpp:126
camitk::SliderSpinBoxWidget::spinBoxValueChanged
void spinBoxValueChanged(int)
any change in the spinBox value is connected to this slot (update the slider)
Definition: SliderSpinBoxWidget.cpp:114
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:49
camitk
Definition: Action.cpp:35