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 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39/*******************************************************************************
40 * Class UnsignedRatioEdit
41 ******************************************************************************/
42
47class UnsignedRatioEdit final : public NumberEditBase {
48 Q_OBJECT
49
50public:
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
64
65signals:
66 void valueChanged(const UnsignedRatio& value);
67
68private: // Methods
69 void updateSpinBox() noexcept override;
70 void spinBoxValueChanged(double value) noexcept override;
71
72private: // Data
76};
77
78/*******************************************************************************
79 * End of File
80 ******************************************************************************/
81
82} // namespace editor
83} // namespace librepcb
84
85#endif
The NumberEditBase class is a widget base class to edit various kinds of numbers.
Definition: numbereditbase.h:49
The UnsignedRatioEdit class is a widget to view/edit librepcb::UnsignedRatio values.
Definition: unsignedratioedit.h:47
UnsignedRatio mMinValue
Definition: unsignedratioedit.h:73
void spinBoxValueChanged(double value) noexcept override
Definition: unsignedratioedit.cpp:75
UnsignedRatio mValue
Definition: unsignedratioedit.h:75
UnsignedRatioEdit & operator=(const UnsignedRatioEdit &rhs)=delete
UnsignedRatio mMaxValue
Definition: unsignedratioedit.h:74
UnsignedRatioEdit(QWidget *parent=nullptr) noexcept
Definition: unsignedratioedit.cpp:37
void setValue(const UnsignedRatio &value) noexcept
Definition: unsignedratioedit.cpp:53
virtual ~UnsignedRatioEdit() noexcept
Definition: unsignedratioedit.cpp:46
void valueChanged(const UnsignedRatio &value)
const UnsignedRatio & getValue() const noexcept
Definition: unsignedratioedit.h:57
UnsignedRatioEdit(const UnsignedRatioEdit &other)=delete
void updateSpinBox() noexcept override
Definition: unsignedratioedit.cpp:69
Definition: occmodel.cpp:77
type_safe::constrained_type< Ratio, UnsignedRatioConstraint, UnsignedRatioVerifier > UnsignedRatio
Definition: ratio.h:330