LibrePCB Developers Documentation
patheditorwidget.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_PATHEDITORWIDGET_H
21#define LIBREPCB_EDITOR_PATHEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class LengthUnit;
37
38namespace editor {
39
40class EditableTableWidget;
41class LengthDelegate;
42class PathModel;
43
44/*******************************************************************************
45 * Class PathEditorWidget
46 ******************************************************************************/
47
51class PathEditorWidget final : public QWidget {
52 Q_OBJECT
53
54public:
55 // Constructors / Destructor
56 explicit PathEditorWidget(QWidget* parent = nullptr) noexcept;
57 PathEditorWidget(const PathEditorWidget& other) = delete;
58 ~PathEditorWidget() noexcept;
59
60 // General Methods
61 void setFrameShape(QFrame::Shape shape) noexcept;
62 void setReadOnly(bool readOnly) noexcept;
63 void setMinimumVertexCount(int count) noexcept;
64 void setPath(const Path& path) noexcept;
65 const Path& getPath() const noexcept;
66 void setLengthUnit(const LengthUnit& unit) noexcept;
67
68 // Operator Overloadings
69 PathEditorWidget& operator=(const PathEditorWidget& rhs) = delete;
70
71signals:
72 void pathChanged(const Path& path);
73
74private: // Data
75 QScopedPointer<PathModel> mModel;
76 QScopedPointer<EditableTableWidget> mView;
79};
80
81/*******************************************************************************
82 * End of File
83 ******************************************************************************/
84
85} // namespace editor
86} // namespace librepcb
87
88#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
A QTableView subclass which adds buttons to edit the underlying model.
Definition: editabletablewidget.h:42
Subclass of QStyledItemDelegate to display/edit librepcb::Length values.
Definition: lengthdelegate.h:45
The PathEditorWidget class.
Definition: patheditorwidget.h:51
PathEditorWidget(QWidget *parent=nullptr) noexcept
Definition: patheditorwidget.cpp:43
~PathEditorWidget() noexcept
Definition: patheditorwidget.cpp:83
const Path & getPath() const noexcept
Definition: patheditorwidget.cpp:106
void setReadOnly(bool readOnly) noexcept
Definition: patheditorwidget.cpp:94
void setLengthUnit(const LengthUnit &unit) noexcept
Definition: patheditorwidget.cpp:110
LengthDelegate * mLengthDelegateY
Definition: patheditorwidget.h:78
PathEditorWidget(const PathEditorWidget &other)=delete
QScopedPointer< EditableTableWidget > mView
Definition: patheditorwidget.h:76
void setPath(const Path &path) noexcept
Definition: patheditorwidget.cpp:102
LengthDelegate * mLengthDelegateX
Definition: patheditorwidget.h:77
void setFrameShape(QFrame::Shape shape) noexcept
Definition: patheditorwidget.cpp:90
void setMinimumVertexCount(int count) noexcept
Definition: patheditorwidget.cpp:98
QScopedPointer< PathModel > mModel
Definition: patheditorwidget.h:75
void pathChanged(const Path &path)
The PathModel class implements QAbstractTableModel for librepcb::Path.
Definition: pathmodel.h:43
Definition: occmodel.cpp:77