From 68a2ddde18f94e75dc90d97b173f866d44e78428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hellstr=C3=B6mer?= Date: Sun, 8 Sep 2024 16:15:59 +0200 Subject: [PATCH 01/10] New variables for conductor text formulas --- sources/autoNum/assignvariables.cpp | 22 +++++++++++++++++----- sources/autoNum/assignvariables.h | 6 ++++-- sources/qetgraphicsitem/conductor.cpp | 4 ++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sources/autoNum/assignvariables.cpp b/sources/autoNum/assignvariables.cpp index 8fdec27d8..d5e76d5c5 100644 --- a/sources/autoNum/assignvariables.cpp +++ b/sources/autoNum/assignvariables.cpp @@ -20,6 +20,7 @@ #include "../diagram.h" #include "../diagramposition.h" #include "../qetapp.h" +#include "../qetgraphicsitem/conductor.h" #include "../qetgraphicsitem/element.h" #include "../qetxml.h" @@ -189,12 +190,14 @@ namespace autonum QString AssignVariables::formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, - const Element *elmt) + const Element *elmt, + const Conductor *cndr) { AssignVariables av(std::move(formula), seqStruct, diagram, - elmt); + elmt, + cndr); seqStruct = av.m_seq_struct; return av.m_assigned_label; } @@ -301,13 +304,14 @@ namespace autonum AssignVariables::AssignVariables(const QString& formula, const sequentialNumbers& seqStruct, Diagram *diagram, - const Element *elmt): + const Element *elmt, + const Conductor *cndr): m_diagram(diagram), m_arg_formula(formula), m_assigned_label(formula), m_seq_struct(seqStruct), - m_element(elmt) - + m_element(elmt), + m_conductor(cndr) { if (m_diagram) { @@ -349,6 +353,14 @@ namespace autonum m_assigned_label.replace("%prefix", m_element->getPrefix()); } + if (m_conductor) + { + m_assigned_label.replace("%wf", cndr->properties().m_function); + m_assigned_label.replace("%wv", cndr->properties().m_tension_protocol); + m_assigned_label.replace("%wc", cndr->properties().m_wire_color); + m_assigned_label.replace("%ws", cndr->properties().m_wire_section); + } + assignTitleBlockVar(); assignProjectVar(); assignSequence(); diff --git a/sources/autoNum/assignvariables.h b/sources/autoNum/assignvariables.h index e60b987ab..c5eacd6f2 100644 --- a/sources/autoNum/assignvariables.h +++ b/sources/autoNum/assignvariables.h @@ -24,6 +24,7 @@ #include #include +class Conductor; class Diagram; class Element; class ElementsLocation; @@ -61,12 +62,12 @@ namespace autonum class AssignVariables { public: - static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr); + static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr, const Conductor *cndr = nullptr); static QString replaceVariable (const QString &formula, const DiagramContext &dc); static QString genericXref (const Element *element); private: - AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr); + AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr, const Conductor *cndr = nullptr); void assignTitleBlockVar(); void assignProjectVar(); void assignSequence(); @@ -76,6 +77,7 @@ namespace autonum QString m_assigned_label; sequentialNumbers m_seq_struct; const Element *m_element = nullptr; + const Conductor *m_conductor = nullptr; }; void setSequentialToList(QStringList &list, NumerotationContext &nc, const QString& type); diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index af19847d9..445b972bd 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1505,7 +1505,7 @@ void Conductor::refreshText() { if (diagram()) { - QString text = autonum::AssignVariables::formulaToLabel(m_properties.m_formula, m_autoNum_seq, diagram()); + QString text = autonum::AssignVariables::formulaToLabel(m_properties.m_formula, m_autoNum_seq, diagram(), nullptr, this); m_properties.text = text; m_text_item->setPlainText(text); } @@ -1590,7 +1590,7 @@ void Conductor::setProperties(const ConductorProperties &property) { if (diagram()) { - QString text = autonum::AssignVariables::formulaToLabel(m_properties.m_formula, m_autoNum_seq, diagram()); + QString text = autonum::AssignVariables::formulaToLabel(m_properties.m_formula, m_autoNum_seq, diagram(), nullptr, this); m_properties.text = text; } else if (m_properties.text.isEmpty()) From 78ee65a21b35a01b453d5dd7cd56169c14238ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Hellstr=C3=B6mer?= Date: Fri, 27 Sep 2024 22:56:08 +0200 Subject: [PATCH 02/10] Added option to only move dynamic texts --- .../dynamicelementtextitem.cpp | 72 ++++++++++++------- .../qetgraphicsitem/dynamicelementtextitem.h | 1 + sources/qetgraphicsitem/element.h | 1 + 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 2e85b67b5..0cbf616d4 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -545,8 +545,16 @@ void DynamicElementTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) if(m_slave_Xref_item) m_slave_Xref_item->setDefaultTextColor(Qt::black); } - - DiagramTextItem::mousePressEvent(event); + + // Shift or no parent initiates movement of dynamic text, otherwise movement of parent element + if(event->modifiers() & Qt::ShiftModifier || !m_parent_element) + { + m_move_parent = false; + DiagramTextItem::mousePressEvent(event); + } else { + m_move_parent = true; + parentElement()->mousePressEvent(event); + } } /** @@ -557,26 +565,31 @@ void DynamicElementTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if((event->buttons() & Qt::LeftButton) && (flags() & ItemIsMovable)) { - if(diagram() && m_first_move) - diagram()->elementTextsMover().beginMovement(diagram(), this); - - if(m_first_move) + if(m_move_parent) { - m_initial_position = pos(); - if(parentElement()) - parentElement()->setHighlighted(true); + parentElement()->mouseMoveEvent(event); + } else { + if(diagram() && m_first_move) + diagram()->elementTextsMover().beginMovement(diagram(), this); + + if(m_first_move) + { + m_initial_position = pos(); + if(parentElement()) + parentElement()->setHighlighted(true); + } + + QPointF current_parent_pos; + QPointF button_down_parent_pos; + current_parent_pos = mapToParent(mapFromScene(event->scenePos())); + button_down_parent_pos = mapToParent(mapFromScene(event->buttonDownScenePos(Qt::LeftButton))); + + QPointF new_pos = m_initial_position + current_parent_pos - button_down_parent_pos; + event->modifiers() == Qt::ControlModifier ? setPos(new_pos) : setPos(Diagram::snapToGrid(new_pos)); + + if(diagram()) + diagram()->elementTextsMover().continueMovement(event); } - - QPointF current_parent_pos; - QPointF button_down_parent_pos; - current_parent_pos = mapToParent(mapFromScene(event->scenePos())); - button_down_parent_pos = mapToParent(mapFromScene(event->buttonDownScenePos(Qt::LeftButton))); - - QPointF new_pos = m_initial_position + current_parent_pos - button_down_parent_pos; - event->modifiers() == Qt::ControlModifier ? setPos(new_pos) : setPos(Diagram::snapToGrid(new_pos)); - - if(diagram()) - diagram()->elementTextsMover().continueMovement(event); } else { event->ignore(); } @@ -591,14 +604,19 @@ void DynamicElementTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) */ void DynamicElementTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - if (m_parent_element) - m_parent_element->setHighlighted(false); + if(m_move_parent) + { + parentElement()->mouseReleaseEvent(event); + } else { + if (m_parent_element) + m_parent_element->setHighlighted(false); - if(m_parent_element && m_parent_element->diagram()) - m_parent_element.data()->diagram()->elementTextsMover().endMovement(); - - if(!(event->modifiers() & Qt::ControlModifier)) - QGraphicsTextItem::mouseReleaseEvent(event); + if(m_parent_element && m_parent_element->diagram()) + m_parent_element.data()->diagram()->elementTextsMover().endMovement(); + + if(!(event->modifiers() & Qt::ControlModifier)) + QGraphicsTextItem::mouseReleaseEvent(event); + } } /** diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.h b/sources/qetgraphicsitem/dynamicelementtextitem.h index 776d84377..98f50ce89 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.h +++ b/sources/qetgraphicsitem/dynamicelementtextitem.h @@ -170,6 +170,7 @@ class DynamicElementTextItem : public DiagramTextItem QPointF m_initial_position; bool m_keep_visual_rotation = true; qreal m_visual_rotation_ref = 0; + bool m_move_parent = true; }; #endif // DYNAMICELEMENTTEXTITEM_H diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index 22bd1f30a..4a0e9c55d 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -42,6 +42,7 @@ class ElementTextItemGroup; class Element : public QetGraphicsItem { friend class DiagramEventAddElement; + friend class DynamicElementTextItem; Q_OBJECT public: From 181680e6f1875ead0c2a5c40f51a47510923d6c5 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Sat, 22 Feb 2025 09:20:46 +0100 Subject: [PATCH 03/10] add English comments --- sources/diagramevent/diagrameventaddelement.cpp | 6 +++--- sources/qetgraphicsitem/terminal.cpp | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sources/diagramevent/diagrameventaddelement.cpp b/sources/diagramevent/diagrameventaddelement.cpp index c6c8bdb4d..2ac8f038e 100644 --- a/sources/diagramevent/diagrameventaddelement.cpp +++ b/sources/diagramevent/diagrameventaddelement.cpp @@ -248,9 +248,9 @@ void DiagramEventAddElement::addElement() QUndoCommand *undo_object = new QUndoCommand(tr("Ajouter %1").arg(element->name())); new AddGraphicsObjectCommand(element, m_diagram, m_element -> pos(), undo_object); - //When we search for free aligned terminal we - //temporally remove m_element to avoid any interaction with the function Element::AlignedFreeTerminals - //this is useful when an element who have two (or more) terminals opposite, + //When we search for free aligned terminal we temporally remove m_element to + //avoid any interaction with the function Element::AlignedFreeTerminals + //This is useful when an element has two (or more) terminals on opposite sides, //because m_element is exactly at the same pos of the new element //added to the scene so new conductor are created between terminal of the new element //and the opposite terminal of m_element. diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index b0028a0dc..205f6b33d 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -695,11 +695,15 @@ bool Terminal::valideXml(QDomElement &terminal) /** @brief Terminal::fromXml + Enables you to find out whether an XML element represents this terminal. + Warning, the XML element is not checked Permet de savoir si un element XML represente cette borne. Attention, l'element XML n'est pas verifie - @param terminal Le QDomElement a analyser + @param terminal Le QDomElement a analyser / QDomElement to check @return true si la borne "se reconnait" (memes coordonnes, meme orientation), false sinon + true, if the terminal ‘recognises’ itself (same coordinates, + same orientation), false otherwise */ bool Terminal::fromXml(QDomElement &terminal) { From 43386aa14fb1098d8e4527106eb4b2a1ec3914e1 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Sat, 22 Feb 2025 09:30:15 +0100 Subject: [PATCH 04/10] unify calls to "setRotation" for element-primitives --- sources/editor/editorcommands.cpp | 36 +++++++++---------- sources/editor/graphicspart/partarc.cpp | 4 ++- .../graphicspart/partdynamictextfield.cpp | 5 +-- sources/editor/graphicspart/partellipse.cpp | 4 ++- sources/editor/graphicspart/partline.cpp | 7 ++-- sources/editor/graphicspart/partpolygon.cpp | 5 +-- sources/editor/graphicspart/partrectangle.cpp | 4 ++- sources/editor/graphicspart/partterminal.cpp | 6 ++-- sources/editor/graphicspart/parttext.cpp | 5 +-- 9 files changed, 44 insertions(+), 32 deletions(-) diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index 1a013eefa..221143c44 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -541,19 +541,19 @@ void RotateElementsCommand::undo() } else if (item->type() == PartLine::Type) { PartLine* line = qgraphicsitem_cast(item); - line->setRotation(-90); + line->setRotation(line->rotation()-90); } else if (item->type() == PartPolygon::Type) { PartPolygon* poly = qgraphicsitem_cast(item); - poly->setRotation(-90); + poly->setRotation(poly->rotation()-90); } else if (item->type() == PartText::Type) { PartText* text = qgraphicsitem_cast(item); - text->setRotation(-90); + text->setRotation(text->rotation()-90); } else if (item->type() == PartDynamicTextField::Type) { PartDynamicTextField* dyntext = qgraphicsitem_cast(item); - dyntext->setRotation(-90); + dyntext->setRotation(dyntext->rotation()-90); } else { item->setRotation(item->rotation()-90); @@ -586,19 +586,19 @@ void RotateElementsCommand::redo() } else if (item->type() == PartLine::Type) { PartLine* line = qgraphicsitem_cast(item); - line->setRotation(+90); + line->setRotation(line->rotation()+90); } else if (item->type() == PartPolygon::Type) { PartPolygon* poly = qgraphicsitem_cast(item); - poly->setRotation(+90); + poly->setRotation(poly->rotation()+90); } else if (item->type() == PartText::Type) { PartText* text = qgraphicsitem_cast(item); - text->setRotation(+90); + text->setRotation(text->rotation()+90); } else if (item->type() == PartDynamicTextField::Type) { PartDynamicTextField* dyntext = qgraphicsitem_cast(item); - dyntext->setRotation(+90); + dyntext->setRotation(dyntext->rotation()+90); } else { item->setRotation(item->rotation()+90); @@ -622,22 +622,22 @@ void RotateFineElementsCommand::undo() { if (item->type() == PartLine::Type) { PartLine* line = qgraphicsitem_cast(item); - line->setRotation(-5); + line->setRotation(line->rotation()-5); } else if (item->type() == PartPolygon::Type) { PartPolygon* poly = qgraphicsitem_cast(item); - poly->setRotation(-5); + poly->setRotation(poly->rotation()-5); } else if (item->type() == PartText::Type) { PartText* text = qgraphicsitem_cast(item); - text->setRotation(-5); + text->setRotation(text->rotation()-5); } else if (item->type() == PartDynamicTextField::Type) { PartDynamicTextField* dyntext = qgraphicsitem_cast(item); - dyntext->setRotation(-5); + dyntext->setRotation(dyntext->rotation()-5); } else { - //item->setRotation(-5); + //item->setRotation(item->rotation()-5); } } } @@ -651,22 +651,22 @@ void RotateFineElementsCommand::redo() { if (item->type() == PartLine::Type) { PartLine* line = qgraphicsitem_cast(item); - line->setRotation(+5); + line->setRotation(line->rotation()+5); } else if (item->type() == PartPolygon::Type) { PartPolygon* poly = qgraphicsitem_cast(item); - poly->setRotation(+5); + poly->setRotation(poly->rotation()+5); } else if (item->type() == PartText::Type) { PartText* text = qgraphicsitem_cast(item); - text->setRotation(+5); + text->setRotation(text->rotation()+5); } else if (item->type() == PartDynamicTextField::Type) { PartDynamicTextField* dyntext = qgraphicsitem_cast(item); - dyntext->setRotation(+5); + dyntext->setRotation(dyntext->rotation()+5); } else { - //item->setRotation(+5); + //item->setRotation(item->rotation()+5); } } } diff --git a/sources/editor/graphicspart/partarc.cpp b/sources/editor/graphicspart/partarc.cpp index 822903757..ad340da67 100644 --- a/sources/editor/graphicspart/partarc.cpp +++ b/sources/editor/graphicspart/partarc.cpp @@ -172,8 +172,10 @@ QPainterPath PartArc::shadowShape() const void PartArc::setRotation(qreal angle) { + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + m_rot = QET::correctAngle(angle, true); // idea taken from QET_ElementScaler: -if (angle > 0) { + if (diffAngle > 0) { m_start_angle += 270.0 * 16; while (m_start_angle < 0) { m_start_angle += (360*16); } while (m_start_angle >= (360*16)) { m_start_angle -= (360*16); } diff --git a/sources/editor/graphicspart/partdynamictextfield.cpp b/sources/editor/graphicspart/partdynamictextfield.cpp index 1dd22c4d9..04f8a6332 100644 --- a/sources/editor/graphicspart/partdynamictextfield.cpp +++ b/sources/editor/graphicspart/partdynamictextfield.cpp @@ -67,8 +67,9 @@ QString PartDynamicTextField::xmlName() const @param angle */ void PartDynamicTextField::setRotation(qreal angle) { - QGraphicsObject::setRotation(QET::correctAngle(rotation()+angle, true)); - setPos(QTransform().rotate(angle).map(pos())); + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + QGraphicsObject::setRotation(QET::correctAngle(angle, true)); + setPos(QTransform().rotate(diffAngle).map(pos())); } void PartDynamicTextField::mirror() { diff --git a/sources/editor/graphicspart/partellipse.cpp b/sources/editor/graphicspart/partellipse.cpp index ae05841f3..fb9907a95 100644 --- a/sources/editor/graphicspart/partellipse.cpp +++ b/sources/editor/graphicspart/partellipse.cpp @@ -238,8 +238,10 @@ bool PartEllipse::sceneEventFilter(QGraphicsItem *watched, QEvent *event) void PartEllipse::setRotation(qreal angle) { + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + m_rot = QET::correctAngle(angle, true); // idea taken from QET_ElementScaler: - if (angle > 0) { + if (diffAngle > 0) { qreal width = m_rect.height(); qreal height = m_rect.width(); qreal x = (m_rect.y() + m_rect.height()) * (-1); diff --git a/sources/editor/graphicspart/partline.cpp b/sources/editor/graphicspart/partline.cpp index 94c7f8437..3856af0dc 100644 --- a/sources/editor/graphicspart/partline.cpp +++ b/sources/editor/graphicspart/partline.cpp @@ -579,9 +579,10 @@ void PartLine::setSecondEndLength(const qreal &l) } void PartLine::setRotation(qreal angle) { - m_rot += angle; - m_line.setP1(QTransform().rotate(angle).map(m_line.p1())); - m_line.setP2(QTransform().rotate(angle).map(m_line.p2())); + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + m_rot = QET::correctAngle(angle, true); + m_line.setP1(QTransform().rotate(diffAngle).map(m_line.p1())); + m_line.setP2(QTransform().rotate(diffAngle).map(m_line.p2())); prepareGeometryChange(); setLine(m_line); adjustHandlerPos(); diff --git a/sources/editor/graphicspart/partpolygon.cpp b/sources/editor/graphicspart/partpolygon.cpp index 9a3e019f9..30c5a2a0b 100644 --- a/sources/editor/graphicspart/partpolygon.cpp +++ b/sources/editor/graphicspart/partpolygon.cpp @@ -297,8 +297,9 @@ void PartPolygon::resetAllHandlerColor() void PartPolygon::setRotation(qreal angle) { - QTransform rotation = QTransform().rotate(angle); - m_rot += angle; + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + m_rot = QET::correctAngle(angle, true); + QTransform rotation = QTransform().rotate(diffAngle); setPolygon(rotation.map(m_polygon)); prepareGeometryChange(); adjustHandlerPos(); diff --git a/sources/editor/graphicspart/partrectangle.cpp b/sources/editor/graphicspart/partrectangle.cpp index 96c6910ca..7d4d27f2a 100644 --- a/sources/editor/graphicspart/partrectangle.cpp +++ b/sources/editor/graphicspart/partrectangle.cpp @@ -168,12 +168,14 @@ void PartRectangle::setYRadius(qreal Y) } void PartRectangle::setRotation(qreal angle) { + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + m_rot = QET::correctAngle(angle, true); // for whatever reason: with "rect" we need to use scene-positions... auto pos = mapToScene(m_rect.x(),m_rect.y()); qreal width = m_rect.height(); qreal height = m_rect.width(); qreal x; qreal y; - if (angle > 0) { + if (diffAngle > 0) { x = (pos.y() + m_rect.height()) * (-1); y = pos.x(); } else { diff --git a/sources/editor/graphicspart/partterminal.cpp b/sources/editor/graphicspart/partterminal.cpp index 2c99e7c88..8e1a67e00 100644 --- a/sources/editor/graphicspart/partterminal.cpp +++ b/sources/editor/graphicspart/partterminal.cpp @@ -42,8 +42,9 @@ PartTerminal::~PartTerminal() } /** + Import terminal properties from an XML element Importe les proprietes d'une borne depuis un element XML - @param xml_elmt Element XML a lire + @param xml_elmt Element XML a lire / XML element to read */ void PartTerminal::fromXml(const QDomElement &xml_elmt) { d -> fromXml(xml_elmt); @@ -166,8 +167,9 @@ void PartTerminal::setRotation(qreal angle) { else if (180 <= angle_mod && angle_mod < 270) new_ori = Qet::South; else new_ori = Qet::West; + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; double tmp, y, x; - if (angle > 0) { + if (diffAngle > 0) { tmp = d->m_pos.y(); y = d->m_pos.x(); x = (-1) * tmp; diff --git a/sources/editor/graphicspart/parttext.cpp b/sources/editor/graphicspart/parttext.cpp index ec5a0eb5f..790258935 100644 --- a/sources/editor/graphicspart/parttext.cpp +++ b/sources/editor/graphicspart/parttext.cpp @@ -68,8 +68,9 @@ PartText::~PartText() @param angle */ void PartText::setRotation(qreal angle) { - QGraphicsObject::setRotation(QET::correctAngle(rotation()+angle, true)); - setPos(QTransform().rotate(angle).map(pos())); + qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; + QGraphicsObject::setRotation(QET::correctAngle(angle, true)); + setPos(QTransform().rotate(diffAngle).map(pos())); } void PartText::mirror() { From 231a1c919afc84a22c9f6a943fd8f61b3fa60c57 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Sat, 22 Feb 2025 10:31:24 +0100 Subject: [PATCH 05/10] git submodule update --remote elements --- elements | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements b/elements index bfb09dd02..50dcaf915 160000 --- a/elements +++ b/elements @@ -1 +1 @@ -Subproject commit bfb09dd0215f03bf3010a0be78a1ea9818251545 +Subproject commit 50dcaf915dcb1a23430b3fb1668b5e5373a85245 From 74460a6645d1e6377ae64c83e801d25f7d589919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Kazik?= Date: Tue, 25 Feb 2025 09:20:04 +0100 Subject: [PATCH 06/10] Added slovak translation to org.qelectrotech.qelectrotech.desktop Added slovak translation for app name and comment. --- misc/org.qelectrotech.qelectrotech.desktop | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/org.qelectrotech.qelectrotech.desktop b/misc/org.qelectrotech.qelectrotech.desktop index f26836a57..8713bec64 100644 --- a/misc/org.qelectrotech.qelectrotech.desktop +++ b/misc/org.qelectrotech.qelectrotech.desktop @@ -26,6 +26,7 @@ Comment[nl]=Bewerken bedradingsdiagrammen. Comment[be]=Bewerken elektrisch schema. Comment[da]=Rediger elektriske diagrammer. Comment[ja]=電気回路図の編集。 +Comment[sk]=Úprava elektrických schém. GenericName=Electrical diagram editor GenericName[de]=Schaltplaneditor GenericName[fr]=Éditeur de schémas électriques @@ -42,3 +43,4 @@ GenericName[nl]=Elektrische schema editor GenericName[be]=Elektrische schema editor GenericName[da]=Elektrisk diagram redigering GenericName[ja]=電気回路図エディタ +GenericName[sk]=Editor elektrických schém From f0c954329fb3979185ffe0a971e191cb1db62166 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Tue, 25 Feb 2025 16:49:12 +0100 Subject: [PATCH 07/10] git submodule update --remote elements --- elements | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements b/elements index 50dcaf915..48eb7dced 160000 --- a/elements +++ b/elements @@ -1 +1 @@ -Subproject commit 50dcaf915dcb1a23430b3fb1668b5e5373a85245 +Subproject commit 48eb7dcedff5413da3acf18f764b7b43be009382 From 7bdca47d8ea92ef78b4d8b5c05bcabbc5da3d26b Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Fri, 28 Feb 2025 07:33:17 +0100 Subject: [PATCH 08/10] use brackets to be more clear what is meant --- sources/qetgraphicsitem/dynamicelementtextitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 0cbf616d4..30993ce5c 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -547,7 +547,7 @@ void DynamicElementTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) } // Shift or no parent initiates movement of dynamic text, otherwise movement of parent element - if(event->modifiers() & Qt::ShiftModifier || !m_parent_element) + if((event->modifiers() & Qt::ShiftModifier) || !m_parent_element) { m_move_parent = false; DiagramTextItem::mousePressEvent(event); From 565374f174ea4894a086e0e27fa3735b4f2f0fb9 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Fri, 28 Feb 2025 07:36:53 +0100 Subject: [PATCH 09/10] additional ControlModifier does not work here as expected --- sources/qetgraphicsitem/dynamicelementtextitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 30993ce5c..a8ece334a 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -585,7 +585,7 @@ void DynamicElementTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) button_down_parent_pos = mapToParent(mapFromScene(event->buttonDownScenePos(Qt::LeftButton))); QPointF new_pos = m_initial_position + current_parent_pos - button_down_parent_pos; - event->modifiers() == Qt::ControlModifier ? setPos(new_pos) : setPos(Diagram::snapToGrid(new_pos)); + setPos(new_pos); if(diagram()) diagram()->elementTextsMover().continueMovement(event); From e2e84a56f7dd7ab272c3002a48e08991c2e06bf1 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Fri, 28 Feb 2025 07:40:59 +0100 Subject: [PATCH 10/10] limit movement to int-values to be able to re-position to original position --- sources/qetgraphicsitem/dynamicelementtextitem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index a8ece334a..41a2474bd 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -584,7 +584,9 @@ void DynamicElementTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) current_parent_pos = mapToParent(mapFromScene(event->scenePos())); button_down_parent_pos = mapToParent(mapFromScene(event->buttonDownScenePos(Qt::LeftButton))); - QPointF new_pos = m_initial_position + current_parent_pos - button_down_parent_pos; + int diffx = qRound(current_parent_pos.x() - button_down_parent_pos.x()); + int diffy = qRound(current_parent_pos.y() - button_down_parent_pos.y()); + QPointF new_pos = m_initial_position + QPointF(diffx, diffy); setPos(new_pos); if(diagram())