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>
|
||||
|
||||
TerminalEditor::TerminalEditor(QETElementEditor* editor, QWidget* parent):
|
||||
ElementItemEditor(editor, parent)
|
||||
{
|
||||
ElementItemEditor(editor, parent) {
|
||||
m_part = nullptr;
|
||||
m_terminals.clear();
|
||||
init();
|
||||
@@ -42,8 +41,7 @@ TerminalEditor::TerminalEditor(QETElementEditor* editor, QWidget* parent):
|
||||
TerminalEditor::TerminalEditor(QETElementEditor *editor, QList<PartTerminal *> &terms, QWidget *parent) :
|
||||
ElementItemEditor(editor, parent),
|
||||
m_terminals(terms),
|
||||
m_part(terms.first())
|
||||
{
|
||||
m_part(terms.first()) {
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -82,8 +80,6 @@ void TerminalEditor::init() {
|
||||
updateForm();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Destructeur
|
||||
TerminalEditor::~TerminalEditor() {
|
||||
};
|
||||
@@ -96,21 +92,20 @@ TerminalEditor::~TerminalEditor() {
|
||||
@param new_part Nouvelle primitive a editer
|
||||
@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();
|
||||
if (!new_part)
|
||||
{
|
||||
if (m_part)
|
||||
if (!new_part) {
|
||||
if (m_part) {
|
||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||
}
|
||||
m_part = nullptr;
|
||||
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)
|
||||
if (m_part) {
|
||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||
}
|
||||
m_part = part_terminal;
|
||||
updateForm();
|
||||
connect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||
@@ -119,26 +114,26 @@ bool TerminalEditor::setPart(CustomElementPart* new_part)
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool TerminalEditor::setParts(QList<CustomElementPart *> parts)
|
||||
{
|
||||
if (parts.isEmpty())
|
||||
{
|
||||
bool TerminalEditor::setParts(QList<CustomElementPart *> parts) {
|
||||
if (parts.isEmpty()) {
|
||||
m_terminals.clear();
|
||||
if (m_part)
|
||||
if (m_part) {
|
||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||
}
|
||||
m_part = nullptr;
|
||||
return(true);
|
||||
}
|
||||
|
||||
if (PartTerminal *part_terminal = static_cast<PartTerminal *>(parts.first()))
|
||||
{
|
||||
if (m_part)
|
||||
if (PartTerminal *part_terminal = static_cast<PartTerminal *>(parts.first())) {
|
||||
if (m_part) {
|
||||
disconnect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||
}
|
||||
m_part = part_terminal;
|
||||
m_terminals.clear();
|
||||
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]));
|
||||
}
|
||||
updateForm();
|
||||
connect(m_part, &PartTerminal::orientationChanged, this, &TerminalEditor::updateForm);
|
||||
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
|
||||
void TerminalEditor::updateTerminalO()
|
||||
{
|
||||
void TerminalEditor::updateTerminalO() {
|
||||
if (m_locked) return;
|
||||
m_locked = true;
|
||||
QVariant var(orientation -> itemData(orientation -> currentIndex()));
|
||||
@@ -233,16 +227,13 @@ void TerminalEditor::updateForm() {
|
||||
Active ou desactive les connexionx signaux/slots entre les widgets internes.
|
||||
@param active true pour activer les connexions, false pour les desactiver
|
||||
*/
|
||||
void TerminalEditor::activeConnections(bool active)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
void TerminalEditor::activeConnections(bool active) {
|
||||
if (active) {
|
||||
connect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos);
|
||||
connect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos);
|
||||
connect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
disconnect(qle_x, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateXPos);
|
||||
disconnect(qle_y, &QDoubleSpinBox::editingFinished, this, &TerminalEditor::updateYPos);
|
||||
disconnect(orientation, QOverload<int>::of(&QComboBox::activated), this, &TerminalEditor::updateTerminalO);
|
||||
|
||||
Reference in New Issue
Block a user