77 lines
2.1 KiB
C
Raw Normal View History

/*
2020-06-15 17:42:37 +02:00
Copyright 2006-2020 The QElectroTech Team
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/>.
*/
#ifndef RECTANGLEEDITOR_H
#define RECTANGLEEDITOR_H
2020-12-10 18:44:03 +01:00
#include "../elementitemeditor.h"
#include <QWidget>
class StyleEditor;
class PartRectangle;
namespace Ui {
class RectangleEditor;
}
/**
2020-08-16 11:19:36 +02:00
@brief The RectangleEditor class
This class provides a widget to edit rectangles within the element editor.
*/
class RectangleEditor : public ElementItemEditor
{
Q_OBJECT
public:
explicit RectangleEditor(QETElementEditor *editor, PartRectangle *rect = nullptr, QWidget *parent = nullptr);
2020-07-15 20:20:07 +02:00
~RectangleEditor() override;
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;
public slots:
2020-07-15 20:20:07 +02:00
void updateForm() override;
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();
private:
2020-07-15 20:20:07 +02:00
bool m_locked = false;
StyleEditor *m_style;
PartRectangle *m_part;
Ui::RectangleEditor *ui;
QList <QMetaObject::Connection> m_change_connections;
};
#endif // RECTANGLEEDITOR_H