Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
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 // -- QT stuff
30 #include <QSpinBox>
31 #include <QSlider>
32 
33 
34 namespace camitk
35 {
39 class SliderSpinBoxWidget : public QWidget {
40  Q_OBJECT
41 
42 public:
44  SliderSpinBoxWidget(QWidget *parent=0);
45 
48 
50  int getValue() const;
51 
53  void setValue(int value);
54 
56  void setRange(int min, int max);
57 
59  void addSingleStep();
60 
62  void subSingleStep();
63 
65  void addPageStep();
66 
68  void subPageStep();
69 
71  QSpinBox * getSpinBox() { return spinBox; }
72 
74  QSlider * getSlider() { return slider; }
75 
76 
77 signals:
81  void valueChanged(int);
82 
83 protected slots:
85  void spinBoxValueChanged(int);
86 
88  void sliderValueChanged(int);
89 
90 private:
92  QSpinBox *spinBox;
93 
95  QSlider *slider;
96 
98  void updateSpinBoxValue(int);
99 
101  void updateSliderValue(int);
102 
103 };
104 
105 }
106 
107 #endif
A utility class to have QSpinBox and QSlider synchronized.
Definition: SliderSpinBoxWidget.h:39
int getValue() const
get the current value
void addPageStep()
add a larger number of natural steps to the value, for information exact number of added step is min(...
void subSingleStep()
substract 1 to the value
QSpinBox * spinBox
the QSpinBox instance
Definition: SliderSpinBoxWidget.h:92
void updateSliderValue(int)
update the slider value (block signals)
QSlider * slider
the QSlider instance
Definition: SliderSpinBoxWidget.h:95
void setValue(int value)
set the value (force)
~SliderSpinBoxWidget()
destructor
void setRange(int min, int max)
set the range
void updateSpinBoxValue(int)
update the spinBox value (block signals)
SliderSpinBoxWidget(QWidget *parent=0)
constructor (have to give the parent widget)
void sliderValueChanged(int)
any change in the slider value is connected to this slot (update the spinBox)
void valueChanged(int)
if the user change the value either in the slider or the spinBox, this signal is emitted with the new...
void addSingleStep()
add 1 to the value
void spinBoxValueChanged(int)
any change in the spinBox value is connected to this slot (update the slider)
QSlider * getSlider()
the QSlider instance
Definition: SliderSpinBoxWidget.h:74
QSpinBox * getSpinBox()
the QSpinBox instance
Definition: SliderSpinBoxWidget.h:71
void subPageStep()
substract a larger number of natural steps to the value, for information exact number of added step i...