fw4spl
SSlider.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2015-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "guiQt/config.hpp"
10 
11 #include <fwCom/Slot.hpp>
12 #include <fwCom/Slots.hpp>
13 
14 #include <fwGui/editor/IEditor.hpp>
15 
16 #include <fwTools/Failed.hpp>
17 
18 #include <QLabel>
19 #include <QLineEdit>
20 #include <QObject>
21 #include <QPointer>
22 #include <QPushButton>
23 #include <QSlider>
24 
25 namespace guiQt
26 {
27 
28 namespace editor
29 {
30 
61 class GUIQT_CLASS_API SSlider : public QObject,
63 {
64 Q_OBJECT
65 
66 public:
67 
69 
71  GUIQT_API SSlider() noexcept;
72 
74  GUIQT_API virtual ~SSlider() noexcept;
75 
80  GUIQT_API static const ::fwCom::Signals::SignalKeyType s_VALUE_CHANGED_SIG;
81  typedef ::fwCom::Signal<void (int)> ValueChangedSignalType;
82 
90  GUIQT_API static const ::fwCom::Slots::SlotKeyType s_SET_VALUE_SLIDER_SLOT;
91  GUIQT_API static const ::fwCom::Slots::SlotKeyType s_SET_MIN_VALUE_SLIDER_SLOT;
92  GUIQT_API static const ::fwCom::Slots::SlotKeyType s_SET_MAX_VALUE_SLIDER_SLOT;
93 
95 
96 protected:
97 
98  typedef ::fwRuntime::ConfigurationElement::sptr Configuration;
99 
101  virtual void starting() override;
102 
104  virtual void stopping() override;
105 
107  virtual void updating() override;
108 
110  virtual void swapping() override;
111 
113  virtual void configuring() override;
114 
116  ValueChangedSignalType::sptr m_sigValueChanged;
117 
118 protected Q_SLOTS:
119 
121  void setValue( int value, bool _bForced = false );
122 
124  void setMinValue(int value);
125 
127  void setMaxValue(int value);
128 
130  void sliderPressed();
131 
133  void resetValue();
134 
136  void changeValue();
137 
139  void editValue();
140 
141 private:
142 
143  QPointer<QSlider> m_valueSlider;
144  QPointer<QLabel> m_valueLabel;
145  QPointer<QLabel> m_minValueLabel;
146  QPointer<QLabel> m_maxValueLabel;
147  QPointer<QLabel> m_textLabel;
148  QPointer<QPushButton> m_resetButton;
149  QPointer<QLineEdit> m_valueEdit;
150  // precisely.
151 
152  int m_value;
153  int m_minValue;
154  int m_maxValue;
155  int m_defaultValue;
156  QString m_text;
157  bool m_isUpdatedOnRelease;
158  bool m_hasResetButton;
159  bool m_hasEditBox;
160  bool m_sliderPressed;
161 };
162 
163 }
164 }
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
Defines the service interface managing the editor service for object.
Definition: IEditor.hpp:25
This editor allows to draw a slider with an integer data.
Definition: SSlider.hpp:61
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace guiQt contains the basic services to build the application IHM with Qt...
Definition: Code.hpp:21