mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Revert "Merge branch 'XMLPropertiesNew'"
**Break a lot of thing.** This reverts commit1db1800572, reversing changes made to4c563821e8.
This commit is contained in:
@@ -19,8 +19,6 @@
|
||||
|
||||
#include "../../qetgraphicsitem/terminal.h"
|
||||
|
||||
#include "../../qetxml.h"
|
||||
|
||||
/**
|
||||
@brief PartTerminal::PartTerminal
|
||||
@param editor :
|
||||
@@ -31,9 +29,7 @@
|
||||
PartTerminal::PartTerminal(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
CustomElementGraphicPart(editor, parent)
|
||||
{
|
||||
setTagName("terminal");
|
||||
d = new TerminalData(this);
|
||||
d->m_name = tr("terminal");
|
||||
d -> m_orientation = Qet::North;
|
||||
d -> m_uuid = QUuid::createUuid(); // if part is loaded this uuid will be overwritten, but being sure that terminal has a uuid
|
||||
updateSecondPoint();
|
||||
@@ -49,20 +45,10 @@ PartTerminal::~PartTerminal()
|
||||
Importe les proprietes d'une borne depuis un element XML
|
||||
@param xml_elmt Element XML a lire
|
||||
*/
|
||||
bool PartTerminal::fromXmlPriv(const QDomElement &xml_elmt) {
|
||||
|
||||
// update part and add uuid, which is used in the new version to connect terminals together
|
||||
// if the attribute not exists, means, the element is created with an older version of qet. So use the legacy approach
|
||||
// to identify terminals
|
||||
QETXML::propertyUuid(xml_elmt, "uuid", &d->m_uuid);
|
||||
|
||||
if (!d->fromXml(xml_elmt))
|
||||
return false;
|
||||
|
||||
void PartTerminal::fromXml(const QDomElement &xml_elmt) {
|
||||
d -> fromXml(xml_elmt);
|
||||
setPos(d -> m_pos);
|
||||
updateSecondPoint();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,19 +56,9 @@ bool PartTerminal::fromXmlPriv(const QDomElement &xml_elmt) {
|
||||
@param xml_document Document XML a utiliser pour creer l'element XML
|
||||
@return un element XML decrivant la borne
|
||||
*/
|
||||
void PartTerminal::toXmlPriv(QDomElement& e) const {
|
||||
|
||||
e.setAttribute("uuid", d->m_uuid.toString());
|
||||
|
||||
d->m_pos = pos();
|
||||
|
||||
QDomDocument doc = e.ownerDocument();
|
||||
e.appendChild(d -> toXml(doc));
|
||||
|
||||
}
|
||||
|
||||
bool PartTerminal::valideXml(QDomElement& element) {
|
||||
return TerminalData::valideXml(element);
|
||||
const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const
|
||||
{
|
||||
return d -> toXml(xml_document);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,8 +76,8 @@ void PartTerminal::paint(
|
||||
painter -> save();
|
||||
|
||||
// annulation des renderhints
|
||||
painter -> setRenderHint(QPainter::Antialiasing, false);
|
||||
painter -> setRenderHint(QPainter::TextAntialiasing, false);
|
||||
painter -> setRenderHint(QPainter::Antialiasing, false);
|
||||
painter -> setRenderHint(QPainter::TextAntialiasing, false);
|
||||
painter -> setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
|
||||
QPen t;
|
||||
@@ -247,7 +223,7 @@ QRectF PartTerminal::sceneGeometricRect() const
|
||||
*/
|
||||
void PartTerminal::startUserTransformation(const QRectF &initial_selection_rect) {
|
||||
Q_UNUSED(initial_selection_rect)
|
||||
m_saved_position = scenePos();
|
||||
saved_position_ = scenePos();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,6 +231,6 @@ void PartTerminal::startUserTransformation(const QRectF &initial_selection_rect)
|
||||
*/
|
||||
void PartTerminal::handleUserTransformation(const QRectF &initial_selection_rect, const QRectF &new_selection_rect) {
|
||||
QPointF mapped_point = mapPoints(
|
||||
initial_selection_rect, new_selection_rect, QList<QPointF>() << m_saved_position).first();
|
||||
initial_selection_rect, new_selection_rect, QList<QPointF>() << saved_position_).first();
|
||||
setPos(mapped_point);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user