mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-07 10:33:13 +02:00
Compare commits
14 Commits
a1572be8fa
...
3c2c889922
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c2c889922 | |||
| 27cff81ee7 | |||
| 40a7995993 | |||
| 45afd9af0e | |||
| 20b7e1763d | |||
| 9044d532ac | |||
| 50efc318e0 | |||
| e4d2dbd2a6 | |||
| ddf40854dc | |||
| ef0fa6e7ac | |||
| 237c21bad8 | |||
| 260ce2a8bc | |||
| 6199367166 | |||
| d073e810b8 |
@@ -46,125 +46,64 @@ XmlElementCollection::XmlElementCollection(QETProject *project) :
|
||||
collection.appendChild(import);
|
||||
|
||||
NamesList names;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
const QChar russian_data[24] = {
|
||||
0x0418, 0x043C, 0x043F, 0x043E, 0x0440, 0x0442, 0x0438, 0x0440,
|
||||
0x043E, 0x0432, 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, 0x0020,
|
||||
0x044D, 0x043B, 0x0435, 0x043C, 0x0435, 0x043D, 0x0442, 0x044B};
|
||||
const QChar chinese_data[4] ={
|
||||
QChar(0x5BFC), QChar(0x5165), QChar(0x5143), QChar(0x4EF6)};
|
||||
const QChar greek_data[18] = {
|
||||
0x0395,
|
||||
0x03b9,
|
||||
0x03c3,
|
||||
0x03b7,
|
||||
0x03b3,
|
||||
0x03bc,
|
||||
0x03ad,
|
||||
0x03bd,
|
||||
0x03b1,
|
||||
0x0020,
|
||||
0x03c3,
|
||||
0x03c4,
|
||||
0x03bf,
|
||||
0x03b9,
|
||||
0x03c7,
|
||||
0x03b5,
|
||||
0x03af,
|
||||
0x03b1};
|
||||
const QChar turkish_data[12] = {
|
||||
0x0130,
|
||||
0x0074,
|
||||
0x0068,
|
||||
0x0061,
|
||||
0x006C,
|
||||
0x0020,
|
||||
0x00F6,
|
||||
0x011F,
|
||||
0x0065,
|
||||
0x006C,
|
||||
0x0065,
|
||||
0x0072};
|
||||
const QChar ukrainian_data[20] = {
|
||||
0x0406,
|
||||
0x043c,
|
||||
0x043f,
|
||||
0x043e,
|
||||
0x0440,
|
||||
0x0442,
|
||||
0x043e,
|
||||
0x0432,
|
||||
0x0430,
|
||||
0x043d,
|
||||
0x0456,
|
||||
0x0020,
|
||||
0x0435,
|
||||
0x043b,
|
||||
0x0435,
|
||||
0x043c,
|
||||
0x0435,
|
||||
0x043d,
|
||||
0x0442,
|
||||
0x0438};
|
||||
QChar(0x0395), QChar(0x03b9), QChar(0x03c3), QChar(0x03b7),
|
||||
QChar(0x03b3), QChar(0x03bc), QChar(0x03ad), QChar(0x03bd),
|
||||
QChar(0x03b1), QChar(0x0020), QChar(0x03c3), QChar(0x03c4),
|
||||
QChar(0x03bf), QChar(0x03b9), QChar(0x03c7), QChar(0x03b5),
|
||||
QChar(0x03af), QChar(0x03b1)};
|
||||
const QChar japanese_data[10] = {
|
||||
0x30A4,
|
||||
0x30F3,
|
||||
0x30D0,
|
||||
0x30FC,
|
||||
0x30C8,
|
||||
0x3055,
|
||||
0x308C,
|
||||
0x305F,
|
||||
0x8981,
|
||||
0x7D20};
|
||||
|
||||
QChar(0x30A4), QChar(0x30F3), QChar(0x30D0), QChar(0x30FC),
|
||||
QChar(0x30C8), QChar(0x3055), QChar(0x308C), QChar(0x305F),
|
||||
QChar(0x8981), QChar(0x7D20)};
|
||||
const QChar russian_data[24] = {
|
||||
QChar(0x0418), QChar(0x043C), QChar(0x043F), QChar(0x043E),
|
||||
QChar(0x0440), QChar(0x0442), QChar(0x0438), QChar(0x0440),
|
||||
QChar(0x043E), QChar(0x0432), QChar(0x0430), QChar(0x043D),
|
||||
QChar(0x043D), QChar(0x044B), QChar(0x0435), QChar(0x0020),
|
||||
QChar(0x044D), QChar(0x043B), QChar(0x0435), QChar(0x043C),
|
||||
QChar(0x0435), QChar(0x043D), QChar(0x0442), QChar(0x044B)};
|
||||
const QChar turkish_data[12] = {
|
||||
QChar(0x0130), QChar(0x0074), QChar(0x0068), QChar(0x0061),
|
||||
QChar(0x006C), QChar(0x0020), QChar(0x00F6), QChar(0x011F),
|
||||
QChar(0x0065), QChar(0x006C), QChar(0x0065), QChar(0x0072)};
|
||||
const QChar ukrainian_data[20] = {
|
||||
QChar(0x0406), QChar(0x043c), QChar(0x043f), QChar(0x043e),
|
||||
QChar(0x0440), QChar(0x0442), QChar(0x043e), QChar(0x0432),
|
||||
QChar(0x0430), QChar(0x043d), QChar(0x0456), QChar(0x0020),
|
||||
QChar(0x0435), QChar(0x043b), QChar(0x0435), QChar(0x043c),
|
||||
QChar(0x0435), QChar(0x043d), QChar(0x0442), QChar(0x0438)};
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("de", "Importierte Elemente");
|
||||
names.addName("el", QString(greek_data, 18));
|
||||
//names.addName("el", "Εισηγμένα στοιχεία);
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("ja", QString(japanese_data, 10));
|
||||
names.addName("nl_BE", "Elementen geïmporteerd");
|
||||
//names.addName("ja", "インバートされた要素");
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("nl_BE", "Elementen geïmporteerd");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt_BR", "elementos importados");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("pt", "Elementos importados");
|
||||
names.addName("pt_BR", "Elementos importados");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("ru", QString(russian_data, 24));
|
||||
//names.addName("ru", "Импортированные элементы");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
names.addName("sv", "Importerade element");
|
||||
names.addName("tr", QString(turkish_data, 12));
|
||||
//names.addName("tr", "İthal öğeler");
|
||||
names.addName("uk", QString(ukrainian_data, 20));
|
||||
#else
|
||||
# if TODO_LIST
|
||||
# pragma message("@TODO remove code for QT 6 or later")
|
||||
# endif
|
||||
qDebug() << "Help code for QT 6 or later";
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("el", "Εισηγμένα στοιχεία");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("ja", "インバートされた要素");
|
||||
names.addName("nl_BE", "Elementen geïmporteerd");
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt_BR", "elementos importados");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("ru", "Импортированные элементы");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
names.addName("tr", "İthal öğeler");
|
||||
names.addName("uk", "Імпортовані елементи");
|
||||
#endif
|
||||
//names.addName("uk", "Імпортовані елементи");
|
||||
names.addName("zh", QString(chinese_data, 4));
|
||||
//names.addName("zh", "导入元件");
|
||||
|
||||
import.appendChild(names.toXml(m_dom_document));
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ void OpenElmtCommand::redo()
|
||||
m_scene->addItems(m_graphics_item.toVector());
|
||||
}
|
||||
|
||||
#pragma message("@TODO uncommante slot_select when fixed, see itemChange function for each primitive")
|
||||
//Commented because take a lot of time
|
||||
//when a lot of primitive are loaded
|
||||
//need work
|
||||
#pragma message("@TODO uncomment slot_select when fixed, see itemChange function for each primitive")
|
||||
//Commented because it takes a lot of time
|
||||
//when a lot of primitives are loaded!
|
||||
//needs work
|
||||
//m_scene->slot_select(m_graphics_item);
|
||||
}
|
||||
|
||||
@@ -168,25 +168,25 @@ 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:
|
||||
auto p1 = mapToScene(m_rect.x(),m_rect.y());
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x; qreal y;
|
||||
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); }
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x = (m_rect.y() + m_rect.height()) * (-1);
|
||||
qreal y = m_rect.x();
|
||||
m_rect = QRectF(x, y, width, height);
|
||||
} else {
|
||||
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); }
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x = m_rect.y();
|
||||
qreal y = (m_rect.x() + m_rect.width()) * (-1);
|
||||
m_rect = QRectF(x, y, width, height);
|
||||
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); }
|
||||
x = (p1.y() + m_rect.height()) * (-1);
|
||||
y = p1.x();
|
||||
} else {
|
||||
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); }
|
||||
x = p1.y();
|
||||
y = (p1.x() + m_rect.width()) * (-1);
|
||||
}
|
||||
p1 = mapFromScene(x, y);
|
||||
m_rect = QRectF(p1.x(), p1.y(), width, height);
|
||||
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
@@ -202,8 +202,10 @@ void PartArc::flip() {
|
||||
m_span_angle = (-1) * m_span_angle;
|
||||
while (m_start_angle < 0) { m_start_angle += (360*16); }
|
||||
while (m_start_angle >= (360*16)) { m_start_angle -= (360*16); }
|
||||
qreal y = ((-1.0) * m_rect.y()) - m_rect.height();
|
||||
m_rect = QRectF(m_rect.x(), y, m_rect.width(), m_rect.height());
|
||||
auto p1 = mapToScene(m_rect.x(),m_rect.y());
|
||||
p1.setY(((-1.0) * p1.y()) - m_rect.height());
|
||||
p1 = mapFromScene(p1.x(),p1.y());
|
||||
m_rect = QRectF(m_rect.x(), p1.y(), m_rect.width(), m_rect.height());
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit rectChanged();
|
||||
@@ -214,8 +216,10 @@ void PartArc::mirror() {
|
||||
m_span_angle = (-1) * m_span_angle;
|
||||
while (m_start_angle < 0) { m_start_angle += (360*16); }
|
||||
while (m_start_angle >= (360*16)) { m_start_angle -= (360*16); }
|
||||
qreal x = ((-1.0) * m_rect.x()) - m_rect.width();
|
||||
m_rect = QRectF(x, m_rect.y(), m_rect.width(), m_rect.height());
|
||||
auto p1 = mapToScene(m_rect.x(),m_rect.y());
|
||||
p1.setX(((-1.0) * p1.x()) - m_rect.width());
|
||||
p1 = mapFromScene(p1.x(), p1.y());
|
||||
m_rect = QRectF(p1.x(), m_rect.y(), m_rect.width(), m_rect.height());
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit rectChanged();
|
||||
|
||||
@@ -234,19 +234,19 @@ 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:
|
||||
auto p1 = mapToScene(m_rect.x(), m_rect.y());
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x; qreal y;
|
||||
if (diffAngle > 0) {
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x = (m_rect.y() + m_rect.height()) * (-1);
|
||||
qreal y = m_rect.x();
|
||||
m_rect = QRectF(x, y, width, height);
|
||||
x = (p1.y() + m_rect.height()) * (-1);
|
||||
y = p1.x();
|
||||
} else {
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x = m_rect.y();
|
||||
qreal y = (m_rect.x() + m_rect.width()) * (-1);
|
||||
m_rect = QRectF(x, y, width, height);
|
||||
x = m_rect.y();
|
||||
y = (m_rect.x() + m_rect.width()) * (-1);
|
||||
}
|
||||
p1 = mapFromScene(x, y);
|
||||
m_rect = QRectF(p1.x(), p1.y(), width, height);
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit rectChanged();
|
||||
@@ -257,16 +257,20 @@ qreal PartEllipse::rotation() const {
|
||||
}
|
||||
|
||||
void PartEllipse::flip() {
|
||||
qreal y = ((-1.0) * m_rect.y()) - m_rect.height();
|
||||
m_rect = QRectF(m_rect.x(), y, m_rect.width(), m_rect.height());
|
||||
auto p1 = mapToScene(m_rect.x(), m_rect.y());
|
||||
p1.setY(((-1.0) * p1.y()) - m_rect.height());
|
||||
p1 = mapFromScene(p1.x(), p1.y());
|
||||
m_rect = QRectF(p1.x(), p1.y(), m_rect.width(), m_rect.height());
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit rectChanged();
|
||||
}
|
||||
|
||||
void PartEllipse::mirror() {
|
||||
qreal x = ((-1.0) * m_rect.x()) - m_rect.width();
|
||||
m_rect = QRectF(x, m_rect.y(), m_rect.width(), m_rect.height());
|
||||
auto p1 = mapToScene(m_rect.x(), m_rect.y());
|
||||
p1.setX(((-1.0) * p1.x()) - m_rect.width());
|
||||
p1 = mapFromScene(p1.x(), p1.y());
|
||||
m_rect = QRectF(p1.x(), p1.y(), m_rect.width(), m_rect.height());
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit rectChanged();
|
||||
|
||||
@@ -574,8 +574,12 @@ void PartLine::setSecondEndLength(const qreal &l)
|
||||
void PartLine::setRotation(qreal angle) {
|
||||
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()));
|
||||
auto p1 = mapToScene(m_line.p1());
|
||||
auto p2 = mapToScene(m_line.p2());
|
||||
p1 = QTransform().rotate(diffAngle).map(p1);
|
||||
p2 = QTransform().rotate(diffAngle).map(p2);
|
||||
m_line.setP1(mapFromScene(p1));
|
||||
m_line.setP2(mapFromScene(p2));
|
||||
prepareGeometryChange();
|
||||
setLine(m_line);
|
||||
adjustHandlerPos();
|
||||
@@ -587,8 +591,12 @@ qreal PartLine::rotation() const {
|
||||
}
|
||||
|
||||
void PartLine::flip() {
|
||||
m_line.setP1(QPointF(m_line.p1().x(), (-1) * m_line.p1().y()));
|
||||
m_line.setP2(QPointF(m_line.p2().x(), (-1) * m_line.p2().y()));
|
||||
auto p1 = mapToScene(m_line.p1());
|
||||
auto p2 = mapToScene(m_line.p2());
|
||||
p1 = QPointF(p1.x(), (-1) * p1.y());
|
||||
p2 = QPointF(p2.x(), (-1) * p2.y());
|
||||
m_line.setP1(mapFromScene(p1));
|
||||
m_line.setP2(mapFromScene(p2));
|
||||
setLine(m_line);
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
@@ -596,8 +604,12 @@ void PartLine::flip() {
|
||||
}
|
||||
|
||||
void PartLine::mirror() {
|
||||
m_line.setP1(QPointF((-1) * m_line.p1().x(), m_line.p1().y()));
|
||||
m_line.setP2(QPointF((-1) * m_line.p2().x(), m_line.p2().y()));
|
||||
auto p1 = mapToScene(m_line.p1());
|
||||
auto p2 = mapToScene(m_line.p2());
|
||||
p1 = QPointF((-1) * p1.x(), p1.y());
|
||||
p2 = QPointF((-1) * p2.x(), p2.y());
|
||||
m_line.setP1(mapFromScene(p1));
|
||||
m_line.setP2(mapFromScene(p2));
|
||||
setLine(m_line);
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
|
||||
@@ -66,14 +66,7 @@ void PartPolygon::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
||||
applyStylesToQPainter(*painter);
|
||||
|
||||
QPen t = painter -> pen();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
|
||||
#endif
|
||||
if (isSelected()) t.setColor(Qt::red);
|
||||
painter -> setPen(t);
|
||||
|
||||
@@ -299,8 +292,12 @@ void PartPolygon::resetAllHandlerColor()
|
||||
void PartPolygon::setRotation(qreal 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));
|
||||
for (auto &pt : m_polygon) {
|
||||
pt = mapToScene(pt.x(), pt.y());
|
||||
pt = QTransform().rotate(diffAngle).map(pt);
|
||||
pt = mapFromScene(pt.x(), pt.y());
|
||||
}
|
||||
setPolygon(m_polygon);
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit polygonChanged();
|
||||
@@ -312,7 +309,9 @@ qreal PartPolygon::rotation() const {
|
||||
|
||||
void PartPolygon::flip() {
|
||||
for (auto &pt : m_polygon) {
|
||||
pt = mapToScene(pt.x(), pt.y());
|
||||
pt = QPointF(pt.x(), (-1) * pt.y());
|
||||
pt = mapFromScene(pt.x(), pt.y());
|
||||
}
|
||||
setPolygon(m_polygon);
|
||||
prepareGeometryChange();
|
||||
@@ -322,7 +321,9 @@ void PartPolygon::flip() {
|
||||
|
||||
void PartPolygon::mirror() {
|
||||
for (auto &pt : m_polygon) {
|
||||
pt = mapToScene(pt.x(), pt.y());
|
||||
pt = QPointF((-1) * pt.x(), pt.y());
|
||||
pt = mapFromScene(pt.x(), pt.y());
|
||||
}
|
||||
setPolygon(m_polygon);
|
||||
prepareGeometryChange();
|
||||
|
||||
@@ -163,22 +163,19 @@ 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());
|
||||
auto p1 = mapToScene(m_rect.x(),m_rect.y());
|
||||
qreal width = m_rect.height();
|
||||
qreal height = m_rect.width();
|
||||
qreal x; qreal y;
|
||||
if (diffAngle > 0) {
|
||||
x = (pos.y() + m_rect.height()) * (-1);
|
||||
y = pos.x();
|
||||
x = (p1.y() + m_rect.height()) * (-1);
|
||||
y = p1.x();
|
||||
} else {
|
||||
x = pos.y();
|
||||
y = (pos.x() + m_rect.width()) * (-1);
|
||||
x = p1.y();
|
||||
y = (p1.x() + m_rect.width()) * (-1);
|
||||
}
|
||||
|
||||
pos = mapFromScene(x, y);
|
||||
m_rect.setX(pos.x()); m_rect.setY(pos.y());
|
||||
m_rect.setWidth(width); m_rect.setHeight(height);
|
||||
p1 = mapFromScene(x, y);
|
||||
m_rect = QRectF(p1.x(), p1.y(), width, height);
|
||||
std::swap (m_xRadius, m_yRadius);
|
||||
|
||||
prepareGeometryChange();
|
||||
@@ -191,13 +188,13 @@ qreal PartRectangle::rotation() const {
|
||||
}
|
||||
|
||||
void PartRectangle::flip() {
|
||||
// for whatever reason: with "rect" we need to use scene-positions...
|
||||
qreal height = m_rect.height();
|
||||
auto pos = mapToScene(m_rect.x(),m_rect.y());
|
||||
qreal x = pos.x();
|
||||
qreal y = ((-1.0) * pos.y()) - height;
|
||||
pos = mapFromScene(x, y);
|
||||
m_rect.setX(pos.x()); m_rect.setY(pos.y());
|
||||
auto height = m_rect.height();
|
||||
auto p1 = mapToScene(m_rect.x(),m_rect.y());
|
||||
qreal x = p1.x();
|
||||
qreal y = ((-1.0) * p1.y()) - height;
|
||||
p1 = mapFromScene(x, y);
|
||||
m_rect.setX(p1.x());
|
||||
m_rect.setY(p1.y());
|
||||
m_rect.setHeight(height);
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
@@ -205,13 +202,13 @@ void PartRectangle::flip() {
|
||||
}
|
||||
|
||||
void PartRectangle::mirror() {
|
||||
// for whatever reason: with "rect" we need to use scene-positions...
|
||||
qreal width = m_rect.width();
|
||||
auto pos = mapToScene(m_rect.x(),m_rect.y());
|
||||
qreal x = ((-1.0) * pos.x()) - width;
|
||||
qreal y = pos.y();
|
||||
pos = mapFromScene(x, y);
|
||||
m_rect.setX(pos.x()); m_rect.setY(pos.y());
|
||||
auto width = m_rect.width();
|
||||
auto p1 = mapToScene(m_rect.x(),m_rect.y());
|
||||
qreal x = ((-1.0) * p1.x()) - width;
|
||||
qreal y = p1.y();
|
||||
p1 = mapFromScene(x, y);
|
||||
m_rect.setX(p1.x());
|
||||
m_rect.setY(p1.y());
|
||||
m_rect.setWidth(width);
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
|
||||
@@ -158,23 +158,20 @@ void PartTerminal::setRotation(qreal angle) {
|
||||
else new_ori = Qet::West;
|
||||
|
||||
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0;
|
||||
double tmp, y, x;
|
||||
if (diffAngle > 0) {
|
||||
tmp = d->m_pos.y();
|
||||
y = d->m_pos.x();
|
||||
x = (-1) * tmp;
|
||||
} else {
|
||||
tmp = d->m_pos.x();
|
||||
x = d->m_pos.y();
|
||||
y = (-1) * tmp;
|
||||
}
|
||||
d->m_pos.setX(x); d->m_pos.setY(y);
|
||||
|
||||
auto p1 = QTransform().rotate(diffAngle).map(pos());
|
||||
d->m_pos.setX(p1.x()); d->m_pos.setY(p1.y());
|
||||
setPos(d->m_pos);
|
||||
setOrientation(new_ori);
|
||||
updateSecondPoint();
|
||||
prepareGeometryChange();
|
||||
emit orientationChanged(); // all terminal-signals call "updateForm"
|
||||
}
|
||||
|
||||
/**
|
||||
@brief PartTerminal::rotation
|
||||
@return current rotation-angle in degrees
|
||||
*/
|
||||
qreal PartTerminal::rotation() const {
|
||||
switch (d->m_orientation) {
|
||||
case Qet::North : return 0;
|
||||
@@ -185,9 +182,13 @@ qreal PartTerminal::rotation() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief PartTerminal::flip
|
||||
turn part upside down
|
||||
*/
|
||||
void PartTerminal::flip() {
|
||||
d->m_pos.setY((-1.0) * d->m_pos.y());
|
||||
|
||||
d->m_pos.setX( pos().x());
|
||||
d->m_pos.setY((-1.0) * pos().y());
|
||||
switch (d->m_orientation) {
|
||||
case Qet::North : setOrientation(Qet::South);
|
||||
break;
|
||||
@@ -202,8 +203,13 @@ void PartTerminal::flip() {
|
||||
emit yChanged(); // all terminal-signals call "updateForm"
|
||||
}
|
||||
|
||||
/**
|
||||
@brief PartTerminal::mirror
|
||||
turn part from left to right
|
||||
*/
|
||||
void PartTerminal::mirror() {
|
||||
d->m_pos.setX((-1.0) * d->m_pos.x());
|
||||
d->m_pos.setX((-1.0) * pos().x());
|
||||
d->m_pos.setY( pos().y());
|
||||
switch (d->m_orientation) {
|
||||
case Qet::North : break;
|
||||
case Qet::East : setOrientation(Qet::West);
|
||||
|
||||
+2
-2
@@ -1260,7 +1260,7 @@ QFont QETApp::diagramTextsFont(qreal size)
|
||||
}
|
||||
/**
|
||||
@brief QETApp::diagramTextsItemFont
|
||||
the font for to use in independent text item
|
||||
the font to use in independent text items
|
||||
@param size of font
|
||||
@return
|
||||
*/
|
||||
@@ -1275,7 +1275,7 @@ QFont QETApp::diagramTextsItemFont(qreal size)
|
||||
9.0).toDouble();
|
||||
auto diagram_texts_item_weight =
|
||||
static_cast<QFont::Weight>(
|
||||
settings.value("diagramitemweight").toInt());
|
||||
settings.value("diagramitemweight", QFont::Normal).toInt());
|
||||
QString diagram_texts_item_style = settings.value("diagramitemstyle",
|
||||
"normal").toString();
|
||||
|
||||
|
||||
@@ -991,21 +991,14 @@ void QetGraphicsTableItem::adjustColumnsWidth()
|
||||
int sum_=0;
|
||||
for(auto i= 0 ; i<m_model->columnCount() ; ++i)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
auto at_a = std::min(m_minimum_column_width.size()-1, i); //In case of the I is higher than m_minimum_column_width or
|
||||
auto at_b = std::min(m_header_item->minimumSectionWidth().size()-1, i); //m_header_item->minimumSectionWidth().size()
|
||||
auto at_a = std::min((int)m_minimum_column_width.size()-1, i); //In case of the I is higher than m_minimum_column_width or
|
||||
auto at_b = std::min((int)m_header_item->minimumSectionWidth().size()-1, i); //m_header_item->minimumSectionWidth().size()
|
||||
m_header_item->resizeSection(
|
||||
i,
|
||||
std::max(
|
||||
m_minimum_column_width.at(at_a),
|
||||
m_header_item->minimumSectionWidth().at(at_b))+b);
|
||||
sum_+= m_header_item->sectionSize(i);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -519,8 +519,8 @@ void Conductor::paint(QPainter *painter, const QStyleOptionGraphicsItem *options
|
||||
final_conductor_pen.setStyle(m_properties.style);
|
||||
final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // better rendering with dot
|
||||
|
||||
//Use a cosmetique line, below a certain zoom
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
|
||||
//Use a cosmetic line, below a certain zoom
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
|
||||
{
|
||||
final_conductor_pen.setCosmetic(true);
|
||||
}
|
||||
|
||||
@@ -215,24 +215,24 @@ void Element::paint(
|
||||
drawHighlight(painter, options);
|
||||
}
|
||||
|
||||
//Set default pen and brush to QPainter
|
||||
//for avoid a strange bug when the Qt theme is a "dark" theme.
|
||||
//Some part of an element are gray or white instead of black.
|
||||
//This bug seems append only when the QPainter use drawPicture method.
|
||||
//Set default pen and brush to QPainter to avoid a strange bug when
|
||||
//the Qt theme is a "dark" theme.
|
||||
//Some parts of an element are gray or white instead of black.
|
||||
//This bug seems append only when the QPainter uses drawPicture method.
|
||||
//See bug 175. https://qelectrotech.org/bugtracker/view.php?id=175
|
||||
painter->save();
|
||||
QPen pen;
|
||||
QBrush brush;
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(brush);
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
|
||||
{
|
||||
painter->drawPicture(0, 0, m_low_zoom_picture);
|
||||
} else {
|
||||
painter->drawPicture(0, 0, m_picture);
|
||||
}
|
||||
|
||||
painter->restore(); //Restorr the QPainter after use drawPicture
|
||||
painter->restore(); //Restore the QPainter after use drawPicture
|
||||
|
||||
//Draw the selection rectangle
|
||||
if ( isSelected() || m_mouse_over ) {
|
||||
@@ -758,15 +758,10 @@ bool Element::fromXml(QDomElement &e,
|
||||
QList <QDomElement> uuid_list = QET::findInDomElement(e,
|
||||
QStringLiteral("links_uuids"),
|
||||
QStringLiteral("link_uuid"));
|
||||
foreach (QDomElement qdo, uuid_list)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
tmp_uuids_link << qdo.attribute(QStringLiteral("uuid"));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
foreach (QDomElement qdo, uuid_list) {
|
||||
tmp_uuids_link << QUuid(qdo.attribute(QStringLiteral("uuid")));
|
||||
}
|
||||
|
||||
//uuid of this element
|
||||
m_uuid = QUuid(e.attribute(QStringLiteral("uuid"), QUuid::createUuid().toString()));
|
||||
|
||||
|
||||
+1
-129
@@ -1777,134 +1777,6 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
|
||||
updateDiagramsFolioData();
|
||||
}
|
||||
|
||||
/**
|
||||
@return La liste des noms a utiliser pour la categorie dediee aux elements
|
||||
integres automatiquement dans le projet.
|
||||
*/
|
||||
NamesList QETProject::namesListForIntegrationCategory()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
NamesList names;
|
||||
const QChar russian_data[24] = {
|
||||
0x0418, 0x043C, 0x043F, 0x043E, 0x0440, 0x0442, 0x0438, 0x0440,
|
||||
0x043E, 0x0432, 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, 0x0020,
|
||||
0x044D, 0x043B, 0x0435, 0x043C, 0x0435, 0x043D, 0x0442, 0x044B};
|
||||
const QChar greek_data[18] = {
|
||||
0x0395,
|
||||
0x03b9,
|
||||
0x03c3,
|
||||
0x03b7,
|
||||
0x03b3,
|
||||
0x03bc,
|
||||
0x03ad,
|
||||
0x03bd,
|
||||
0x03b1,
|
||||
0x0020,
|
||||
0x03c3,
|
||||
0x03c4,
|
||||
0x03bf,
|
||||
0x03b9,
|
||||
0x03c7,
|
||||
0x03b5,
|
||||
0x03af,
|
||||
0x03b1};
|
||||
const QChar turkish_data[12] = {
|
||||
0x0130,
|
||||
0x0074,
|
||||
0x0068,
|
||||
0x0061,
|
||||
0x006C,
|
||||
0x0020,
|
||||
0x00F6,
|
||||
0x011F,
|
||||
0x0065,
|
||||
0x006C,
|
||||
0x0065,
|
||||
0x0072};
|
||||
const QChar ukrainian_data[20] = {
|
||||
0x0406,
|
||||
0x043c,
|
||||
0x043f,
|
||||
0x043e,
|
||||
0x0440,
|
||||
0x0442,
|
||||
0x043e,
|
||||
0x0432,
|
||||
0x0430,
|
||||
0x043d,
|
||||
0x0456,
|
||||
0x0020,
|
||||
0x0435,
|
||||
0x043b,
|
||||
0x0435,
|
||||
0x043c,
|
||||
0x0435,
|
||||
0x043d,
|
||||
0x0442,
|
||||
0x0438};
|
||||
const QChar japanese_data[10] = {
|
||||
0x30A4,
|
||||
0x30F3,
|
||||
0x30D0,
|
||||
0x30FC,
|
||||
0x30C8,
|
||||
0x3055,
|
||||
0x308C,
|
||||
0x305F,
|
||||
0x8981,
|
||||
0x7D20};
|
||||
const QChar chinese_data[4] ={
|
||||
0x5BFC,
|
||||
0x5165,
|
||||
0x5143,
|
||||
0x4EF6};
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("ru", QString(russian_data, 24));
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("el", QString(greek_data, 18));
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("tr", QString(turkish_data, 12));
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
names.addName("sv", "Importerade element");
|
||||
names.addName("ja", QString(japanese_data, 10));
|
||||
names.addName("uk", QString(ukrainian_data, 20));
|
||||
names.addName("zh", QString(chinese_data, 4));
|
||||
return (names);
|
||||
#else
|
||||
# if TODO_LIST
|
||||
# pragma message("@TODO remove code for QT 6 or later")
|
||||
# endif
|
||||
qDebug() << "Help code for QT 6 or later";
|
||||
NamesList names;
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
names.addName("uk", "Імпортовані елементи");
|
||||
return (names);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETProject::writeBackup
|
||||
Write a backup file of this project, in the case that QET crash
|
||||
@@ -2110,7 +1982,7 @@ void QETProject::removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection
|
||||
}
|
||||
|
||||
/**
|
||||
Handles the fact a digram changed the title block template it used
|
||||
Handles the fact that a diagram changed the title block template it uses
|
||||
@param template_name Name of the template
|
||||
*/
|
||||
void QETProject::usedTitleBlockTemplateChanged(const QString &template_name) {
|
||||
|
||||
@@ -234,7 +234,6 @@ class QETProject : public QObject
|
||||
void writeProjectPropertiesXml(QDomElement &);
|
||||
void writeDefaultPropertiesXml(QDomElement &);
|
||||
void addDiagram(Diagram *diagram, int pos = -1);
|
||||
NamesList namesListForIntegrationCategory();
|
||||
void writeBackup();
|
||||
void init();
|
||||
ProjectState openFile(QFile *file);
|
||||
|
||||
@@ -179,7 +179,7 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
|
||||
//If a conductor was already created between these two terminals
|
||||
//in this undo command, from another removed element, we do nothing
|
||||
bool exist_ = false;
|
||||
for (QPair<Terminal *, Terminal *> pair : m_connected_terminals)
|
||||
for (std::pair<Terminal *, Terminal *> pair : m_connected_terminals)
|
||||
{
|
||||
if (pair.first == hub_terminal && pair.second == t) {
|
||||
exist_ = true;
|
||||
@@ -192,14 +192,8 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
|
||||
|
||||
if (exist_ == false)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
m_connected_terminals.append(qMakePair<Terminal *, Terminal *>(hub_terminal, t));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
m_connected_terminals.append(std::make_pair<Terminal *, Terminal *>((Terminal *)hub_terminal, (Terminal *)t));
|
||||
qInfo() << "m_connected_terminals" << m_connected_terminals;
|
||||
Conductor *new_cond = new Conductor(hub_terminal, t);
|
||||
new_cond->setProperties(properties);
|
||||
new AddGraphicsObjectCommand(new_cond, t->diagram(), QPointF(), this);
|
||||
|
||||
@@ -52,7 +52,7 @@ class DeleteQGraphicsItemCommand : public QUndoCommand
|
||||
QHash <Element *, QList<Element *> > m_link_hash; /// keep linked element for each removed element linked to other element.
|
||||
QHash <DynamicElementTextItem *, Element *> m_elmt_text_hash; /// Keep the parent element of each deleted dynamic element text item
|
||||
QHash <DynamicElementTextItem *, ElementTextItemGroup *> m_grp_texts_hash; ///Keep the parent group of each deleted element text item
|
||||
QList <QPair<Terminal *, Terminal *>> m_connected_terminals;
|
||||
QList <std::pair<Terminal *, Terminal *>> m_connected_terminals;
|
||||
QHash <QetGraphicsTableItem *, QPointer<QGraphicsScene>> m_table_scene_hash;
|
||||
bool m_remove_linked_table = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user