reimplement Priv function, so the ElementEditor gets called automatically

This commit is contained in:
Martin 2021-03-05 17:38:51 +01:00
parent 6887c543da
commit bc88f2ec2e
20 changed files with 35 additions and 24 deletions

View File

@ -210,7 +210,7 @@ void ArcEditor::updateArcA()
@brief ArcEditor::updateForm
Update the value of the widgets
*/
void ArcEditor::updateForm()
void ArcEditor::updateFormPriv()
{
if (!m_part) return;
activeConnections(false);

View File

@ -59,7 +59,7 @@ class ArcEditor : public ElementItemEditor
public slots:
void updateArcS();
void updateArcA();
void updateForm() override;
void updateFormPriv() override;
void updateRect();
private:

View File

@ -42,6 +42,11 @@ ElementScene *ElementItemEditor::elementScene() const
return(element_editor -> elementScene());
}
void ElementItemEditor::updateForm()
{
updateFormPriv();
}
/// @return la QUndoStack a utiliser pour les annulations
QUndoStack &ElementItemEditor::undoStack() const
{

View File

@ -55,7 +55,13 @@ class ElementItemEditor : public QWidget
virtual CustomElementPart *currentPart() const = 0;
virtual QList<CustomElementPart*> currentParts() const = 0;
virtual void updateForm() = 0;
/*!
* \brief updateForm
* update the values of the widget
*/
virtual void updateForm();
private:
virtual void updateFormPriv() = 0;
// attributes
private:

View File

@ -440,10 +440,10 @@ void StyleEditor::updatePartFilling()
}
/**
@brief StyleEditor::updateForm
@brief StyleEditor::updateFormPriv
Update the edition form according to the value of edited part(s)
*/
void StyleEditor::updateForm()
void StyleEditor::updateFormPriv()
{
if (!part && m_part_list.isEmpty()) return;
activeConnections(false);

View File

@ -60,7 +60,7 @@ class StyleEditor : public ElementItemEditor
static bool isStyleEditable (QList <CustomElementPart *> cep_list);
public slots:
void updateForm() override;
void updateFormPriv() override;
void updatePartAntialiasing();
void updatePartColor();
void updatePartLineStyle();

View File

@ -130,7 +130,7 @@ QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const
return parts;
}
void DynamicTextFieldEditor::updateForm()
void DynamicTextFieldEditor::updateFormPriv()
{
if(m_text_field) {
ui -> m_x_sb -> setValue(m_text_field.data() -> x());

View File

@ -45,7 +45,7 @@ class DynamicTextFieldEditor : public ElementItemEditor {
bool setParts(QList <CustomElementPart *>) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart*> currentParts() const override;
void updateForm() override;
void updateFormPriv() override;
private:
void setupWidget();

View File

@ -110,9 +110,9 @@ QList<CustomElementPart *> EllipseEditor::currentParts() const {
}
/**
* @brief EllipseEditor::updateForm
* @brief EllipseEditor::updateFormPriv
*/
void EllipseEditor::updateForm()
void EllipseEditor::updateFormPriv()
{
if (!m_part) {
return;

View File

@ -43,7 +43,7 @@ class EllipseEditor : public ElementItemEditor
bool setParts(QList<CustomElementPart *> parts) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart*> currentParts() const override;
void updateForm() override;
void updateFormPriv() override;
private slots:
void on_m_x_sb_editingFinished();

View File

@ -176,10 +176,10 @@ QList<CustomElementPart *> LineEditor::currentParts() const {
}
/**
@brief LineEditor::updateForm
@brief LineEditor::updateFormPriv
Reimplemented from ElementItemEditor
*/
void LineEditor::updateForm()
void LineEditor::updateFormPriv()
{
if (!m_part) {
return;

View File

@ -43,7 +43,7 @@ class LineEditor : public ElementItemEditor
bool setParts(QList <CustomElementPart *> parts) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart *> currentParts() const override;
void updateForm() override;
void updateFormPriv() override;
private:
void setUpChangeConnections();

View File

@ -130,10 +130,10 @@ QList<CustomElementPart*> PolygonEditor::currentParts() const
}
/**
@brief PolygonEditor::updateForm
@brief PolygonEditor::updateFormPriv
Update the widget
*/
void PolygonEditor::updateForm()
void PolygonEditor::updateFormPriv()
{
if (!m_part) {
return;

View File

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

View File

@ -136,7 +136,7 @@ QPointF RectangleEditor::editedTopLeft() const
/**
@brief RectangleEditor::updateForm
*/
void RectangleEditor::updateForm()
void RectangleEditor::updateFormPriv()
{
if (!m_part) {
return;

View File

@ -48,7 +48,7 @@ class RectangleEditor : public ElementItemEditor
QPointF editedTopLeft () const;
public slots:
void updateForm() override;
void updateFormPriv() override;
private:
void editingFinished();
void activeConnections(bool active);

View File

@ -46,11 +46,11 @@ TerminalEditor::~TerminalEditor()
}
/**
* @brief TerminalEditor::updateForm
* @brief TerminalEditor::updateFormPriv
* Reimplemented from ElementItemEditor
* Update the content of this widget
*/
void TerminalEditor::updateForm()
void TerminalEditor::updateFormPriv()
{
if (!m_part) {
return;

View File

@ -39,7 +39,7 @@ class TerminalEditor : public ElementItemEditor
TerminalEditor(QETElementEditor *editor, QWidget *parent = nullptr);
~TerminalEditor() override;
void updateForm() override;
void updateFormPriv() override;
bool setPart(CustomElementPart *new_part) override;
CustomElementPart *currentPart() const override;
QList<CustomElementPart *> currentParts() const override {return QList<CustomElementPart *>();}

View File

@ -48,7 +48,7 @@ TextEditor::~TextEditor() {}
@brief TextEditor::updateForm
Update the gui
*/
void TextEditor::updateForm()
void TextEditor::updateFormPriv()
{
if (m_text.isNull()) {
return;

View File

@ -38,7 +38,7 @@ class TextEditor : public ElementItemEditor {
explicit TextEditor(QETElementEditor *editor, PartText *text = nullptr, QWidget *parent = nullptr);
~TextEditor() override;
void updateForm() override;
void updateFormPriv() override;
bool setPart(CustomElementPart *part) override;
bool setParts(QList <CustomElementPart *>) override;
CustomElementPart *currentPart() const override;