implement currentParts() for every elementItemEditor so the editor can be extended to multi part edit in a later step

This commit is contained in:
Martin Marmsoler
2020-06-01 20:45:01 +02:00
committed by Laurent Trinques
parent 1ccffda93b
commit e36a4ddd0a
19 changed files with 62 additions and 3 deletions

View File

@@ -30,7 +30,7 @@
#include <QColorDialog>
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<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
QList<CustomElementPart*> parts;
for (auto part: m_parts) {
parts.append(static_cast<CustomElementPart*>(part));
}
return parts;
}
void DynamicTextFieldEditor::updateForm()
{
if(m_text_field)

View File

@@ -40,6 +40,7 @@ class DynamicTextFieldEditor : public ElementItemEditor
bool setPart(CustomElementPart *part) override;
bool setParts(QList <CustomElementPart *>) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart*> currentParts() const override;
void updateForm() override;
private:

View File

@@ -98,6 +98,10 @@ CustomElementPart *PolygonEditor::currentPart() const {
return m_part;
}
QList<CustomElementPart*> PolygonEditor::currentParts() const {
return m_style->currentParts();
}
/**
* @brief PolygonEditor::updateForm
* Update the widget

View File

@@ -38,6 +38,7 @@ class PolygonEditor : public ElementItemEditor
bool setPart(CustomElementPart *part) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart*> currentParts() const override;
void updateForm() override;
QVector<QPointF> pointsFromTree();
bool eventFilter(QObject *watched, QEvent *event) override;

View File

@@ -103,6 +103,10 @@ CustomElementPart *RectangleEditor::currentPart() const {
return m_part;
}
QList<CustomElementPart*> RectangleEditor::currentParts() const {
return m_style->currentParts();
}
/**
* @brief RectangleEditor::topLeft
* @return The edited topLeft already mapped to part coordinate

View File

@@ -42,6 +42,7 @@ class RectangleEditor : public ElementItemEditor
bool setPart(CustomElementPart *part) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart*> currentParts() const override;
QPointF editedTopLeft () const;
public slots:

View File

@@ -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<CustomElementPart*> TextEditor::currentParts() const {
QList<CustomElementPart*> parts;
for (auto part: m_parts) {
parts.append(static_cast<CustomElementPart*>(part));
}
return parts;
}
/**
* @brief TextEditor::setUpEditConnection
* Setup the connection between the widgets of this editor and the undo command

View File

@@ -41,6 +41,7 @@ class TextEditor : public ElementItemEditor
bool setPart(CustomElementPart *part) override;
bool setParts(QList <CustomElementPart *>) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart*> currentParts() const override;
private slots:
void on_m_font_pb_clicked();