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