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