iRoCS Toolbox  1.1.0
DoubleControlElement.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef DOUBLECONTROLELEMENT_HH
26 #define DOUBLECONTROLELEMENT_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
33 
34 class QDoubleSpinBox;
35 class QSlider;
36 
38 {
39 
40  Q_OBJECT
41 
42 public:
43 
45  const QString& label, const double value = -1, QWidget* parent = 0);
47 
48  bool sliderViewEnabled() const;
49  void setSliderViewEnabled(bool enable);
50 
51  void setRange(const double min, const double max);
52  void setSingleStep(const double step);
53 
54 /*======================================================================*/
62 /*======================================================================*/
63  void setSpecialValueText(QString const &text);
64 
65 /*======================================================================*/
71 /*======================================================================*/
72  void setSuffix(QString const &text);
73 
74  double value() const;
75  std::string toStdString() const;
76 
77 signals:
78 
79  void valueChanged(double);
80 
81 public slots:
82 
83  void setValue(const double& value);
84  void setValue(const std::string& value);
85 
86 private slots:
87 
88  void updateSpinBox(int value);
89  void updateSlider(double value);
90 
91 private:
92 
93  QDoubleSpinBox* p_spinbox;
94  QSlider* p_slider;
95 
96 };
97 
98 #endif
void setValue(const double &value)
void setSingleStep(const double step)
void setRange(const double min, const double max)
DoubleControlElement(const QString &label, const double value=-1, QWidget *parent=0)
bool sliderViewEnabled() const
Abstract horizontally layouted control element consisting of a label, the control widget(s) and a che...
double value() const
std::string toStdString() const
void setSliderViewEnabled(bool enable)
QString label() const
void setSpecialValueText(QString const &text)
If specified, the given text is shown if the spin box is at its minimum value instead of that value...
void setSuffix(QString const &text)
If specified, the given text is appended to the value in the spinbox.