Choreonoid  1.8
DoubleSpinBox.h
Go to the documentation of this file.
1 #ifndef CNOID_BASE_DOUBLE_SPINBOX_H
2 #define CNOID_BASE_DOUBLE_SPINBOX_H
3 
4 #include <cnoid/Signal>
5 #include <QDoubleSpinBox>
6 #include <cnoid/stdx/optional>
7 #include "exportdecl.h"
8 
9 namespace cnoid {
10 
11 class CNOID_EXPORT DoubleSpinBox : public QDoubleSpinBox
12 {
13 public:
14  DoubleSpinBox(QWidget* parent = nullptr);
15 
16  void setUndoRedoKeyInputEnabled(bool on);
17  bool isUndoRedoKeyInputEnabled() const { return isUndoRedoKeyInputEnabled_; }
18 
19  void setValue(double val);
20 
21  SignalProxy<void(double)> sigValueChanged();
22  SignalProxy<void()> sigEditingFinished();
23  SignalProxy<void()> sigEditingFinishedWithValueChange();
24 
25 protected:
26  void onValueChanged(double value);
27  void onEditingFinished();
28  virtual void keyPressEvent(QKeyEvent* event) override;
29 
30 private:
31  stdx::optional<Signal<void(double)>> sigValueChanged_;
32  stdx::optional<Signal<void()>> sigEditingFinished_;
33  stdx::optional<Signal<void()>> sigEditingFinishedWithValueChange_;
34  bool isSettingValueInternally;
35  bool isUndoRedoKeyInputEnabled_;
36  bool valueChangedByLastUserInput;
37 };
38 
39 }
40 
41 #endif
cnoid::DoubleSpinBox
Definition: DoubleSpinBox.h:11
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Signal
Definition: Signal.h:165
cnoid::DoubleSpinBox::isUndoRedoKeyInputEnabled
bool isUndoRedoKeyInputEnabled() const
Definition: DoubleSpinBox.h:17
cnoid::SignalProxy
Definition: Signal.h:470