]> sigrok.org Git - pulseview.git/blame - pv/prop/double.hpp
Build fixes for Qt5 Windows/mingw/MXE support.
[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
JH
28
29class QDoubleSpinBox;
30
31namespace pv {
32namespace prop {
33
34class Double : public Property
35{
b1fe148e
JH
36 Q_OBJECT
37
b912c99c
JH
38public:
39 Double(QString name, int decimals, QString suffix,
40 boost::optional< std::pair<double, double> > range,
41 boost::optional<double> step,
9b258927
JH
42 Getter getter,
43 Setter setter);
b912c99c 44
c6246dc5 45 virtual ~Double() = default;
f459c540 46
b1fe148e 47 QWidget* get_widget(QWidget *parent, bool auto_commit);
b912c99c
JH
48
49 void commit();
50
e9213170 51private Q_SLOTS:
b1fe148e
JH
52 void on_value_changed(double);
53
b912c99c 54private:
8dbbc7f0
JH
55 const int decimals_;
56 const QString suffix_;
57 const boost::optional< std::pair<double, double> > range_;
58 const boost::optional<double> step_;
b912c99c 59
8dbbc7f0 60 QDoubleSpinBox *spin_box_;
b912c99c
JH
61};
62
63} // prop
64} // pv
65
7a01bd36 66#endif // PULSEVIEW_PV_PROP_DOUBLE_HPP