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