VPTissue Reference Manual
TransformationWidget.h
Go to the documentation of this file.
1 #ifndef SIMPT_EDITOR_TRANSFORMATION_WIDGET_H_INCLUDED
2 #define SIMPT_EDITOR_TRANSFORMATION_WIDGET_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include <QWidget>
23 
24 class QDoubleSpinBox;
25 class QSlider;
26 class QSpinBox;
27 
28 namespace SimPT_Editor {
29 
34 {
35  Q_OBJECT
36 public:
45  TransformationWidget(int maxScaleRatio, double maxTranslationX, double maxTranslationY, QWidget *parent = nullptr);
46 
50  virtual ~TransformationWidget();
51 
52 
58  int GetRotation() { return m_rotation; }
59 
65  double GetScalingX() { return m_scaling_x; }
66 
72  double GetScalingY() { return m_aspect_ratio_maintained ? m_scaling_x : m_scaling_y; }
73 
79  double GetTranslationX() { return m_translation_x; }
80 
86  double GetTranslationY() { return m_translation_y; }
87 
88 signals:
92  void TransformationChanged();
93 
94 private slots:
95  void UpdateRotation(int degrees);
96 
97  void UpdateScalingX(double factor);
98  void UpdateScalingX(int value);
99 
100  void UpdateScalingY(double factor);
101  void UpdateScalingY(int value);
102 
103  void UpdateAspectRatioMaintained(bool checked);
104 
105  void UpdateTranslationX(double position);
106  void UpdateTranslationX(int position);
107 
108  void UpdateTranslationY(double position);
109  void UpdateTranslationY(int position);
110 
111 private:
112  void SetupGui(int maxScaleRatio, double maxTranslationX, double maxTranslationY);
113 
114 private:
115  int m_rotation;
116  double m_scaling_x;
117  double m_scaling_y;
118  bool m_aspect_ratio_maintained;
119  double m_translation_x;
120  double m_translation_y;
121  bool m_updating;
122 
123 private:
124  QDoubleSpinBox* m_scaling_x_spin_box;
125  QSlider* m_scaling_x_slider;
126  QDoubleSpinBox* m_scaling_y_spin_box;
127  QSlider* m_scaling_y_slider;
128  QDoubleSpinBox* m_translation_x_spin_box;
129  QSlider* m_translation_x_slider;
130  QDoubleSpinBox* m_translation_y_spin_box;
131  QSlider* m_translation_y_slider;
132 };
133 
134 } // namespace
135 
136 #endif // end-of-include-guard
void TransformationChanged()
Emitted when the transformation is changed by the user.
Namespace for SimPT tissue editor package.
Definition: Cell.h:32
Qt GUI to enter a transformation of an item.
double GetTranslationY()
Gets the y translation of the transformation.
int GetRotation()
Gets the rotation of the transformation.
TransformationWidget(int maxScaleRatio, double maxTranslationX, double maxTranslationY, QWidget *parent=nullptr)
Constructor.
double GetScalingX()
Gets the x scaling of the transformation.
double GetTranslationX()
Gets the x translation of the transformation.
double GetScalingY()
Gets the y scaling of the transformation.
see the online Qt documentation