LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ratioedit.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_RATIOEDIT_H
21 #define LIBREPCB_RATIOEDIT_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 RatioEdit
39  ******************************************************************************/
40 
44 class RatioEdit final : public NumberEditBase {
45  Q_OBJECT
46 
47 public:
48  // Constructors / Destructor
49  explicit RatioEdit(QWidget* parent = nullptr) noexcept;
50  RatioEdit(const RatioEdit& other) = delete;
51  virtual ~RatioEdit() noexcept;
52 
53  // Getters
54  const Ratio& getValue() const noexcept { return mValue; }
55 
56  // Setters
57  void setValue(const Ratio& value) noexcept;
58 
59  // Operator Overloadings
60  RatioEdit& operator=(const RatioEdit& rhs) = delete;
61 
62 signals:
63  void valueChanged(const Ratio& value);
64 
65 private: // Methods
66  void updateSpinBox() noexcept override;
67  void spinBoxValueChanged(double value) noexcept override;
68 
69 private: // Data
73 };
74 
75 /*******************************************************************************
76  * End of File
77  ******************************************************************************/
78 
79 } // namespace librepcb
80 
81 #endif // LIBREPCB_RATIOEDIT_H
RatioEdit & operator=(const RatioEdit &rhs)=delete
void setValue(const Ratio &value) noexcept
Definition: ratioedit.cpp:52
void spinBoxValueChanged(double value) noexceptoverride
Definition: ratioedit.cpp:74
RatioEdit(QWidget *parent=nullptr) noexcept
Definition: ratioedit.cpp:36
Ratio mMaxValue
Definition: ratioedit.h:71
The NumberEditBase class is a widget base class to edit various kinds of numbers. ...
Definition: numbereditbase.h:48
void updateSpinBox() noexceptoverride
Definition: ratioedit.cpp:68
The RatioEdit class is a widget to view/edit librepcb::Ratio values.
Definition: ratioedit.h:44
Ratio mMinValue
Definition: ratioedit.h:70
Ratio mValue
Definition: ratioedit.h:72
const Ratio & getValue() const noexcept
Definition: ratioedit.h:54
virtual ~RatioEdit() noexcept
Definition: ratioedit.cpp:45
The Ratio class is used to represent a ratio number (e.g. 13.37%)
Definition: ratio.h:44
void valueChanged(const Ratio &value)