mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
move m_change_connections to ElementItemEditor, so it must not be defined by every editor it self
This commit is contained in:
@@ -47,8 +47,6 @@ class ArcEditor : public ElementItemEditor
|
|||||||
QSpinBox *angle, *start_angle;
|
QSpinBox *angle, *start_angle;
|
||||||
bool m_locked;
|
bool m_locked;
|
||||||
|
|
||||||
QList <QMetaObject::Connection> m_change_connections;
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
bool setPart(CustomElementPart *) override;
|
bool setPart(CustomElementPart *) override;
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ class ElementItemEditor : public QWidget
|
|||||||
private:
|
private:
|
||||||
virtual void updateFormPriv() = 0;
|
virtual void updateFormPriv() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QList<QMetaObject::Connection> m_change_connections;
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
QETElementEditor *element_editor;
|
QETElementEditor *element_editor;
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ DynamicTextFieldEditor::DynamicTextFieldEditor(QETElementEditor *editor,
|
|||||||
DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
if(!m_connection_list.isEmpty()) {
|
if(!m_change_connections.isEmpty()) {
|
||||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
for(const QMetaObject::Connection& con : m_change_connections) {
|
||||||
disconnect(con);
|
disconnect(con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,38 +182,38 @@ void DynamicTextFieldEditor::setupWidget()
|
|||||||
|
|
||||||
void DynamicTextFieldEditor::setUpConnections()
|
void DynamicTextFieldEditor::setUpConnections()
|
||||||
{
|
{
|
||||||
assert(m_connection_list.isEmpty());
|
assert(m_change_connections.isEmpty());
|
||||||
//Setup the connection
|
//Setup the connection
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::colorChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::fontChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::fontChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::taggChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::taggChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textFromChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::textFromChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::textChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::infoNameChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::infoNameChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::rotationChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::rotationChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::frameChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::frameChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textWidthChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::textWidthChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::compositeTextChanged,
|
m_change_connections << connect(m_text_field.data(), &PartDynamicTextField::compositeTextChanged,
|
||||||
[this](){this -> updateForm();});
|
[this](){this -> updateForm();});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicTextFieldEditor::disconnectConnections()
|
void DynamicTextFieldEditor::disconnectConnections()
|
||||||
{
|
{
|
||||||
//Remove previous connection
|
//Remove previous connection
|
||||||
if(!m_connection_list.isEmpty())
|
if(!m_change_connections.isEmpty())
|
||||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
for(const QMetaObject::Connection& con : m_change_connections) {
|
||||||
disconnect(con);
|
disconnect(con);
|
||||||
}
|
}
|
||||||
m_connection_list.clear();
|
m_change_connections.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ class DynamicTextFieldEditor : public ElementItemEditor {
|
|||||||
Ui::DynamicTextFieldEditor *ui;
|
Ui::DynamicTextFieldEditor *ui;
|
||||||
QPointer<PartDynamicTextField> m_text_field;
|
QPointer<PartDynamicTextField> m_text_field;
|
||||||
QList<PartDynamicTextField*> m_parts;
|
QList<PartDynamicTextField*> m_parts;
|
||||||
QList<QMetaObject::Connection> m_connection_list;
|
|
||||||
|
|
||||||
#ifdef BUILD_WITHOUT_KF5
|
#ifdef BUILD_WITHOUT_KF5
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class EllipseEditor : public ElementItemEditor
|
|||||||
Ui::EllipseEditor *ui;
|
Ui::EllipseEditor *ui;
|
||||||
PartEllipse *m_part = nullptr;
|
PartEllipse *m_part = nullptr;
|
||||||
StyleEditor *m_style = nullptr;
|
StyleEditor *m_style = nullptr;
|
||||||
QList <QMetaObject::Connection> m_change_connections;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class LineEditor : public ElementItemEditor
|
|||||||
PartLine *m_part = nullptr;
|
PartLine *m_part = nullptr;
|
||||||
Ui::LineEditor *ui;
|
Ui::LineEditor *ui;
|
||||||
StyleEditor *m_style = nullptr;
|
StyleEditor *m_style = nullptr;
|
||||||
QList <QMetaObject::Connection> m_change_connections;
|
|
||||||
bool m_locked = false;
|
bool m_locked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class PolygonEditor : public ElementItemEditor
|
|||||||
Ui::PolygonEditor *ui;
|
Ui::PolygonEditor *ui;
|
||||||
StyleEditor *m_style = nullptr;
|
StyleEditor *m_style = nullptr;
|
||||||
PartPolygon *m_part = nullptr;
|
PartPolygon *m_part = nullptr;
|
||||||
QList <QMetaObject::Connection> m_change_connections;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // POLYGONEDITOR_H
|
#endif // POLYGONEDITOR_H
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ class RectangleEditor : public ElementItemEditor
|
|||||||
StyleEditor *m_style;
|
StyleEditor *m_style;
|
||||||
PartRectangle *m_part;
|
PartRectangle *m_part;
|
||||||
Ui::RectangleEditor *ui;
|
Ui::RectangleEditor *ui;
|
||||||
QList <QMetaObject::Connection> m_change_connections;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RECTANGLEEDITOR_H
|
#endif // RECTANGLEEDITOR_H
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ class TerminalEditor : public ElementItemEditor
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TerminalEditor *ui;
|
Ui::TerminalEditor *ui;
|
||||||
QVector<QMetaObject::Connection> m_editor_connections,
|
QVector<QMetaObject::Connection> m_editor_connections;
|
||||||
m_change_connections;
|
|
||||||
PartTerminal *m_part = nullptr;
|
PartTerminal *m_part = nullptr;
|
||||||
bool m_locked = false;
|
bool m_locked = false;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user