Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SliderTextWidget.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2014 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_TEXT_WIDGET_H
27 #define SLIDER_TEXT_WIDGET_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 
32 // -- QT stuff
33 #include <QColor>
34 #include <QLabel>
35 #include <QLineEdit>
36 #include <QSlider>
37 
38 
39 namespace camitk
40 {
59 class CAMITK_API SliderTextWidget : public QWidget {
60  Q_OBJECT
61 
62  public:
64  SliderTextWidget(QWidget* parent = 0, Qt::WFlags fl = 0);
65 
68 
70  void setName(const QString &);
71 
75  void init(double min=0.0, double max=100.0, double value=50.0);
76 
78  double getValue() const;
79 
81  void setValue(const double, bool emitValueChanged = false);
82 
83  signals:
84 
86  void valueChanged();
87 
88 
89  protected slots:
91  void returnPressed();
92 
94  void valueChanged(int);
95 
97  void textModified(const QString &);
98 
99  private:
101  void updateSlider();
102 
104  void updateLineEdit();
105 
107  double sliderToValue(const int);
108 
110  int valueToSlider(const double);
111 
113  double value;
114 
116  QColor bgColor;
117 
119  double min;
120 
122  double max;
123 
125  QLabel *label;
126 
128  QLineEdit *lineEdit;
129 
131  QSlider *slider;
132 };
133 
134 inline double SliderTextWidget::getValue() const {
135  return value;
136 }
137 
138 }
139 #endif // SLIDERTEXTWIDGET_H
double max
the max real value
Definition: SliderTextWidget.h:122
QColor bgColor
the line edit bg color
Definition: SliderTextWidget.h:116
Definition: Action.h:40
#define CAMITK_API
Definition: CamiTKAPI.h:49
double getValue() const
Get the current value.
Definition: SliderTextWidget.h:134
QLabel * label
the text label
Definition: SliderTextWidget.h:125
QSlider * slider
the slider
Definition: SliderTextWidget.h:131
This widget allows you to use a slider with a lineedit in a Dialog Box.
Definition: SliderTextWidget.h:59
double value
the current value
Definition: SliderTextWidget.h:113
double min
the min real value
Definition: SliderTextWidget.h:119
QLineEdit * lineEdit
the line edit
Definition: SliderTextWidget.h:128