LibrePCB Developers Documentation
Loading...
Searching...
No Matches
movealigndialog.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_MOVEALIGNDIALOG_H
21#define LIBREPCB_EDITOR_MOVEALIGNDIALOG_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <optional>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39namespace Ui {
40class MoveAlignDialog;
41}
42
43/*******************************************************************************
44 * Class MoveAlignDialog
45 ******************************************************************************/
46
50class MoveAlignDialog final : public QDialog {
51 Q_OBJECT
52
53 typedef std::optional<PositiveLength> Interval;
54
55public:
56 // Constructors / Destructor
57 MoveAlignDialog() = delete;
58 MoveAlignDialog(const MoveAlignDialog& other) = delete;
59 MoveAlignDialog(const QList<Point>& positions, const QString& settingsPrefix,
60 QWidget* parent = nullptr) noexcept;
61 ~MoveAlignDialog() noexcept;
62
63 // Getters
64 const QList<Point>& getNewPositions() const noexcept { return mNewPositions; }
65
66 // Operator Overloadings
68
69signals:
70 void positionsChanged(const QList<Point>& positions);
71
72private: // Methods
73 virtual bool eventFilter(QObject* watched, QEvent* event) noexcept override;
74 void updateNewPositions() noexcept;
75 static Point calcCenter(const QList<Point>& p) noexcept;
76
77private: // Data
78 QScopedPointer<Ui::MoveAlignDialog> mUi;
79 const QString mSettingsPrefix;
80 const QList<Point> mPositions;
84};
85
86/*******************************************************************************
87 * End of File
88 ******************************************************************************/
89
90} // namespace editor
91} // namespace librepcb
92
93#endif
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The MoveAlignDialog class.
Definition movealigndialog.h:50
QScopedPointer< Ui::MoveAlignDialog > mUi
Definition movealigndialog.h:78
virtual bool eventFilter(QObject *watched, QEvent *event) noexcept override
Definition movealigndialog.cpp:197
std::optional< PositiveLength > Interval
Definition movealigndialog.h:53
void updateNewPositions() noexcept
Definition movealigndialog.cpp:208
const QList< Point > & getNewPositions() const noexcept
Definition movealigndialog.h:64
const QList< Point > mPositions
Definition movealigndialog.h:80
const QString mSettingsPrefix
Definition movealigndialog.h:79
QList< Point > mPositionsOrdered
Unique; First item = reference position;.
Definition movealigndialog.h:81
QList< Point > mNewPositions
Definition movealigndialog.h:83
static Point calcCenter(const QList< Point > &p) noexcept
Definition movealigndialog.cpp:258
MoveAlignDialog & operator=(const MoveAlignDialog &rhs)=delete
Point mDefaultInterval
Definition movealigndialog.h:82
void positionsChanged(const QList< Point > &positions)
MoveAlignDialog(const MoveAlignDialog &other)=delete
Definition occmodel.cpp:76