mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-20 07:14:13 +02:00
Compare commits
5 Commits
467a14df71
...
3cbb930751
| Author | SHA1 | Date | |
|---|---|---|---|
| 3cbb930751 | |||
| 51209d30b6 | |||
| 9c55d36d55 | |||
| 3ac557570c | |||
| 0c2cf409f8 |
+1464
-1678
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@
|
||||
#include "qetgraphicsitem/conductortextitem.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/elementtextitemgroup.h"
|
||||
#include "qetinformation.h"
|
||||
#include "qgimanager.h"
|
||||
|
||||
/**
|
||||
@@ -97,6 +98,27 @@ void PasteDiagramCommand::redo()
|
||||
dc.addValue("label", "");
|
||||
dc.addValue("comment", "");
|
||||
dc.addValue("location", "");
|
||||
|
||||
// PLC slaves store master data (type, address, comment,
|
||||
// cross-ref, etc.) in their own elementInformations.
|
||||
// Remove them the same way MasterElement::unlinkElement()
|
||||
// does, so pasted PLC slaves start clean like regular
|
||||
// slaves.
|
||||
if (e->linkType() == Element::Slave) {
|
||||
dc.remove(QETInformation::ELMT_PLC_TYPE);
|
||||
dc.remove(QETInformation::ELMT_PLC_ADDRESS);
|
||||
dc.remove(QETInformation::ELMT_PLC_FUNCTION);
|
||||
dc.remove(QETInformation::ELMT_PLC_COMMENT);
|
||||
dc.remove(QETInformation::ELMT_PLC_CROSSREF);
|
||||
dc.remove(QETInformation::ELMT_LABEL);
|
||||
dc.remove(QETInformation::ELMT_PLC_TC);
|
||||
dc.remove(QETInformation::ELMT_PLC_T1);
|
||||
dc.remove(QETInformation::ELMT_PLC_T2);
|
||||
dc.remove(QETInformation::ELMT_PLC_T3);
|
||||
dc.remove(QETInformation::ELMT_PLC_T4);
|
||||
dc.remove(QStringLiteral("xref"));
|
||||
}
|
||||
|
||||
e->setElementInformations(dc);
|
||||
|
||||
//Reset the text of conductors, the same way the label/comment/
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include <QPainter>
|
||||
#include <QSettings>
|
||||
|
||||
DiagramEventAddMacro::DiagramEventAddMacro(const ElementsLocation &location, Diagram *diagram, QPointF pos) :
|
||||
DiagramEventInterface(diagram),
|
||||
@@ -63,6 +64,7 @@ m_preview_item(nullptr)
|
||||
QDomElement diagram_node = root.firstChildElement("diagram_content").firstChildElement("diagram");
|
||||
|
||||
if (!diagram_node.isNull()) {
|
||||
dummy_diagram->setDisplayGrid(false);
|
||||
dummy_diagram->fromXml(diagram_node, QPointF(0, 0), false, nullptr);
|
||||
|
||||
QRectF scene_rect = dummy_diagram->itemsBoundingRect();
|
||||
@@ -237,13 +239,16 @@ void DiagramEventAddMacro::addMacro(QPointF final_pos)
|
||||
if (!diagram_node.isNull()) {
|
||||
QDomElement cloned_node = diagram_node.cloneNode(true).toElement();
|
||||
|
||||
QPointF target_pos = final_pos;
|
||||
|
||||
DiagramContent pasted_content;
|
||||
|
||||
m_diagram->fromXml(cloned_node, target_pos, false, &pasted_content);
|
||||
m_diagram->fromXml(cloned_node, final_pos, false, &pasted_content);
|
||||
m_diagram->refreshContents();
|
||||
|
||||
// Prevent PasteDiagramCommand from erasing labels (BMK)
|
||||
QSettings settings;
|
||||
bool saved_erase = settings.value("diagramcommands/erase-label-on-copy", true).toBool();
|
||||
settings.setValue("diagramcommands/erase-label-on-copy", false);
|
||||
m_diagram->undoStack().push(new PasteDiagramCommand(m_diagram, pasted_content));
|
||||
settings.setValue("diagramcommands/erase-label-on-copy", saved_erase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,10 +211,10 @@ void DiagramView::handleElementDrop(QDropEvent *event)
|
||||
}
|
||||
|
||||
QPointF drop_pos;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
drop_pos = mapToScene(event->pos());
|
||||
#else
|
||||
drop_pos = event->position();
|
||||
drop_pos = mapToScene(event->position().toPoint());
|
||||
#endif
|
||||
|
||||
if (location.path().endsWith(".qetmak")) {
|
||||
@@ -290,16 +290,12 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
iti -> setHtml (e -> mimeData() -> text());
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
||||
iti, m_diagram, mapToScene(e->pos())));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
||||
iti, m_diagram, e->position()));
|
||||
iti, m_diagram, mapToScene(e->position().toPoint())));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user