fw4spl
STransformEditor.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2017-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 "uiVisuQt/config.hpp"
10 
11 #include <fwGui/editor/IEditor.hpp>
12 
13 #include <QObject>
14 #include <QPointer>
15 
16 class QSlider;
17 class QLabel;
18 class QLineEdit;
19 
20 namespace uiVisuQt
21 {
44 class UIVISUQT_CLASS_API STransformEditor : public QObject,
46 {
47 Q_OBJECT;
48 public:
50 
52  UIVISUQT_API STransformEditor() noexcept;
53 
55  UIVISUQT_API virtual ~STransformEditor() noexcept;
56 
57 protected:
58 
60  UIVISUQT_API virtual void configuring() override;
61 
63  UIVISUQT_API virtual void starting() override;
64 
66  UIVISUQT_API virtual void stopping() override;
67 
69  UIVISUQT_API virtual void updating() override;
70 
71 private Q_SLOTS:
72 
74  void onSliderChanged(int value);
75 
77  void onTextChanged();
78 
79 private:
80 
82  void updateFromMatrix();
83 
84  /*
85  * @brief This enum defines the transformation matrix entries indexes
86  */
87  enum SliderIndex
88  {
89  POSITION_X = 0,
90  POSITION_Y,
91  POSITION_Z,
92  ROTATION_X,
93  ROTATION_Y,
94  ROTATION_Z,
95  MAX_SLIDER_INDEX
96  };
97 
98  /*
99  * @brief This struct regulates a transformation matrix entry in the editor
100  */
101  struct SliderWidget
102  {
103  QPointer<QSlider> m_slider;
104  QPointer<QLabel> m_labelMin;
105  QPointer<QLabel> m_labelMax;
106  QPointer<QLabel> m_labelDefinition;
107  QPointer<QLineEdit> m_sliderValue;
108  };
109 
111  SliderWidget m_sliders[ MAX_SLIDER_INDEX ];
112 
114  std::string m_rotation;
115 
117  std::string m_translation;
118 
120  int m_translationRange[2];
121 
123  int m_rotationRange[2];
124 };
125 
126 } // namespace uiVisuQt
Defines the service interface managing the editor service for object.
Definition: IEditor.hpp:25
The namespace uiVisuQt supplies user interface editors done with Qt.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
This editor regulates the position and rotation defined in a transformation matrix.