mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Replace deprecated QMatrix by QTransform
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5801 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QMatrix>
|
|
||||||
|
|
||||||
PartDynamicTextField::PartDynamicTextField(QETElementEditor *editor, QGraphicsItem *parent) :
|
PartDynamicTextField::PartDynamicTextField(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||||
QGraphicsTextItem(parent),
|
QGraphicsTextItem(parent),
|
||||||
@@ -240,16 +239,16 @@ void PartDynamicTextField::fromTextFieldXml(const QDomElement &dom_element)
|
|||||||
|
|
||||||
//the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size
|
//the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size
|
||||||
//The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font
|
//The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font
|
||||||
//We need to use a QMatrix to find the pos of this text from the saved pos of text item
|
//We need to use a QTransform to find the pos of this text from the saved pos of text item
|
||||||
QMatrix matrix;
|
QTransform transform;
|
||||||
//First make the rotation
|
//First make the rotation
|
||||||
matrix.rotate(dom_element.attribute("rotation", "0").toDouble());
|
transform.rotate(dom_element.attribute("rotation", "0").toDouble());
|
||||||
QPointF pos = matrix.map(QPointF(0, -boundingRect().height()/2));
|
QPointF pos = transform.map(QPointF(0, -boundingRect().height()/2));
|
||||||
matrix.reset();
|
transform.reset();
|
||||||
//Second translate to the pos
|
//Second translate to the pos
|
||||||
matrix.translate(dom_element.attribute("x", QString::number(0)).toDouble(),
|
transform.translate(dom_element.attribute("x", QString::number(0)).toDouble(),
|
||||||
dom_element.attribute("y", QString::number(0)).toDouble());
|
dom_element.attribute("y", QString::number(0)).toDouble());
|
||||||
QGraphicsTextItem::setPos(matrix.map(pos));
|
QGraphicsTextItem::setPos(transform.map(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
#include <QtDebug>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "elementprovider.h"
|
#include "elementprovider.h"
|
||||||
#include "diagramposition.h"
|
#include "diagramposition.h"
|
||||||
@@ -524,17 +523,17 @@ bool Element::parseInput(const QDomElement &dom_element)
|
|||||||
|
|
||||||
//the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size
|
//the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size
|
||||||
//The origin transformation point of ElementTextItem is the middle of left edge, and so by definition, change with the size of the font
|
//The origin transformation point of ElementTextItem is the middle of left edge, and so by definition, change with the size of the font
|
||||||
//We need to use a QMatrix to find the pos of this text from the saved pos of text item
|
//We need to use a QTransform to find the pos of this text from the saved pos of text item
|
||||||
QMatrix matrix;
|
QTransform transform;
|
||||||
//First make the rotation
|
//First make the rotation
|
||||||
matrix.rotate(dom_element.attribute("rotation", "0").toDouble());
|
transform.rotate(dom_element.attribute("rotation", "0").toDouble());
|
||||||
QPointF pos = matrix.map(QPointF(0, -deti->boundingRect().height()/2));
|
QPointF pos = transform.map(QPointF(0, -deti->boundingRect().height()/2));
|
||||||
matrix.reset();
|
transform.reset();
|
||||||
//Second translate to the pos
|
//Second translate to the pos
|
||||||
QPointF p(dom_element.attribute("x", QString::number(0)).toDouble(),
|
QPointF p(dom_element.attribute("x", QString::number(0)).toDouble(),
|
||||||
dom_element.attribute("y", QString::number(0)).toDouble());
|
dom_element.attribute("y", QString::number(0)).toDouble());
|
||||||
matrix.translate(p.x(), p.y());
|
transform.translate(p.x(), p.y());
|
||||||
deti->setPos(matrix.map(pos));
|
deti->setPos(transform.map(pos));
|
||||||
m_converted_text_from_xml_description.insert(deti, p);
|
m_converted_text_from_xml_description.insert(deti, p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -790,19 +789,19 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
|
|
||||||
//the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size
|
//the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size
|
||||||
//The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font
|
//The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font
|
||||||
//We need to use a QMatrix to find the pos of this text from the saved pos of text item
|
//We need to use a QTransform to find the pos of this text from the saved pos of text item
|
||||||
|
|
||||||
deti->setPos(xml_pos);
|
deti->setPos(xml_pos);
|
||||||
deti->setRotation(rotation);
|
deti->setRotation(rotation);
|
||||||
|
|
||||||
QMatrix matrix;
|
QTransform transform;
|
||||||
//First make the rotation
|
//First make the rotation
|
||||||
matrix.rotate(rotation);
|
transform.rotate(rotation);
|
||||||
QPointF pos = matrix.map(QPointF(0, -deti->boundingRect().height()/2));
|
QPointF pos = transform.map(QPointF(0, -deti->boundingRect().height()/2));
|
||||||
matrix.reset();
|
transform.reset();
|
||||||
//Second translate to the pos
|
//Second translate to the pos
|
||||||
matrix.translate(xml_pos.x(), xml_pos.y());
|
transform.translate(xml_pos.x(), xml_pos.y());
|
||||||
deti->setPos(matrix.map(pos));
|
deti->setPos(transform.map(pos));
|
||||||
|
|
||||||
//dom_input and deti matched we remove the dom_input from @inputs list,
|
//dom_input and deti matched we remove the dom_input from @inputs list,
|
||||||
//to avoid unnecessary checking made below
|
//to avoid unnecessary checking made below
|
||||||
|
|||||||
Reference in New Issue
Block a user