LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
unsignedlengthedit.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_UNSIGNEDLENGTHEDIT_H
21 #define LIBREPCB_UNSIGNEDLENGTHEDIT_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 UnsignedLengthEdit
40  ******************************************************************************/
41 
46 class UnsignedLengthEdit final : public NumberEditBase {
47  Q_OBJECT
48 
49 public:
50  // Constructors / Destructor
51  explicit UnsignedLengthEdit(QWidget* parent = nullptr) noexcept;
52  UnsignedLengthEdit(const UnsignedLengthEdit& other) = delete;
53  virtual ~UnsignedLengthEdit() noexcept;
54 
55  // Getters
56  const UnsignedLength& getValue() const noexcept { return mValue; }
57 
58  // Setters
59  void setValue(const UnsignedLength& value) noexcept;
60  void setUnit(const LengthUnit& unit) noexcept;
61 
62  // Operator Overloadings
63  UnsignedLengthEdit& operator=(const UnsignedLengthEdit& rhs) = delete;
64 
65 signals:
66  void valueChanged(const UnsignedLength& 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_UNSIGNEDLENGTHEDIT_H
void spinBoxValueChanged(double value) noexceptoverride
Definition: unsignedlengthedit.cpp:82
UnsignedLengthEdit(QWidget *parent=nullptr) noexcept
Definition: unsignedlengthedit.cpp:36
void updateSpinBox() noexceptoverride
Definition: unsignedlengthedit.cpp:75
void valueChanged(const UnsignedLength &value)
UnsignedLength mMinValue
Definition: unsignedlengthedit.h:73
UnsignedLength mMaxValue
Definition: unsignedlengthedit.h:74
The NumberEditBase class is a widget base class to edit various kinds of numbers. ...
Definition: numbereditbase.h:48
UnsignedLengthEdit & operator=(const UnsignedLengthEdit &rhs)=delete
virtual ~UnsignedLengthEdit() noexcept
Definition: unsignedlengthedit.cpp:45
UnsignedLength mValue
Definition: unsignedlengthedit.h:75
void setUnit(const LengthUnit &unit) noexcept
Definition: unsignedlengthedit.cpp:64
const UnsignedLength & getValue() const noexcept
Definition: unsignedlengthedit.h:56
The UnsignedLengthEdit class is a widget to view/edit librepcb::UnsignedLength values.
Definition: unsignedlengthedit.h:46
LengthUnit mUnit
Definition: unsignedlengthedit.h:76
void setValue(const UnsignedLength &value) noexcept
Definition: unsignedlengthedit.cpp:52
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:61
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659