mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-13 12:29:59 +01:00
implement currentParts() for every elementItemEditor so the editor can be extended to multi part edit in a later step
This commit is contained in:
committed by
Laurent Trinques
parent
1ccffda93b
commit
e36a4ddd0a
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user