2009-04-03 19:30:25 +00:00
|
|
|
/*
|
2025-01-04 13:37:40 +01:00
|
|
|
Copyright 2006-2025 The QElectroTech Team
|
2009-04-03 19:30:25 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2018-07-17 12:19:56 +00:00
|
|
|
#ifndef RECTANGLEEDITOR_H
|
|
|
|
#define RECTANGLEEDITOR_H
|
2015-07-23 09:32:21 +00:00
|
|
|
|
2020-12-10 18:44:03 +01:00
|
|
|
#include "../elementitemeditor.h"
|
|
|
|
|
2018-07-17 12:19:56 +00:00
|
|
|
#include <QWidget>
|
2015-07-23 09:32:21 +00:00
|
|
|
|
2010-02-18 00:42:41 +00:00
|
|
|
class StyleEditor;
|
2018-07-17 12:19:56 +00:00
|
|
|
class PartRectangle;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class RectangleEditor;
|
|
|
|
}
|
2015-07-23 09:32:21 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief The RectangleEditor class
|
|
|
|
This class provides a widget to edit rectangles within the element editor.
|
|
|
|
*/
|
2015-07-22 13:19:43 +00:00
|
|
|
class RectangleEditor : public ElementItemEditor
|
|
|
|
{
|
2009-04-03 19:30:25 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-02-18 00:42:41 +00:00
|
|
|
public:
|
2018-07-17 12:19:56 +00:00
|
|
|
explicit RectangleEditor(QETElementEditor *editor, PartRectangle *rect = nullptr, QWidget *parent = nullptr);
|
2020-07-15 20:20:07 +02:00
|
|
|
~RectangleEditor() override;
|
2018-07-17 12:19:56 +00:00
|
|
|
|
2020-07-15 20:20:07 +02:00
|
|
|
bool setPart(CustomElementPart *part) override;
|
|
|
|
bool setParts(QList <CustomElementPart *> parts) override;
|
|
|
|
CustomElementPart *currentPart() const override;
|
|
|
|
QList<CustomElementPart*> currentParts() const override;
|
|
|
|
QPointF editedTopLeft () const;
|
2010-02-18 00:42:41 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
public slots:
|
2021-03-11 19:52:50 +01:00
|
|
|
void updateForm() override;
|
2018-07-17 12:19:56 +00:00
|
|
|
private:
|
2020-07-15 20:20:07 +02:00
|
|
|
void editingFinished();
|
|
|
|
void activeConnections(bool active);
|
|
|
|
void xPosChanged();
|
|
|
|
void yPosChanged();
|
|
|
|
void widthChanged();
|
|
|
|
void heightChanged();
|
|
|
|
void xRadiusChanged();
|
|
|
|
void yRadiusChanged();
|
|
|
|
/*!
|
2020-08-16 11:19:36 +02:00
|
|
|
\brief setUpChangeConnections
|
|
|
|
Setup the connection from the rectangles(s) to the widget, to update it when the rectangles(s) are changed (moved ...)
|
|
|
|
*/
|
2020-07-15 20:20:07 +02:00
|
|
|
void setUpChangeConnections();
|
|
|
|
void disconnectChangeConnections();
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
private:
|
2020-07-15 20:20:07 +02:00
|
|
|
bool m_locked = false;
|
|
|
|
StyleEditor *m_style;
|
|
|
|
PartRectangle *m_part;
|
|
|
|
Ui::RectangleEditor *ui;
|
2021-03-11 19:52:50 +01:00
|
|
|
QList <QMetaObject::Connection> m_change_connections;
|
2009-04-03 19:30:25 +00:00
|
|
|
};
|
2018-07-17 12:19:56 +00:00
|
|
|
|
|
|
|
#endif // RECTANGLEEDITOR_H
|