mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-24 03:10:52 +01:00
Solves problem that terminals are not placed at the correct place
This commit is contained in:
@@ -650,8 +650,14 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
for(QGraphicsItem *qgi: childItems()) { // TODO: Where the Terminals are added as childs?
|
for(QGraphicsItem *qgi: childItems()) { // TODO: Where the Terminals are added as childs?
|
||||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
bool terminal_trouvee = false;
|
bool terminal_trouvee = false;
|
||||||
foreach(QDomElement qde, liste_terminals) {
|
for(QDomElement qde: liste_terminals) {
|
||||||
if (p -> fromXml(qde)) { // TODO: is there validXML enough? Because the Terminal was already read in the ElementCreation function
|
Terminal diagramTerminal(0,0, Qet::Orientation::East);
|
||||||
|
diagramTerminal.fromXml(qde);
|
||||||
|
QPointF dockPos1 = diagramTerminal.originPos(); // position here is directly the dock_elmt_ position (stored in the diagram)
|
||||||
|
QPointF dockPos2 = p->dockPos();
|
||||||
|
if (qFuzzyCompare(dockPos1.x(), dockPos2.x()) &&
|
||||||
|
qFuzzyCompare(dockPos1.y(), dockPos2.y()) &&
|
||||||
|
p->orientation() == diagramTerminal.orientation()) { // check if the part in the collection is the same as in the diagram stored
|
||||||
qDebug() << "Matching Terminal found.";
|
qDebug() << "Matching Terminal found.";
|
||||||
priv_id_adr.insert(qde.attribute("id").toInt(), p);
|
priv_id_adr.insert(qde.attribute("id").toInt(), p);
|
||||||
terminal_trouvee = true;
|
terminal_trouvee = true;
|
||||||
|
|||||||
@@ -811,6 +811,14 @@ QUuid Terminal::uuid() const {
|
|||||||
return d->m_uuid;
|
return d->m_uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPointF Terminal::dockPos() {
|
||||||
|
return dock_elmt_;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF Terminal::originPos() {
|
||||||
|
return d->m_pos;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Conductor::relatedPotentialTerminal
|
@brief Conductor::relatedPotentialTerminal
|
||||||
Return terminal at the same potential from the same
|
Return terminal at the same potential from the same
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
|
|||||||
Diagram *diagram () const;
|
Diagram *diagram () const;
|
||||||
Element *parentElement () const;
|
Element *parentElement () const;
|
||||||
QUuid uuid () const;
|
QUuid uuid () const;
|
||||||
|
QPointF dockPos();
|
||||||
|
QPointF originPos();
|
||||||
|
|
||||||
QList<Conductor *> conductors() const;
|
QList<Conductor *> conductors() const;
|
||||||
Qet::Orientation orientation() const;
|
Qet::Orientation orientation() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user