LibrePCB Developers Documentation
unsignedratioedit.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_EDITOR_UNSIGNEDRATIOEDIT_H
21 #define LIBREPCB_EDITOR_UNSIGNEDRATIOEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../widgets/numbereditbase.h"
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 namespace editor {
38 
39 /*******************************************************************************
40  * Class UnsignedRatioEdit
41  ******************************************************************************/
42 
47 class UnsignedRatioEdit final : public NumberEditBase {
48  Q_OBJECT
49 
50 public:
51  // Constructors / Destructor
52  explicit UnsignedRatioEdit(QWidget* parent = nullptr) noexcept;
53  UnsignedRatioEdit(const UnsignedRatioEdit& other) = delete;
54  virtual ~UnsignedRatioEdit() noexcept;
55 
56  // Getters
57  const UnsignedRatio& getValue() const noexcept { return mValue; }
58 
59  // Setters
60  void setValue(const UnsignedRatio& value) noexcept;
61 
62  // Operator Overloadings
63  UnsignedRatioEdit& operator=(const UnsignedRatioEdit& rhs) = delete;
64 
65 signals:
66  void valueChanged(const UnsignedRatio& value);
67 
68 private: // Methods
69  void updateSpinBox() noexcept override;
70  void spinBoxValueChanged(double value) noexcept override;
71 
72 private: // Data
76 };
77 
78 /*******************************************************************************
79  * End of File
80  ******************************************************************************/
81 
82 } // namespace editor
83 } // namespace librepcb
84 
85 #endif
void spinBoxValueChanged(double value) noexcept override
Definition: unsignedratioedit.cpp:75
The UnsignedRatioEdit class is a widget to view/edit librepcb::UnsignedRatio values.
Definition: unsignedratioedit.h:47
Definition: occmodel.cpp:76
UnsignedRatio mValue
Definition: unsignedratioedit.h:75
UnsignedRatio mMaxValue
Definition: unsignedratioedit.h:74
UnsignedRatioEdit & operator=(const UnsignedRatioEdit &rhs)=delete
virtual ~UnsignedRatioEdit() noexcept
Definition: unsignedratioedit.cpp:46
type_safe::constrained_type< Ratio, UnsignedRatioConstraint, UnsignedRatioVerifier > UnsignedRatio
Definition: ratio.h:321
void valueChanged(const UnsignedRatio &value)
void setValue(const UnsignedRatio &value) noexcept
Definition: unsignedratioedit.cpp:53
UnsignedRatioEdit(QWidget *parent=nullptr) noexcept
Definition: unsignedratioedit.cpp:37
void updateSpinBox() noexcept override
Definition: unsignedratioedit.cpp:69
The NumberEditBase class is a widget base class to edit various kinds of numbers. ...
Definition: numbereditbase.h:49
const UnsignedRatio & getValue() const noexcept
Definition: unsignedratioedit.h:57
UnsignedRatio mMinValue
Definition: unsignedratioedit.h:73