LibrePCB Developers Documentation
holeeditorwidget.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_HOLEEDITORWIDGET_H
21#define LIBREPCB_EDITOR_HOLEEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
28
29#include <QtCore>
30#include <QtWidgets>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class LengthUnit;
38
39namespace editor {
40
41namespace Ui {
42class HoleEditorWidget;
43}
44
45/*******************************************************************************
46 * Class HoleEditorWidget
47 ******************************************************************************/
48
52class HoleEditorWidget : public QWidget {
53 Q_OBJECT
54
55public:
56 // Constructors / Destructor
57 HoleEditorWidget() = delete;
58 explicit HoleEditorWidget(QWidget* parent = nullptr) noexcept;
59 HoleEditorWidget(const HoleEditorWidget& other) = delete;
60 virtual ~HoleEditorWidget() noexcept;
61
62 // Getters
63 const PositiveLength& getDiameter() const noexcept { return mDiameter; }
64 bool getLocked() const noexcept;
65 const NonEmptyPath& getPath() const noexcept { return mPath; }
66
67 // Setters
68 void setReadOnly(bool readOnly) noexcept;
69 void setDiameter(const PositiveLength& diameter) noexcept;
70 void setLocked(bool locked) noexcept;
71 void setPath(const NonEmptyPath& path) noexcept;
72
73 // General Methods
74 void setFocusToDiameterEdit() noexcept;
75 void configureClientSettings(const LengthUnit& lengthUnit,
76 const QString& settingsPrefix) noexcept;
77
78 // Operator Overloadings
79 HoleEditorWidget& operator=(const HoleEditorWidget& rhs) = delete;
80
81signals:
82 void diameterChanged(const PositiveLength& diameter);
83 void pathChanged(const NonEmptyPath& path);
84
85private: // Methods
86 void updatePathFromCircularTab() noexcept;
87 void updatePathFromLinearTab() noexcept;
88 void updateCircularTabFromPath(const Path& path) noexcept;
89 void updateLinearTabFromPath(const Path& path) noexcept;
90 void updateLinearOuterSize(const Path& path) noexcept;
91
92private: // Data
93 QScopedPointer<Ui::HoleEditorWidget> mUi;
96};
97
98/*******************************************************************************
99 * End of File
100 ******************************************************************************/
101
102} // namespace editor
103} // namespace librepcb
104
105#endif
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:60
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition: path.h:58
The HoleEditorWidget class.
Definition: holeeditorwidget.h:52
void updateCircularTabFromPath(const Path &path) noexcept
Definition: holeeditorwidget.cpp:200
void updateLinearOuterSize(const Path &path) noexcept
Definition: holeeditorwidget.cpp:247
void setReadOnly(bool readOnly) noexcept
Definition: holeeditorwidget.cpp:98
void updatePathFromCircularTab() noexcept
Definition: holeeditorwidget.cpp:163
void diameterChanged(const PositiveLength &diameter)
void updatePathFromLinearTab() noexcept
Definition: holeeditorwidget.cpp:177
NonEmptyPath mPath
Definition: holeeditorwidget.h:95
void pathChanged(const NonEmptyPath &path)
const PositiveLength & getDiameter() const noexcept
Definition: holeeditorwidget.h:63
void updateLinearTabFromPath(const Path &path) noexcept
Definition: holeeditorwidget.cpp:214
void setDiameter(const PositiveLength &diameter) noexcept
Definition: holeeditorwidget.cpp:109
void setFocusToDiameterEdit() noexcept
Definition: holeeditorwidget.cpp:138
void setPath(const NonEmptyPath &path) noexcept
Definition: holeeditorwidget.cpp:120
bool getLocked() const noexcept
Definition: holeeditorwidget.cpp:90
void configureClientSettings(const LengthUnit &lengthUnit, const QString &settingsPrefix) noexcept
Definition: holeeditorwidget.cpp:142
PositiveLength mDiameter
Definition: holeeditorwidget.h:94
const NonEmptyPath & getPath() const noexcept
Definition: holeeditorwidget.h:65
void setLocked(bool locked) noexcept
Definition: holeeditorwidget.cpp:114
QScopedPointer< Ui::HoleEditorWidget > mUi
Definition: holeeditorwidget.h:93
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition: path.h:222