diff --git a/qelectrotech.pro b/qelectrotech.pro index 07e51fb63..6ff0b72e9 100644 --- a/qelectrotech.pro +++ b/qelectrotech.pro @@ -123,7 +123,7 @@ HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \ $$files(sources/SearchAndReplace/ui/*.h) \ $$files(sources/NameList/*.h) \ $$files(sources/NameList/ui/*.h) \ - $$files(sources/utils/*.h) + $$files(sources/utils/*.h) SOURCES += $$files(sources/*.cpp) \ $$files(sources/editor/*.cpp) \ @@ -148,7 +148,7 @@ SOURCES += $$files(sources/*.cpp) \ $$files(sources/SearchAndReplace/ui/*.cpp) \ $$files(sources/NameList/*.cpp) \ $$files(sources/NameList/ui/*.cpp) \ - $$files(sources/utils/*.cpp) + $$files(sources/utils/*.cpp) # Liste des fichiers qui seront incorpores au binaire en tant que ressources Qt RESOURCES += qelectrotech.qrc @@ -169,7 +169,7 @@ FORMS += $$files(sources/richtext/*.ui) \ $$files(sources/ElementsCollection/ui/*.ui) \ $$files(sources/autoNum/ui/*.ui) \ $$files(sources/ui/configpage/*.ui) \ - $$files(sources/SearchAndReplace/ui/*.ui) \ + $$files(sources/SearchAndReplace/ui/*.ui) \ $$files(sources/NameList/ui/*.ui) UI_SOURCES_DIR = sources/ui/ diff --git a/sources/editor/graphicspart/customelementgraphicpart.h b/sources/editor/graphicspart/customelementgraphicpart.h index 077c53452..b75c5d5cb 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.h +++ b/sources/editor/graphicspart/customelementgraphicpart.h @@ -91,6 +91,8 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar QVariant property (const char *name) const override {return QObject::property(name);} virtual QPainterPath shadowShape ()const = 0; + virtual void setHandlerColor(QPointF /*pos*/, const QColor &/*color*/) {} + virtual void resetAllHandlerColor() {} protected: void stylesToXml (QDomElement &) const; diff --git a/sources/editor/graphicspart/partpolygon.cpp b/sources/editor/graphicspart/partpolygon.cpp index 5d0b51f82..ac009ce47 100644 --- a/sources/editor/graphicspart/partpolygon.cpp +++ b/sources/editor/graphicspart/partpolygon.cpp @@ -254,7 +254,33 @@ void PartPolygon::setClosed(bool close) if (m_closed == close) return; prepareGeometryChange(); m_closed = close; - emit closedChange(); + emit closedChange(); +} + +/** + * @brief PartPolygon::setHandlerColor + * Set the handler at pos @pos (in polygon coordinate) to color @color. + * @param pos + * @param color + */ +void PartPolygon::setHandlerColor(QPointF pos, const QColor &color) +{ + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { + if (qghi->pos() == mapToScene(pos)) { + qghi->setColor(color); + } + } +} + +/** + * @brief PartPolygon::resetAllHandlerColor + * Reset the color of every handlers +*/ +void PartPolygon::resetAllHandlerColor() +{ + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { + qghi->setColor(Qt::blue); + } } /** @@ -518,6 +544,7 @@ void PartPolygon::removePoint() if (index > -1 && indexpolygon(); + qDebug() << index; polygon.removeAt(index); //Wrap the undo for avoid to merge the undo commands when user add several points. diff --git a/sources/editor/graphicspart/partpolygon.h b/sources/editor/graphicspart/partpolygon.h index addb5885a..8521a4f28 100644 --- a/sources/editor/graphicspart/partpolygon.h +++ b/sources/editor/graphicspart/partpolygon.h @@ -84,6 +84,9 @@ class PartPolygon : public CustomElementGraphicPart bool isClosed () const {return m_closed;} void setClosed (bool close); + void setHandlerColor(QPointF pos, const QColor &color) final; + void resetAllHandlerColor() final; + protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override; diff --git a/sources/editor/polygoneditor.cpp b/sources/editor/polygoneditor.cpp deleted file mode 100644 index 79a558f19..000000000 --- a/sources/editor/polygoneditor.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright 2006-2019 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 . -*/ -#include "polygoneditor.h" -#include "partpolygon.h" -#include "elementscene.h" -#include "qetmessagebox.h" -#include "styleeditor.h" -#include "QPropertyUndoCommand/qpropertyundocommand.h" - -/** - Constructeur - @param editor L'editeur d'element concerne - @param p Le polygone a editer - @param parent le Widget parent -*/ -PolygonEditor::PolygonEditor(QETElementEditor *editor, PartPolygon *p, QWidget *parent) : - ElementItemEditor(editor, parent), - part(p), - points_list(this), - close_polygon(tr("Polygone fermé"), this) -{ - style_ = new StyleEditor(editor); - - // prepare la liste de points - points_list.setColumnCount(2); - QStringList headers; - headers << tr("x") << tr("y"); - points_list.setHeaderLabels(headers); - points_list.setRootIsDecorated(false); - updateForm(); - - // layout - QVBoxLayout *layout = new QVBoxLayout(this); - layout -> addWidget(style_); - layout -> addWidget(new QLabel(tr("Points du polygone :"))); - layout -> addWidget(&points_list); - layout -> addWidget(&close_polygon); - layout->addStretch(); - - updateForm(); -} - -/// Destructeur -PolygonEditor::~PolygonEditor() { -} - -/** - Met a jour les points du polygone et cree un objet d'annulation -*/ -void PolygonEditor::updatePolygonPoints() -{ - if (!part) return; - QPolygonF points = getPointsFromTree(); - if (points.count() < 2) - { - QET::QetMessageBox::warning(this, tr("Erreur", "message box title"), tr("Le polygone doit comporter au moins deux points.", "message box content")); - return; - } - - if (points != part->polygon()) - { - QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "polygon", part->property("polygon"), points); - undo->setText(tr("Modifier un polygone")); - undoStack().push(undo); - } -} - -/** - Met a jour l'etat ferme ou non du polygone -*/ -void PolygonEditor::updatePolygonClosedState() -{ - if (!part) return; - bool close = close_polygon.isChecked(); - if (close != part->isClosed()) - { - QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "closed", part->property("closed"), close); - undo->setText(tr("Modifier un polygone")); - undoStack().push(undo); - } -} - -/** - Met a jour le formulaire d'edition -*/ -void PolygonEditor::updateForm() { - if (!part) return; - activeConnections(false); - while(points_list.takeTopLevelItem(0)) {} - foreach(QPointF point, part -> polygon()) { - point = part -> mapToScene(point); - QStringList qsl; - qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y()); - QTreeWidgetItem *qtwi = new QTreeWidgetItem(qsl); - qtwi -> setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable); - points_list.addTopLevelItem(qtwi); - } - close_polygon.setChecked(part -> isClosed()); - activeConnections(true); -} - -/** - Permet de specifier a cet editeur quelle primitive il doit editer. A noter - qu'un editeur peut accepter ou refuser d'editer une primitive. - L'editeur de polygone acceptera d'editer la primitive new_part s'il s'agit - d'un objet de la classe PartPolygon. - @param new_part Nouvelle primitive a editer - @return true si l'editeur a accepter d'editer la primitive, false sinon -*/ -bool PolygonEditor::setPart(CustomElementPart *new_part) -{ - if (!new_part) - { - if (part) - { - disconnect(part, &PartPolygon::polygonChanged, this, &PolygonEditor::updateForm); - disconnect(part, &PartPolygon::closedChange, this, &PolygonEditor::updateForm); - } - part = nullptr; - style_ -> setPart(nullptr); - return(true); - } - if (PartPolygon *part_polygon = dynamic_cast(new_part)) - { - if (part == part_polygon) return true; - if (part) - { - disconnect(part, &PartPolygon::polygonChanged, this, &PolygonEditor::updateForm); - disconnect(part, &PartPolygon::closedChange, this, &PolygonEditor::updateForm); - } - part = part_polygon; - style_ -> setPart(part); - updateForm(); - connect(part, &PartPolygon::polygonChanged, this, &PolygonEditor::updateForm); - connect(part, &PartPolygon::closedChange, this, &PolygonEditor::updateForm); - return(true); - } - return(false); -} - -/** - @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas -*/ -CustomElementPart *PolygonEditor::currentPart() const { - return(part); -} - -/** - @return Un vecteur contenant les points composant le polygone a partir du - formulaire d'edition -*/ -QVector PolygonEditor::getPointsFromTree() { - if (!part) return(QVector()); - QVector points; - for(int i = 0 ; i < points_list.topLevelItemCount() ; ++ i) { - QTreeWidgetItem *qtwi = points_list.topLevelItem(i); - bool x_convert_ok, y_convert_ok; - qreal x = qtwi -> text(0).toDouble(&x_convert_ok); - qreal y = qtwi -> text(1).toDouble(&y_convert_ok); - if (!x_convert_ok || !y_convert_ok) continue; - points << part -> mapFromScene(QPointF(x, y)); - } - return(points); -} - -/** - @param qtwi QTreeWidgetItem a valider - @param column Colonne exacte du QTreeWidgetItem a valider -*/ -void PolygonEditor::validColumn(QTreeWidgetItem *qtwi, int column) { - bool convert_ok; - qtwi -> text(column).toDouble(&convert_ok); - if (convert_ok) { - points_list.closePersistentEditor(qtwi, column); - updatePolygonPoints(); - } else points_list.openPersistentEditor(qtwi, column); -} - -/** - Active ou desactive les connexionx signaux/slots entre les widgets internes. - @param active true pour activer les connexions, false pour les desactiver -*/ -void PolygonEditor::activeConnections(bool active) { - if (active) { - connect(&close_polygon, SIGNAL(stateChanged(int)), this, SLOT(updatePolygonClosedState())); - connect(&points_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(validColumn(QTreeWidgetItem *, int))); - } else { - disconnect(&close_polygon, SIGNAL(stateChanged(int)), this, SLOT(updatePolygonClosedState())); - disconnect(&points_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(validColumn(QTreeWidgetItem *, int))); - } -} diff --git a/sources/editor/polygoneditor.h b/sources/editor/polygoneditor.h deleted file mode 100644 index c5c74fab5..000000000 --- a/sources/editor/polygoneditor.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright 2006-2019 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 . -*/ -#ifndef POLYGON_EDITOR_H -#define POLYGON_EDITOR_H - -#include "elementitemeditor.h" -#include -#include - -class PartPolygon; -class StyleEditor; -class QTreeWidget; - -/** - This class provides a widget to edit polygons within the element editor. -*/ -class PolygonEditor : public ElementItemEditor { - - Q_OBJECT - - // constructors, destructor - public: - PolygonEditor(QETElementEditor *, PartPolygon * = nullptr, QWidget * = nullptr); - ~PolygonEditor() override; - - private: - PolygonEditor(const PolygonEditor &); - - // attributes - private: - PartPolygon *part; - StyleEditor *style_; - QTreeWidget points_list; - QCheckBox close_polygon; - - // methods - public: - bool setPart(CustomElementPart *) override; - CustomElementPart *currentPart() const override; - - private: - QVector getPointsFromTree(); - - public slots: - void updatePolygonPoints(); - void updatePolygonClosedState(); - void updateForm() override; - void validColumn(QTreeWidgetItem *qtwi, int column); - - private: - void activeConnections(bool); -}; -#endif diff --git a/sources/editor/ui/polygoneditor.cpp b/sources/editor/ui/polygoneditor.cpp new file mode 100644 index 000000000..164e5d995 --- /dev/null +++ b/sources/editor/ui/polygoneditor.cpp @@ -0,0 +1,289 @@ +/* + Copyright 2006-2019 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 . +*/ +#include "polygoneditor.h" +#include "ui_polygoneditor.h" +#include "partpolygon.h" +#include "elementscene.h" +#include "qetmessagebox.h" +#include "styleeditor.h" +#include "QPropertyUndoCommand/qpropertyundocommand.h" + +/** + * @brief PolygonEditor::PolygonEditor + * @param editor + * @param part + * @param parent + */ +PolygonEditor::PolygonEditor(QETElementEditor *editor, PartPolygon *part, QWidget *parent) : + ElementItemEditor(editor, parent), + ui(new Ui::PolygonEditor), + m_part(part) +{ + ui->setupUi(this); + m_style = new StyleEditor(editor); + ui->m_main_layout->insertWidget(0, m_style); + updateForm(); + ui->m_points_list_tree->installEventFilter(this); + ui->m_points_list_tree->addAction(ui->m_add_point_action); + ui->m_points_list_tree->addAction(ui->m_remove_point_action); +} + +/** + * @brief PolygonEditor::~PolygonEditor + */ +PolygonEditor::~PolygonEditor() { + delete ui; +} + +/** + * @brief PolygonEditor::setPart + * @param new_part + * @return + */ +bool PolygonEditor::setPart(CustomElementPart *new_part) +{ + if (!new_part) + { + if (m_part) + { + disconnect(m_part, &PartPolygon::polygonChanged, this, &PolygonEditor::updateForm); + disconnect(m_part, &PartPolygon::closedChange, this, &PolygonEditor::updateForm); + } + m_part = nullptr; + m_style -> setPart(nullptr); + return(true); + } + if (PartPolygon *part_polygon = dynamic_cast(new_part)) + { + if (m_part == part_polygon) return true; + if (m_part) + { + disconnect(m_part, &PartPolygon::polygonChanged, this, &PolygonEditor::updateForm); + disconnect(m_part, &PartPolygon::closedChange, this, &PolygonEditor::updateForm); + disconnect(m_part, &PartPolygon::xChanged, this, &PolygonEditor::updateForm); + disconnect(m_part, &PartPolygon::yChanged, this, &PolygonEditor::updateForm); + } + m_part = part_polygon; + m_style -> setPart(m_part); + updateForm(); + connect(m_part, &PartPolygon::polygonChanged, this, &PolygonEditor::updateForm); + connect(m_part, &PartPolygon::closedChange, this, &PolygonEditor::updateForm); + connect(m_part, &PartPolygon::xChanged, this, &PolygonEditor::updateForm); + connect(m_part, &PartPolygon::yChanged, this, &PolygonEditor::updateForm); + return(true); + } + return(false); +} + +/** + * @brief PolygonEditor::currentPart + * @return the curent edited part + */ +CustomElementPart *PolygonEditor::currentPart() const { + return m_part; +} + +/** + * @brief PolygonEditor::updateForm + * Update the widget + */ +void PolygonEditor::updateForm() +{ + if (!m_part) { + return; + } + + ui->m_points_list_tree->clear(); + + for(QPointF point : m_part->polygon()) + { + point = m_part->mapToScene(point); + QTreeWidgetItem *qtwi = new QTreeWidgetItem(); + qtwi->setData(0, Qt::EditRole, point.x()); + qtwi->setData(1, Qt::EditRole, point.y()); + qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled); + ui->m_points_list_tree->addTopLevelItem(qtwi); + } + ui->m_close_polygon_cb->setChecked(m_part->isClosed()); + ui->m_remove_point_action->setEnabled(m_part->polygon().size() > 2 ? true : false); +} + +/** + * @brief PolygonEditor::pointsFromTree + * @return the point of polygon from the current value of the tree editor + * if part coordinate. + */ +QVector PolygonEditor::pointsFromTree() +{ + QVector points; + if (!m_part) { + return points; + } + + for(int i = 0 ; i < ui->m_points_list_tree->topLevelItemCount() ; ++ i) + { + QTreeWidgetItem *qtwi = ui->m_points_list_tree->topLevelItem(i); + bool x_convert_ok, y_convert_ok; + qreal x = qtwi->data(0, Qt::EditRole).toReal(&x_convert_ok); + qreal y = qtwi->data(1, Qt::EditRole).toReal(&y_convert_ok); + if (x_convert_ok && y_convert_ok) { + points << m_part->mapFromScene(QPointF(x, y)); + } + } + return(points); +} + +bool PolygonEditor::eventFilter(QObject *watched, QEvent *event) +{ + if (watched == ui->m_points_list_tree && + event->type() == QEvent::FocusOut && + m_part) + { + m_part->resetAllHandlerColor(); + return true; + } + + return false; +} + +/** + * @brief PolygonEditor::on_m_close_polygon_cb_stateChanged + */ +void PolygonEditor::on_m_close_polygon_cb_stateChanged(int arg1) +{ + Q_UNUSED(arg1); + + if (!m_part) { + return; + } + bool close = ui->m_close_polygon_cb->isChecked(); + if (close != m_part->isClosed()) + { + QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_part, "closed", m_part->property("closed"), close); + undo->setText(tr("Modifier un polygone")); + undoStack().push(undo); + } +} + +/** + * @brief PolygonEditor::on_m_points_list_tree_itemChanged + * Update the polygon according to the current value of the tree editor + */ +void PolygonEditor::on_m_points_list_tree_itemChanged(QTreeWidgetItem *item, int column) +{ + Q_UNUSED(item); + Q_UNUSED(column); + + if (!m_part) { + return; + } + + QPolygonF points = pointsFromTree(); + if (points.count() < 2) + { + QET::QetMessageBox::warning(this, tr("Erreur", "message box title"), tr("Le polygone doit comporter au moins deux points.", "message box content")); + return; + } + + if (points != m_part->polygon()) + { + QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_part, "polygon", m_part->property("polygon"), points); + undo->setText(tr("Modifier un polygone")); + undoStack().push(undo); + } +} + +/** + * @brief PolygonEditor::on_m_points_list_tree_itemSelectionChanged + * Used to change the color of the current selected point. + */ +void PolygonEditor::on_m_points_list_tree_itemSelectionChanged() +{ + //Prevent when selection change but the widget ins't focused + if (!ui->m_points_list_tree->hasFocus()) { + return; + } + + QTreeWidgetItem *qtwi = ui->m_points_list_tree->currentItem(); + if (!qtwi || !m_part) { + return; + } + + m_part->resetAllHandlerColor(); + int index = ui->m_points_list_tree->indexOfTopLevelItem(qtwi); + + //We need to check if index isn't out of range of polygon + //this case can occur when user remove the last point of the polygon + //with the context menu of the tree widget + if(index >= 0 && + index < m_part->polygon().size()) + { + m_part->setHandlerColor(m_part->polygon().at(index), QColor(0, 255, 128)); + } +} + +void PolygonEditor::on_m_add_point_action_triggered() +{ + QTreeWidgetItem *qtwi = ui->m_points_list_tree->currentItem(); + if (!qtwi || !m_part) { + return; + } + + int index = ui->m_points_list_tree->indexOfTopLevelItem(qtwi); + QPolygonF new_polygon = m_part->polygon(); + + //Special case when user add a point after the last point of the polygon + if (index == m_part->polygon().size()-1) + { + QPointF p = m_part->polygon().last(); + p.rx()+=20; + p.ry()+=20; + new_polygon.append(p); + } + else + { + QPointF p = m_part->polygon().at(index) + + m_part->polygon().at(index+1); + p/=2; + new_polygon.insert(index+1, p); + } + + //Wrap the undo for avoid to merge the undo commands when user add several points. + QUndoCommand *undo = new QUndoCommand(tr("Ajouter un point à un polygone")); + new QPropertyUndoCommand(m_part, "polygon", m_part->polygon(), new_polygon, undo); + elementScene()->undoStack().push(undo); + + m_part->resetAllHandlerColor(); + m_part->setHandlerColor(m_part->polygon().at(index+1), QColor(0, 255, 128)); +} + +void PolygonEditor::on_m_remove_point_action_triggered() +{ + QTreeWidgetItem *qtwi = ui->m_points_list_tree->currentItem(); + if (!qtwi || !m_part) { + return; + } + + QPolygonF new_polygon = m_part->polygon(); + new_polygon.removeAt(ui->m_points_list_tree->indexOfTopLevelItem(qtwi)); + + //Wrap the undo for avoid to merge the undo commands when user remove several points. + QUndoCommand *undo = new QUndoCommand(tr("Supprimer un point d'un polygone")); + new QPropertyUndoCommand(m_part, "polygon", m_part->polygon(), new_polygon, undo); + elementScene()->undoStack().push(undo); +} diff --git a/sources/editor/ui/polygoneditor.h b/sources/editor/ui/polygoneditor.h new file mode 100644 index 000000000..f153ca629 --- /dev/null +++ b/sources/editor/ui/polygoneditor.h @@ -0,0 +1,58 @@ +/* + Copyright 2006-2019 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 . +*/ +#ifndef POLYGONEDITOR_H +#define POLYGONEDITOR_H + +#include "elementitemeditor.h" + +class StyleEditor; +class PartPolygon; +class QTreeWidgetItem; + +namespace Ui { + class PolygonEditor; +} + +class PolygonEditor : public ElementItemEditor +{ + Q_OBJECT + + public: + explicit PolygonEditor(QETElementEditor *editor, PartPolygon *part = nullptr, QWidget *parent = nullptr); + ~PolygonEditor() override; + + bool setPart(CustomElementPart *part) override; + CustomElementPart *currentPart() const override; + void updateForm() override; + QVector pointsFromTree(); + bool eventFilter(QObject *watched, QEvent *event) override; + + private slots: + void on_m_close_polygon_cb_stateChanged(int arg1); + void on_m_points_list_tree_itemChanged(QTreeWidgetItem *item, int column); + void on_m_points_list_tree_itemSelectionChanged(); + void on_m_add_point_action_triggered(); + void on_m_remove_point_action_triggered(); + +private: + Ui::PolygonEditor *ui; + StyleEditor *m_style = nullptr; + PartPolygon *m_part = nullptr; +}; + +#endif // POLYGONEDITOR_H diff --git a/sources/editor/ui/polygoneditor.ui b/sources/editor/ui/polygoneditor.ui new file mode 100644 index 000000000..6426f948e --- /dev/null +++ b/sources/editor/ui/polygoneditor.ui @@ -0,0 +1,72 @@ + + + PolygonEditor + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Points du polygone : + + + + + + + Qt::ActionsContextMenu + + + + X + + + + + Y + + + + + + + + Polygone fermé + + + + + + + + :/ico/16x16/list-add.png:/ico/16x16/list-add.png + + + Ajouter un point + + + + + + :/ico/16x16/list-remove.png:/ico/16x16/list-remove.png + + + Supprimer le point + + + + + + + + diff --git a/sources/editor/ui/rectangleeditor.h b/sources/editor/ui/rectangleeditor.h index 923b57ab8..c872b6515 100644 --- a/sources/editor/ui/rectangleeditor.h +++ b/sources/editor/ui/rectangleeditor.h @@ -38,7 +38,7 @@ class RectangleEditor : public ElementItemEditor public: explicit RectangleEditor(QETElementEditor *editor, PartRectangle *rect = nullptr, QWidget *parent = nullptr); - ~RectangleEditor(); + ~RectangleEditor() override; bool setPart(CustomElementPart *part) override; CustomElementPart *currentPart() const override;