diff --git a/sources/editor/arceditor.cpp b/sources/editor/arceditor.cpp index f8606c013..059e2e2ce 100644 --- a/sources/editor/arceditor.cpp +++ b/sources/editor/arceditor.cpp @@ -128,6 +128,10 @@ CustomElementPart *ArcEditor::currentPart() const { return(part); } +QList ArcEditor::currentParts() const { + return style_->currentParts(); +} + /** * @brief ArcEditor::updateArcS * Update the start angle of the arc according to the edited value. diff --git a/sources/editor/arceditor.h b/sources/editor/arceditor.h index 0b1527c03..fa5ff2ed3 100644 --- a/sources/editor/arceditor.h +++ b/sources/editor/arceditor.h @@ -51,6 +51,7 @@ class ArcEditor : public ElementItemEditor public: bool setPart(CustomElementPart *) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; public slots: void updateArcS(); diff --git a/sources/editor/elementitemeditor.h b/sources/editor/elementitemeditor.h index 349835052..2b9025daa 100644 --- a/sources/editor/elementitemeditor.h +++ b/sources/editor/elementitemeditor.h @@ -54,6 +54,7 @@ class ElementItemEditor : public QWidget virtual bool setParts(QList ) {return false;} virtual CustomElementPart *currentPart() const = 0; + virtual QList currentParts() const = 0; virtual void updateForm() = 0; // attributes diff --git a/sources/editor/ellipseeditor.cpp b/sources/editor/ellipseeditor.cpp index b5e07748d..982b156b0 100644 --- a/sources/editor/ellipseeditor.cpp +++ b/sources/editor/ellipseeditor.cpp @@ -109,6 +109,10 @@ CustomElementPart *EllipseEditor::currentPart() const { return(part); } +QList EllipseEditor::currentParts() const { + return style_->currentParts(); +} + void EllipseEditor::editingFinished() { if (m_locked) return; diff --git a/sources/editor/ellipseeditor.h b/sources/editor/ellipseeditor.h index d808a0ded..11f0ff6d6 100644 --- a/sources/editor/ellipseeditor.h +++ b/sources/editor/ellipseeditor.h @@ -49,6 +49,7 @@ class EllipseEditor : public ElementItemEditor public: bool setPart(CustomElementPart *) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; public slots: void editingFinished(); diff --git a/sources/editor/lineeditor.cpp b/sources/editor/lineeditor.cpp index baee161b9..8293f978f 100644 --- a/sources/editor/lineeditor.cpp +++ b/sources/editor/lineeditor.cpp @@ -146,6 +146,10 @@ CustomElementPart *LineEditor::currentPart() const { return(part); } +QList LineEditor::currentParts() const { + return style_->currentParts(); +} + /** * @brief LineEditor::editedP1 * @return The edited P1 in item coordinate diff --git a/sources/editor/lineeditor.h b/sources/editor/lineeditor.h index c1c45d3bb..00c5a3c12 100644 --- a/sources/editor/lineeditor.h +++ b/sources/editor/lineeditor.h @@ -51,6 +51,7 @@ class LineEditor : public ElementItemEditor public: bool setPart(CustomElementPart *) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; QPointF editedP1() const; QPointF editedP2() const; diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 316d9eb31..e749a539d 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -489,6 +489,7 @@ bool StyleEditor::setPart(CustomElementPart *new_part) { if (CustomElementGraphicPart *part_graphic = dynamic_cast(new_part)) { part = part_graphic; + m_cep_list.append(part_graphic); updateForm(); return(true); } @@ -538,6 +539,10 @@ CustomElementPart *StyleEditor::currentPart() const { return(part); } +QList StyleEditor::currentParts() const { + return m_cep_list; +} + /** * @brief StyleEditor::isStyleEditable * @param cep_list diff --git a/sources/editor/styleeditor.h b/sources/editor/styleeditor.h index 58a2fb4a2..9cfcc5ad9 100644 --- a/sources/editor/styleeditor.h +++ b/sources/editor/styleeditor.h @@ -53,8 +53,9 @@ class StyleEditor : public ElementItemEditor // methods public: bool setPart(CustomElementPart *) override; - bool setParts(QList) override; + bool setParts(QList); CustomElementPart *currentPart() const override; + QList currentParts() const override; static bool isStyleEditable (QList cep_list); diff --git a/sources/editor/terminaleditor.cpp b/sources/editor/terminaleditor.cpp index 1aa4c177a..552bf7b61 100644 --- a/sources/editor/terminaleditor.cpp +++ b/sources/editor/terminaleditor.cpp @@ -153,6 +153,14 @@ CustomElementPart *TerminalEditor::currentPart() const { return(m_part); } +QList TerminalEditor::currentParts() const { + QList parts; + for (auto term: m_terminals) { + parts.append(static_cast(term)); + } + return parts; +} + /// Met a jour l'orientation de la borne et cree un objet d'annulation void TerminalEditor::updateTerminalO() { diff --git a/sources/editor/terminaleditor.h b/sources/editor/terminaleditor.h index 240b99496..84dd00c34 100644 --- a/sources/editor/terminaleditor.h +++ b/sources/editor/terminaleditor.h @@ -55,6 +55,7 @@ class TerminalEditor : public ElementItemEditor { bool setPart(CustomElementPart *) override; bool setParts(QList parts) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; public slots: void updateTerminalO(); diff --git a/sources/editor/ui/dynamictextfieldeditor.cpp b/sources/editor/ui/dynamictextfieldeditor.cpp index 8262abc36..fdbb57781 100644 --- a/sources/editor/ui/dynamictextfieldeditor.cpp +++ b/sources/editor/ui/dynamictextfieldeditor.cpp @@ -30,7 +30,7 @@ #include DynamicTextFieldEditor::DynamicTextFieldEditor(QETElementEditor *editor, PartDynamicTextField *text_field, QWidget *parent) : - ElementItemEditor(editor, parent), + ElementItemEditor(editor, parent), ui(new Ui::DynamicTextFieldEditor) { ui->setupUi(this); @@ -113,6 +113,14 @@ CustomElementPart *DynamicTextFieldEditor::currentPart() const { return m_text_field.data(); } +QList DynamicTextFieldEditor::currentParts() const { + QList parts; + for (auto part: m_parts) { + parts.append(static_cast(part)); + } + return parts; +} + void DynamicTextFieldEditor::updateForm() { if(m_text_field) diff --git a/sources/editor/ui/dynamictextfieldeditor.h b/sources/editor/ui/dynamictextfieldeditor.h index e17452f51..444607471 100644 --- a/sources/editor/ui/dynamictextfieldeditor.h +++ b/sources/editor/ui/dynamictextfieldeditor.h @@ -40,6 +40,7 @@ class DynamicTextFieldEditor : public ElementItemEditor bool setPart(CustomElementPart *part) override; bool setParts(QList ) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; void updateForm() override; private: diff --git a/sources/editor/ui/polygoneditor.cpp b/sources/editor/ui/polygoneditor.cpp index 164e5d995..3a7c9337f 100644 --- a/sources/editor/ui/polygoneditor.cpp +++ b/sources/editor/ui/polygoneditor.cpp @@ -98,6 +98,10 @@ CustomElementPart *PolygonEditor::currentPart() const { return m_part; } +QList PolygonEditor::currentParts() const { + return m_style->currentParts(); +} + /** * @brief PolygonEditor::updateForm * Update the widget diff --git a/sources/editor/ui/polygoneditor.h b/sources/editor/ui/polygoneditor.h index f153ca629..5cfe54d68 100644 --- a/sources/editor/ui/polygoneditor.h +++ b/sources/editor/ui/polygoneditor.h @@ -38,6 +38,7 @@ class PolygonEditor : public ElementItemEditor bool setPart(CustomElementPart *part) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; void updateForm() override; QVector pointsFromTree(); bool eventFilter(QObject *watched, QEvent *event) override; diff --git a/sources/editor/ui/rectangleeditor.cpp b/sources/editor/ui/rectangleeditor.cpp index 60b913cc6..c794931ac 100644 --- a/sources/editor/ui/rectangleeditor.cpp +++ b/sources/editor/ui/rectangleeditor.cpp @@ -103,6 +103,10 @@ CustomElementPart *RectangleEditor::currentPart() const { return m_part; } +QList RectangleEditor::currentParts() const { + return m_style->currentParts(); +} + /** * @brief RectangleEditor::topLeft * @return The edited topLeft already mapped to part coordinate diff --git a/sources/editor/ui/rectangleeditor.h b/sources/editor/ui/rectangleeditor.h index c872b6515..05c7eb272 100644 --- a/sources/editor/ui/rectangleeditor.h +++ b/sources/editor/ui/rectangleeditor.h @@ -42,6 +42,7 @@ class RectangleEditor : public ElementItemEditor bool setPart(CustomElementPart *part) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; QPointF editedTopLeft () const; public slots: diff --git a/sources/editor/ui/texteditor.cpp b/sources/editor/ui/texteditor.cpp index 3a0544078..7ede11b6a 100644 --- a/sources/editor/ui/texteditor.cpp +++ b/sources/editor/ui/texteditor.cpp @@ -28,7 +28,7 @@ * @param parent : the parent widget */ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *parent) : - ElementItemEditor(editor, parent), + ElementItemEditor(editor, parent), ui(new Ui::TextEditor) { ui->setupUi(this); @@ -164,6 +164,14 @@ CustomElementPart *TextEditor::currentPart() const { return m_text; } +QList TextEditor::currentParts() const { + QList parts; + for (auto part: m_parts) { + parts.append(static_cast(part)); + } + return parts; +} + /** * @brief TextEditor::setUpEditConnection * Setup the connection between the widgets of this editor and the undo command diff --git a/sources/editor/ui/texteditor.h b/sources/editor/ui/texteditor.h index 1f2e3d2e3..7772b0c25 100644 --- a/sources/editor/ui/texteditor.h +++ b/sources/editor/ui/texteditor.h @@ -41,6 +41,7 @@ class TextEditor : public ElementItemEditor bool setPart(CustomElementPart *part) override; bool setParts(QList ) override; CustomElementPart *currentPart() const override; + QList currentParts() const override; private slots: void on_m_font_pb_clicked();