]> sigrok.org Git - pulseview.git/blame - pv/prop/double.hpp
AnalogSignal: Make threshold neutral area darker
[pulseview.git] / pv / prop / double.hpp
CommitLineData
b912c99c
JH
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
efdec55a 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
b912c99c
JH
18 */
19
7a01bd36
JH
20#ifndef PULSEVIEW_PV_PROP_DOUBLE_HPP
21#define PULSEVIEW_PV_PROP_DOUBLE_HPP
b912c99c
JH
22
23#include <utility>
b912c99c
JH
24
25#include <boost/optional.hpp>
26
2acdb232 27#include "property.hpp"
b912c99c 28
6f925ba9
UH
29using std::pair;
30
b912c99c
JH
31class QDoubleSpinBox;
32
33namespace pv {
34namespace prop {
35
36class Double : public Property
37{
b1fe148e
JH
38 Q_OBJECT
39
b912c99c 40public:
9a267f8d 41 Double(QString name, QString desc, int decimals, QString suffix,
6f925ba9 42 boost::optional< pair<double, double> > range,
b912c99c 43 boost::optional<double> step,
9b258927
JH
44 Getter getter,
45 Setter setter);
b912c99c 46
c6246dc5 47 virtual ~Double() = default;
f459c540 48
b1fe148e 49 QWidget* get_widget(QWidget *parent, bool auto_commit);
b912c99c
JH
50
51 void commit();
52
e9213170 53private Q_SLOTS:
b1fe148e
JH
54 void on_value_changed(double);
55
b912c99c 56private:
8dbbc7f0
JH
57 const int decimals_;
58 const QString suffix_;
6f925ba9 59 const boost::optional< pair<double, double> > range_;
8dbbc7f0 60 const boost::optional<double> step_;
b912c99c 61
8dbbc7f0 62 QDoubleSpinBox *spin_box_;
b912c99c
JH
63};
64
870ea3db
UH
65} // namespace prop
66} // namespace pv
b912c99c 67
7a01bd36 68#endif // PULSEVIEW_PV_PROP_DOUBLE_HPP