mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
ElementEditor: terminaleditor.cpp indentation, alignment and braces
This commit is contained in:
committed by
Laurent Trinques
parent
45edc34269
commit
b53c083d0a
@@ -26,8 +26,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
TerminalEditor::TerminalEditor(QETElementEditor* editor, QWidget* parent):
|
TerminalEditor::TerminalEditor(QETElementEditor* editor, QWidget* parent):
|
||||||
ElementItemEditor(editor, parent)
|
ElementItemEditor(editor, parent) {
|
||||||
{
|
|
||||||
m_part = nullptr;
|
m_part = nullptr;
|
||||||
m_terminals.clear();
|
m_terminals.clear();
|
||||||
init();
|
init();
|
||||||
@@ -42,8 +41,7 @@ TerminalEditor::TerminalEditor(QETElementEditor* editor, QWidget* parent):
|
|||||||
TerminalEditor::TerminalEditor(QETElementEditor *editor, QList<PartTerminal *> &terms, QWidget *parent) :
|
TerminalEditor::TerminalEditor(QETElementEditor *editor, QList<PartTerminal *> &terms, QWidget *parent) :
|
||||||
ElementItemEditor(editor, parent),
|
ElementItemEditor(editor, parent),
|
||||||
m_terminals(terms),
|
m_terminals(terms),
|
||||||
m_part(terms.first())
|
m_part(terms.first()) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,8 +80,6 @@ void TerminalEditor::init() {
|
|||||||
updateForm();
|
updateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Destructeur
|
/// Destructeur
|
||||||
TerminalEditor::~TerminalEditor() {
|
TerminalEditor::~TerminalEditor() {
|
||||||
};
|
};
|
||||||
@@ -96,21 +92,20 @@ TerminalEditor::~TerminalEditor() {
|
|||||||
@param new_part Nouvelle primitive a editer
|
@param new_part Nouvelle primitive a editer
|
||||||
@return true si l'editeur a accepter d'editer la primitive, false sinon
|
@return true si l'editeur a accepter d'editer la primitive, false sinon
|
||||||
*/
|
*/
|
||||||
bool TerminalEditor::setPart(CustomElementPart* new_part)
|
bool TerminalEditor::setPart(CustomElementPart* new_part) {
|
||||||
{
|
|
||||||
m_terminals.clear();
|
m_terminals.clear();
|
||||||
if (!new_part)
|
if (!new_part) {
|
||||||
{
|
if (m_part) {
|
||||||
if (m_part)
|
|
||||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||||
|
}
|
||||||
m_part = nullptr;
|
m_part = nullptr;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartTerminal *part_terminal = static_cast<PartTerminal *>(new_part))
|
if (PartTerminal *part_terminal = static_cast<PartTerminal *>(new_part)) {
|
||||||
{
|
|
||||||
if(m_part == part_terminal) return true;
|
if(m_part == part_terminal) return true;
|
||||||
if (m_part)
|
if (m_part) {
|
||||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||||
|
}
|
||||||
m_part = part_terminal;
|
m_part = part_terminal;
|
||||||
updateForm();
|
updateForm();
|
||||||
connect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
connect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||||
@@ -119,26 +114,26 @@ bool TerminalEditor::setPart(CustomElementPart* new_part)
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TerminalEditor::setParts(QList<CustomElementPart *> parts)
|
bool TerminalEditor::setParts(QList<CustomElementPart *> parts) {
|
||||||
{
|
if (parts.isEmpty()) {
|
||||||
if (parts.isEmpty())
|
|
||||||
{
|
|
||||||
m_terminals.clear();
|
m_terminals.clear();
|
||||||
if (m_part)
|
if (m_part) {
|
||||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||||
|
}
|
||||||
m_part = nullptr;
|
m_part = nullptr;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PartTerminal *part_terminal = static_cast<PartTerminal *>(parts.first()))
|
if (PartTerminal *part_terminal = static_cast<PartTerminal *>(parts.first())) {
|
||||||
{
|
if (m_part) {
|
||||||
if (m_part)
|
|
||||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||||
|
}
|
||||||
m_part = part_terminal;
|
m_part = part_terminal;
|
||||||
m_terminals.clear();
|
m_terminals.clear();
|
||||||
m_terminals.append(part_terminal);
|
m_terminals.append(part_terminal);
|
||||||
for (int i=1; i < parts.length(); i++)
|
for (int i=1; i < parts.length(); i++) {
|
||||||
m_terminals.append(static_cast<PartTerminal*>(parts[i]));
|
m_terminals.append(static_cast<PartTerminal*>(parts[i]));
|
||||||
|
}
|
||||||
updateForm();
|
updateForm();
|
||||||
connect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
connect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||||
return(true);
|
return(true);
|
||||||
@@ -162,8 +157,7 @@ QList<CustomElementPart*> TerminalEditor::currentParts() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Met a jour l'orientation de la borne et cree un objet d'annulation
|
/// Met a jour l'orientation de la borne et cree un objet d'annulation
|
||||||
void TerminalEditor::updateTerminalO()
|
void TerminalEditor::updateTerminalO() {
|
||||||
{
|
|
||||||
if (m_locked) return;
|
if (m_locked) return;
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
QVariant var(orientation -> itemData(orientation -> currentIndex()));
|
QVariant var(orientation -> itemData(orientation -> currentIndex()));
|
||||||
@@ -233,16 +227,13 @@ void TerminalEditor::updateForm() {
|
|||||||
Active ou desactive les connexionx signaux/slots entre les widgets internes.
|
Active ou desactive les connexionx signaux/slots entre les widgets internes.
|
||||||
@param active true pour activer les connexions, false pour les desactiver
|
@param active true pour activer les connexions, false pour les desactiver
|
||||||
*/
|
*/
|
||||||
void TerminalEditor::activeConnections(bool active)
|
void TerminalEditor::activeConnections(bool active) {
|
||||||
{
|
if (active) {
|
||||||
if (active)
|
|
||||||
{
|
|
||||||
connect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos);
|
connect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos);
|
||||||
connect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos);
|
connect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos);
|
||||||
connect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO);
|
connect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
disconnect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos);
|
disconnect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos);
|
||||||
disconnect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos);
|
disconnect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos);
|
||||||
disconnect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO);
|
disconnect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO);
|
||||||
|
|||||||
Reference in New Issue
Block a user