LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_UNSIGNEDRATIOEDIT_H
21 #define LIBREPCB_UNSIGNEDRATIOEDIT_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../units/ratio.h"
27 #include "numbereditbase.h"
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 /*******************************************************************************
38  * Class UnsignedRatioEdit
39  ******************************************************************************/
40 
45 class UnsignedRatioEdit final : public NumberEditBase {
46  Q_OBJECT
47 
48 public:
49  // Constructors / Destructor
50  explicit UnsignedRatioEdit(QWidget* parent = nullptr) noexcept;
51  UnsignedRatioEdit(const UnsignedRatioEdit& other) = delete;
52  virtual ~UnsignedRatioEdit() noexcept;
53 
54  // Getters
55  const UnsignedRatio& getValue() const noexcept { return mValue; }
56 
57  // Setters
58  void setValue(const UnsignedRatio& value) noexcept;
59 
60  // Operator Overloadings
61  UnsignedRatioEdit& operator=(const UnsignedRatioEdit& rhs) = delete;
62 
63 signals:
64  void valueChanged(const UnsignedRatio& value);
65 
66 private: // Methods
67  void updateSpinBox() noexcept override;
68  void spinBoxValueChanged(double value) noexcept override;
69 
70 private: // Data
74 };
75 
76 /*******************************************************************************
77  * End of File
78  ******************************************************************************/
79 
80 } // namespace librepcb
81 
82 #endif // LIBREPCB_UNSIGNEDRATIOEDIT_H
void valueChanged(const UnsignedRatio &value)
UnsignedRatioEdit(QWidget *parent=nullptr) noexcept
Definition: unsignedratioedit.cpp:36
void updateSpinBox() noexceptoverride
Definition: unsignedratioedit.cpp:68
UnsignedRatio mMaxValue
Definition: unsignedratioedit.h:72
The UnsignedRatioEdit class is a widget to view/edit librepcb::UnsignedRatio values.
Definition: unsignedratioedit.h:45
UnsignedRatio mMinValue
Definition: unsignedratioedit.h:71
The NumberEditBase class is a widget base class to edit various kinds of numbers. ...
Definition: numbereditbase.h:48
const UnsignedRatio & getValue() const noexcept
Definition: unsignedratioedit.h:55
type_safe::constrained_type< Ratio, UnsignedRatioConstraint, UnsignedRatioVerifier > UnsignedRatio
Definition: ratio.h:330
UnsignedRatioEdit & operator=(const UnsignedRatioEdit &rhs)=delete
UnsignedRatio mValue
Definition: unsignedratioedit.h:73
virtual ~UnsignedRatioEdit() noexcept
Definition: unsignedratioedit.cpp:45
void spinBoxValueChanged(double value) noexceptoverride
Definition: unsignedratioedit.cpp:74
void setValue(const UnsignedRatio &value) noexcept
Definition: unsignedratioedit.cpp:52