LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_PATHEDITORWIDGET_H
21 #define LIBREPCB_PATHEDITORWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../geometry/path.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 /*******************************************************************************
37  * Class PathEditorWidget
38  ******************************************************************************/
39 
43 class PathEditorWidget final : public QWidget {
44  Q_OBJECT
45 
46 public:
47  // Constructors / Destructor
48  explicit PathEditorWidget(QWidget* parent = nullptr) noexcept;
49  PathEditorWidget(const PathEditorWidget& other) = delete;
50  ~PathEditorWidget() noexcept;
51 
52  // General Methods
53  void setPath(const Path& path) noexcept;
54  Path getPath() const;
55 
56  // Operator Overloadings
57  PathEditorWidget& operator=(const PathEditorWidget& rhs) = delete;
58 
59 private:
60  void setRowContent(int row, const QString& x, const QString& y,
61  const QString& angle, bool isLastRow) noexcept;
62  void btnAddRemoveClicked() noexcept;
63  int getRowOfTableCellWidget(const QWidget* widget) const noexcept;
64  QString cellText(int row, int column,
65  const QString& fallback = QString()) const noexcept;
66 
67 signals:
68  void toggled(bool checked);
69  void clicked(bool checked);
70  void stateChanged(int state);
71 
72 private: // Data
73  QTableWidget* mTable; // ownership by Qt's parent-child-mechanism
74 };
75 
76 /*******************************************************************************
77  * End of File
78  ******************************************************************************/
79 
80 } // namespace librepcb
81 
82 #endif // LIBREPCB_PATHEDITORWIDGET_H
int getRowOfTableCellWidget(const QWidget *widget) const noexcept
Definition: patheditorwidget.cpp:137
The PathEditorWidget class.
Definition: patheditorwidget.h:43
void clicked(bool checked)
void btnAddRemoveClicked() noexcept
Definition: patheditorwidget.cpp:124
Path getPath() const
Definition: patheditorwidget.cpp:78
PathEditorWidget & operator=(const PathEditorWidget &rhs)=delete
~PathEditorWidget() noexcept
Definition: patheditorwidget.cpp:60
void stateChanged(int state)
QString cellText(int row, int column, const QString &fallback=QString()) const noexcept
Definition: patheditorwidget.cpp:147
void toggled(bool checked)
The Path class represents a list of vertices connected by straight lines or circular arc segments...
Definition: path.h:53
PathEditorWidget(QWidget *parent=nullptr) noexcept
Definition: patheditorwidget.cpp:37
void setPath(const Path &path) noexcept
Definition: patheditorwidget.cpp:67
QTableWidget * mTable
Definition: patheditorwidget.h:73
void setRowContent(int row, const QString &x, const QString &y, const QString &angle, bool isLastRow) noexcept
Definition: patheditorwidget.cpp:95