QtPdWidgets  2.3.1
DoubleSpinBox.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009 Florian Pose <fp@igh-essen.com>
4  *
5  * This file is part of the QtPdWidgets library.
6  *
7  * The QtPdWidgets library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The QtPdWidgets library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdWidgets Library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef PD_DOUBLESPINBOX_H
24 #define PD_DOUBLESPINBOX_H
25 
26 #include <QDoubleSpinBox>
27 
28 #include "Export.h"
29 #include <QtPdCom1/ScalarSubscriber.h>
30 
31 namespace Pd {
32 
33 /****************************************************************************/
34 
38  public QDoubleSpinBox, public QtPdCom::ScalarSubscriber
39 {
40  Q_OBJECT
41 
42  // re-define properties to react on limit changes
43  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
44  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
45 
46  public:
47  DoubleSpinBox(QWidget *parent = 0);
48  virtual ~DoubleSpinBox();
49 
50  void clearData(); // pure-virtual from ScalarSubscriber
51 
52  // from DoubleSpinBox
53  void setMinimum(double);
54  void setMaximum(double);
55 
56  private slots:
57  PD_PRIVATE void on_textChanged(const QString &);
58  PD_PRIVATE void on_editingFinished();
59 
60  private:
61  struct PD_PRIVATE Impl;
62  std::unique_ptr<Impl> impl;
63 
64  PD_PRIVATE void keyPressEvent(QKeyEvent *) override;
65  PD_PRIVATE void stepBy(int) override; // virtual from QAbstractSpinBox
66 
67  PD_PRIVATE void newValues(std::chrono::nanoseconds) override;
68 };
69 
70 /****************************************************************************/
71 
72 } // namespace
73 
74 #endif
Definition: Bar.h:36
#define PD_PRIVATE
Definition: Export.h:28
Definition: DoubleSpinBox.cpp:31
Spinbox containing a double value.
Definition: DoubleSpinBox.h:37
#define PD_PUBLIC
Definition: Export.h:33