CuteHMI - Graphical User Interface (CuteHMI.GUI.0)
Units.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_GUI_0_INCLUDE_CUTEHMI_GUI_UNITS_HPP
2 #define H_EXTENSIONS_CUTEHMI_GUI_0_INCLUDE_CUTEHMI_GUI_UNITS_HPP
3 
4 #include "internal/common.hpp"
5 
6 #include <QObject>
7 
8 namespace cutehmi {
9 namespace gui {
10 
14 class CUTEHMI_GUI_API Units:
15  public QObject
16 {
17  Q_OBJECT
18 
19  public:
20  static constexpr qreal INITIAL_QUADRAT = 80.0;
21 
22  static constexpr qreal INITIAL_STROKE_WIDTH_RATIO = 40.0;
23 
24  static constexpr bool INITIAL_ROUND_STROKE_WIDTH = true;
25 
29  Q_PROPERTY(qreal quadrat READ quadrat WRITE setQuadrat NOTIFY quadratChanged)
30 
31 
34  Q_PROPERTY(qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged)
35 
39  Q_PROPERTY(qreal strokeWidthRatio READ strokeWidthRatio WRITE setStrokeWidthRatio NOTIFY strokeWidthRatioChanged)
40 
44  Q_PROPERTY(bool roundStrokeWidth READ roundStrokeWidth WRITE setRoundStrokeWidth NOTIFY roundStrokeWidthChanged)
45 
46  Units(QObject * parent = nullptr);
47 
48  qreal quadrat() const;
49 
50  void setQuadrat(qreal quadrat);
51 
52  qreal strokeWidth() const;
53 
54  void setStrokeWidth(qreal strokeWidth);
55 
56  qreal strokeWidthRatio() const;
57 
58  void setStrokeWidthRatio(qreal ratio);
59 
60  bool roundStrokeWidth() const;
61 
62  void setRoundStrokeWidth(bool roundStrokeWidth);
63 
64  signals:
65  void quadratChanged();
66 
67  void strokeWidthChanged();
68 
69  void strokeWidthRatioChanged();
70 
71  void roundStrokeWidthChanged();
72 
73  private slots:
74  void strokeWidthBinding();
75 
76  private:
77  void setStrokeWidth(qreal strokeWidth, bool breakBinding);
78 
79  struct Members {
80  qreal quadrat;
81  qreal strokeWidth;
82  qreal strokeWidthRatio;
83  bool roundStrokeWidth;
84  QMetaObject::Connection strokeWidthBindingConnection;
85  QMetaObject::Connection strokeWidthRatioBindingConnection;
86  };
87 
88  MPtr<Members> m;
89 };
90 
91 }
92 }
93 
94 #endif
95 
96 //(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
97 //(c)C: This file is a part of CuteHMI.
98 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
99 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
100 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
QMetaObject::Connection
cutehmi::gui::Units
Unit.
Definition: Units.hpp:14
cutehmi::MPtr< Members >
QObject
cutehmi