mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-20 15:24:14 +02:00
Revert "Feature: Terminal potential grouping"
This commit is contained in:
@@ -476,13 +476,6 @@ void PartTerminal::setMasterLabelIndex(int index)
|
||||
emit masterLabelIndexChanged();
|
||||
}
|
||||
|
||||
void PartTerminal::setPotential(const QString &potential)
|
||||
{
|
||||
if (d->m_potential == potential) return;
|
||||
d->m_potential = potential;
|
||||
emit potentialChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
Updates the position of the second point according to the position
|
||||
and orientation of the terminal.
|
||||
|
||||
@@ -44,7 +44,6 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
Q_PROPERTY(QColor label_color READ labelColor WRITE setLabelColor)
|
||||
Q_PROPERTY(bool use_master_label READ useMasterLabel WRITE setUseMasterLabel)
|
||||
Q_PROPERTY(int master_label_index READ masterLabelIndex WRITE setMasterLabelIndex)
|
||||
Q_PROPERTY(QString potential READ potential WRITE setPotential)
|
||||
|
||||
public:
|
||||
// constructors, destructor
|
||||
@@ -57,7 +56,6 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
void orientationChanged();
|
||||
void nameChanged();
|
||||
void terminalTypeChanged();
|
||||
void potentialChanged();
|
||||
void showNameChanged();
|
||||
void labelPosChanged();
|
||||
void labelFontChanged();
|
||||
@@ -142,9 +140,6 @@ class PartTerminal : public CustomElementGraphicPart
|
||||
int masterLabelIndex() const { return d->m_master_label_index; }
|
||||
void setMasterLabelIndex(int index);
|
||||
|
||||
QString potential() const { return d->m_potential; }
|
||||
void setPotential(const QString &potential);
|
||||
|
||||
void setNewUuid();
|
||||
|
||||
QRectF labelRect() const;
|
||||
|
||||
@@ -84,7 +84,6 @@ void TerminalEditor::updateForm()
|
||||
ui->m_orientation_cb->setCurrentIndex(ui->m_orientation_cb->findData(m_part->property("orientation")));
|
||||
ui->m_name_le->setText(m_part->terminalName());
|
||||
ui->m_type_cb->setCurrentIndex(ui->m_type_cb->findData(m_part->terminalType()));
|
||||
ui->m_potential_le->setText(m_part->potential());
|
||||
|
||||
ui->m_show_name_cb->setChecked(m_part->showName());
|
||||
ui->m_label_x_dsb->setValue(m_part->labelPos().x());
|
||||
@@ -264,24 +263,6 @@ void TerminalEditor::nameEdited()
|
||||
m_locked=false;
|
||||
}
|
||||
|
||||
void TerminalEditor::potentialEdited()
|
||||
{
|
||||
if (m_locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_locked = true;
|
||||
QString potential_(ui->m_potential_le->text());
|
||||
|
||||
if (m_part->potential() != potential_)
|
||||
{
|
||||
auto undo = new QPropertyUndoCommand(m_part, "potential", m_part->property("potential"), potential_);
|
||||
undo->setText(tr("Modifier le potentiel d'une borne"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
m_locked = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalEditor::typeEdited
|
||||
*/
|
||||
@@ -476,8 +457,6 @@ void TerminalEditor::activeConnections(bool active)
|
||||
this, &TerminalEditor::labelAlignClicked);
|
||||
m_editor_connections << connect(ui->m_label_frame_cb, &QCheckBox::toggled,
|
||||
this, &TerminalEditor::labelFrameEdited);
|
||||
m_editor_connections << connect(ui->m_potential_le, &QLineEdit::editingFinished,
|
||||
this, &TerminalEditor::potentialEdited);
|
||||
m_editor_connections << connect(ui->m_use_master_label_cb, &QCheckBox::toggled,
|
||||
this, &TerminalEditor::useMasterLabelEdited);
|
||||
m_editor_connections << connect(ui->m_master_label_cb, QOverload<int>::of(&QComboBox::activated),
|
||||
@@ -507,7 +486,6 @@ void TerminalEditor::activeChangeConnections(bool active)
|
||||
m_change_connections << connect(m_part, &PartTerminal::labelVAlignmentChanged, this, &TerminalEditor::updateForm);
|
||||
m_change_connections << connect(m_part, &PartTerminal::labelFrameChanged, this, &TerminalEditor::updateForm);
|
||||
m_change_connections << connect(m_part, &PartTerminal::labelColorChanged, this, &TerminalEditor::updateForm);
|
||||
m_change_connections << connect(m_part, &PartTerminal::potentialChanged, this, &TerminalEditor::updateForm);
|
||||
m_change_connections << connect(m_part, &PartTerminal::useMasterLabelChanged, this, &TerminalEditor::updateForm);
|
||||
m_change_connections << connect(m_part, &PartTerminal::masterLabelIndexChanged, this, &TerminalEditor::updateForm);
|
||||
} else {
|
||||
|
||||
@@ -58,7 +58,6 @@ class TerminalEditor : public ElementItemEditor
|
||||
void orientationEdited();
|
||||
void nameEdited();
|
||||
void typeEdited();
|
||||
void potentialEdited();
|
||||
void showNameEdited();
|
||||
void labelPosEdited();
|
||||
void labelFontClicked();
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="m_name_le"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
@@ -61,7 +61,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Nom :</string>
|
||||
@@ -78,21 +78,7 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="m_type_cb"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_potential">
|
||||
<property name="text">
|
||||
<string>Potentiel:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="m_potential_le">
|
||||
<property name="toolTip">
|
||||
<string>Sans effet si "Isolation du potentiel" n'est pas cochée (toutes les bornes du bloc restent alors reliées). Si elle est cochée : les bornes partageant la même valeur restent reliées entre elles, les autres sont isolées.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_label_gb">
|
||||
<property name="title">
|
||||
<string>Nom de la borne</string>
|
||||
@@ -228,7 +214,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_master_label_gb">
|
||||
<property name="title">
|
||||
<string>Étiquette du maître</string>
|
||||
|
||||
@@ -129,9 +129,6 @@ QDomElement TerminalData::toXml(QDomDocument &xml_document) const
|
||||
xml_element.setAttribute("label_color", m_label_color.name());
|
||||
}
|
||||
|
||||
if (!m_potential.isEmpty())
|
||||
xml_element.setAttribute("potential", m_potential);
|
||||
|
||||
// Save master label override settings
|
||||
if (m_use_master_label) {
|
||||
xml_element.setAttribute("use_master_label", "true");
|
||||
@@ -210,8 +207,6 @@ bool TerminalData::fromXml (const QDomElement &xml_element)
|
||||
m_label_color = QColor(color_str);
|
||||
}
|
||||
|
||||
m_potential = xml_element.attribute("potential");
|
||||
|
||||
// Read master label override settings
|
||||
m_use_master_label = (xml_element.attribute("use_master_label") == QLatin1String("true"));
|
||||
m_master_label_index = xml_element.attribute("master_label_index", "0").toInt();
|
||||
|
||||
@@ -103,18 +103,6 @@ class TerminalData : public PropertiesInterface
|
||||
*/
|
||||
QString m_name;
|
||||
|
||||
/**
|
||||
@brief m_potential
|
||||
An optional, symbol-author-chosen grouping identifier shared by
|
||||
terminals that belong to the same physical terminal within
|
||||
a multi-terminal block. When potential_isolating is enabled
|
||||
on the parent element, terminals sharing a non-empty,
|
||||
matching m_potential stay linked to each other; terminals
|
||||
with different (or empty) values become isolated from each
|
||||
other. Empty by default.
|
||||
*/
|
||||
QString m_potential;
|
||||
|
||||
/**
|
||||
@brief m_pos
|
||||
Position of the terminal. The second point is calculated
|
||||
|
||||
@@ -927,18 +927,6 @@ TerminalData::Type Terminal::terminalType() const
|
||||
return d->m_type;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Terminal::potential
|
||||
@return this terminal's own potential-group identifier (@see
|
||||
TerminalData::m_potential).
|
||||
An author-chosen grouping used only
|
||||
within a single multi-terminal element.
|
||||
*/
|
||||
QString Terminal::potential() const
|
||||
{
|
||||
return d->m_potential;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Terminal::setUseMasterLabel
|
||||
Set whether this terminal uses a label from the master's contact group
|
||||
@@ -989,22 +977,8 @@ QList<Terminal *> relatedPotentialTerminal (
|
||||
{
|
||||
// English: Check if the user activated the potential isolation checkbox for this terminal
|
||||
if (terminal->parentElement()->elementInformations().value(QStringLiteral("potential_isolating")).toString() == QLatin1String("true")) {
|
||||
// English: Potential is isolated -- but terminals sharing this
|
||||
// terminal's own, non-empty potential-group identifier
|
||||
// (@see TerminalData::m_potential, set per-terminal in the
|
||||
// element editor) still belong to the same physical terminal
|
||||
// and stay linked to each other. An empty/unset potential on
|
||||
// every terminal reproduces the previous, fully-isolated
|
||||
// behavior exactly, so existing elements are unaffected.
|
||||
const QString this_potential = terminal->potential();
|
||||
QList<Terminal *> same_potential;
|
||||
if (!this_potential.isEmpty()) {
|
||||
for (Terminal *t : terminal->parentElement()->terminals()) {
|
||||
if (t != terminal && t->potential() == this_potential)
|
||||
same_potential << t;
|
||||
}
|
||||
}
|
||||
return same_potential;
|
||||
// English: Potential is isolated. Return an empty list so it does not propagate to the other side.
|
||||
return QList<Terminal *>();
|
||||
}
|
||||
|
||||
QList <Terminal *> terminals = terminal->parentElement()->terminals();
|
||||
|
||||
@@ -79,7 +79,6 @@ class Terminal : public QGraphicsObject
|
||||
QString name () const;
|
||||
QString baseName () const;
|
||||
TerminalData::Type terminalType() const;
|
||||
QString potential() const;
|
||||
bool useMasterLabel() const { return d->m_use_master_label; }
|
||||
void setUseMasterLabel(bool use);
|
||||
int masterLabelIndex() const { return d->m_master_label_index; }
|
||||
|
||||
Reference in New Issue
Block a user