Compare commits

...

42 Commits

Author SHA1 Message Date
Laurent Trinques 31aaf50572 Merge pull request #388 from Bisku/master
qet_de updated
2025-03-16 09:26:49 +01:00
Bisku 81ec28d1cf Update of qet_de
Translation error fixed.
2025-03-15 21:11:02 +01:00
Laurent Trinques 3bbb6385b8 Merge pull request #387 from plc-user/master
only calculate grid-point-size, when min != max
2025-03-15 18:45:16 +01:00
plc-user 757df90951 minor: added some English comments 2025-03-13 21:05:21 +01:00
plc-user eeb453f120 only calculate grid-point-size, when min != max 2025-03-13 20:46:04 +01:00
Laurent Trinques 6afd9fe48d Merge pull request #386 from elevatormind/master
Mouse hover text for dynamic text items
2025-03-13 11:07:40 +01:00
Laurent Trinques 6eff69bc6b Merge pull request #384 from plc-user/master
improvement: adjust size of grid-dots with zoom-factor
2025-03-13 11:06:30 +01:00
Magnus Hellströmer c9304892e0 Mouse hover text for dynamic text items
- Added text for dynamic text item to indicate that shift needs to be held down to move the text.
2025-03-12 21:16:25 +01:00
plc-user 59f547b4a2 unify German wording 2025-03-08 15:16:33 +01:00
plc-user 0084dcf289 fix typo with function-name 2025-03-07 20:53:07 +01:00
plc-user 0804d3524a improvement: ajust size of grid-dots with zoom-factor
Introduced additional spinboxes in config-page for
setting min- and max-size of grid-dots separately for
diagram- and element-editor.
That assures maximal flexibility for setting the grids.
Don't want the grid-dots to change over zooming-levels?
Set min- and max-values to the same number.
Preset-values for all min-/max-values is "1".
If the adjustable range of 1 to 5 is not sufficient, it
can be easily adjusted. Only need feedback for this.
2025-03-07 20:16:21 +01:00
plc-user 2b0dd1b188 comments and whitespace 2025-03-07 18:13:53 +01:00
Laurent Trinques 3c2c889922 Merge pull request #383 from plc-user/master
adjust zoom-factor to use cosmetic-line and fixed comments
2025-03-07 11:07:31 +01:00
plc-user 27cff81ee7 adjust zoom-factor to use cosmetic-line and fixed comments 2025-03-07 10:58:47 +01:00
Laurent Trinques 40a7995993 Merge pull request #382 from plc-user/master
element-editor: fix jumping positions when rotate, mirror or flip
2025-03-07 07:57:16 +01:00
plc-user 45afd9af0e element-editor: fix jumping positions when rotate, mirror or flip 2025-03-07 07:43:20 +01:00
Laurent Trinques 20b7e1763d Merge pull request #379 from plc-user/master
unify some more code for Qt5 & Qt6 (and more)
2025-03-07 06:35:07 +01:00
plc-user 9044d532ac corrected English comments 2025-03-06 08:07:49 +01:00
plc-user 50efc318e0 change to run code with Qt5 & Qt6 as described in forum 2025-03-06 08:06:36 +01:00
plc-user e4d2dbd2a6 a minor change is enough to run code in Qt5 & Qt6 - no need to differentiate anymore 2025-03-05 15:24:07 +01:00
plc-user ddf40854dc fix comment 2025-03-05 11:54:58 +01:00
plc-user ef0fa6e7ac same change for polygons as for other primitives to support Qt5 & Qt6 2025-03-05 09:49:16 +01:00
plc-user 237c21bad8 use same code for Qt5 & Qt6 for XRef-list 2025-03-05 07:05:12 +01:00
plc-user 260ce2a8bc unify NamesList "imported elements" to be used with Qt5 & Qt6; still need to decide whether to use list of QChars or written text in utf-8; kept both variants for now... 2025-03-05 07:03:38 +01:00
plc-user 6199367166 remove unused NamesList from qetproject.* 2025-03-05 06:59:09 +01:00
plc-user d073e810b8 set default-value for QFont::Weight to prevent warning at runtime 2025-03-05 06:55:14 +01:00
Laurent Trinques a1572be8fa Merge pull request #377 from plc-user/master
same simplifications as in #376 "use the same code for Qt5 & Qt6"
2025-03-04 15:09:20 +01:00
plc-user 6c52d95201 same simplifications as in #376 "use the same code for Qt5 & Qt6" 2025-03-03 22:41:44 +01:00
Laurent Trinques d3463def98 Merge pull request #376 from plc-user/master
simplify and use the same code for Qt5 & Qt6
2025-03-03 06:16:21 +01:00
plc-user 4009e6aaab simplify and use the same code for Qt5 & Qt6
When reading and comparing Qt5-docs and Qt6-docs, I read,
that there are no differences in the functions!
So it is not necessary to have the differentiation
between the Qt-Versions.
Code compiles without errors or warnings for Qt5 and Qt6.
2025-03-02 18:56:34 +01:00
Laurent Trinques 6ff518ec3b Merge pull request #375 from plc-user/master
bordertitleblock: use same code for Qt5 & Qt6 for "numbering" rows
2025-03-02 09:53:11 +01:00
plc-user 513927424f bordertitleblock: use same code for Qt5 & Qt6 for "numbering" rows 2025-03-02 08:48:19 +01:00
Laurent Trinques 864a3f166f Merge pull request #374 from plc-user/master
some minor changes
2025-03-01 07:19:28 +01:00
plc-user 6111d8ca2c only write author-information, if available 2025-02-28 21:08:12 +01:00
plc-user e0b26592c7 fix typos 2025-02-28 20:36:38 +01:00
plc-user a17ceaba85 sort names in desktop-file by alphabet 2025-02-28 20:27:00 +01:00
plc-user e987d8c271 fix typo in variable-name 2025-02-28 20:25:31 +01:00
Laurent Trinques 74e6657ca5 Add translations FR 2025-02-28 17:35:57 +01:00
Laurent Trinques e1d15f3b77 Merge pull request #372 from plc-user/master
implement setting of point-size of grids
2025-02-28 17:30:58 +01:00
plc-user 81f51b3d58 update language-files 2025-02-28 16:55:18 +01:00
plc-user a36de7de74 implement variable point-size of grid 2025-02-28 16:33:24 +01:00
plc-user 15ae8b0058 fix typo of variable 2025-02-28 16:02:58 +01:00
70 changed files with 5987 additions and 4946 deletions
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+197 -159
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+201 -163
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+198 -159
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+196 -158
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+196 -158
View File
File diff suppressed because it is too large Load Diff
+23 -23
View File
@@ -10,37 +10,37 @@ MimeType=application/x-qet-project;application/x-qet-element;application/x-qet-t
Categories=Graphics;Qt;VectorGraphics;Science;Electricity;Engineering; Categories=Graphics;Qt;VectorGraphics;Science;Electricity;Engineering;
Keywords=Graphics;Science;Electricity;Engineering; Keywords=Graphics;Science;Electricity;Engineering;
Comment=Edit electrical diagrams. Comment=Edit electrical diagrams.
Comment[de]=Elektroschaltpläne erstellen und bearbeiten.
Comment[fr]=Éditer des schémas électriques.
Comment[ar]=تحرير مخططات كهربائية Comment[ar]=تحرير مخططات كهربائية
Comment[es]=Editar esquemas eléctricos
Comment[ru]=Создание и редактирование электрических схем.
Comment[ca]=Editar esquemes elèctrics.
Comment[pt]=Criar esquemas eléctricos.
Comment[cs]=Editor výkresů elektrických obvodů
Comment[pl]=Edycja schematów elektrycznych
Comment[it]=Disegnare schemi elettrici
Comment[hr]=Uredi elektro sheme
Comment[el]=Επεξεργασία ηλεκτρικών διαγραμμάτων
Comment[nl]=Bewerken bedradingsdiagrammen.
Comment[be]=Bewerken elektrisch schema. Comment[be]=Bewerken elektrisch schema.
Comment[ca]=Editar esquemes elèctrics.
Comment[cs]=Editor výkresů elektrických obvodů
Comment[da]=Rediger elektriske diagrammer. Comment[da]=Rediger elektriske diagrammer.
Comment[de]=Elektroschaltpläne erstellen und bearbeiten.
Comment[el]=Επεξεργασία ηλεκτρικών διαγραμμάτων
Comment[es]=Editar esquemas eléctricos
Comment[fr]=Éditer des schémas électriques.
Comment[hr]=Uredi elektro sheme
Comment[it]=Disegnare schemi elettrici
Comment[ja]=電気回路図の編集。 Comment[ja]=電気回路図の編集。
Comment[nl]=Bewerken bedradingsdiagrammen.
Comment[pl]=Edycja schematów elektrycznych
Comment[pt]=Criar esquemas eléctricos.
Comment[ru]=Создание и редактирование электрических схем.
Comment[sk]=Úprava elektrických schém. Comment[sk]=Úprava elektrických schém.
GenericName=Electrical diagram editor GenericName=Electrical diagram editor
GenericName[de]=Schaltplaneditor
GenericName[fr]=Éditeur de schémas électriques
GenericName[ar]=مُحرّر مخططات كهربائية GenericName[ar]=مُحرّر مخططات كهربائية
GenericName[es]=Editor de esquemas eléctricos
GenericName[ru]=Редактор электрических схем
GenericName[pt]=Editor de esquemas eléctricos.
GenericName[cs]=Editor výkresů elektrických obvodů
GenericName[pl]=Edytor schematów elektrycznych
GenericName[it]=Programma per disegnare schemi elettrici
GenericName[hr]=Editor elektro sheme
GenericName[el]=Επεξεργαστής ηλεκτρικών διαγραμμάτων
GenericName[nl]=Elektrische schema editor
GenericName[be]=Elektrische schema editor GenericName[be]=Elektrische schema editor
GenericName[cs]=Editor výkresů elektrických obvodů
GenericName[da]=Elektrisk diagram redigering GenericName[da]=Elektrisk diagram redigering
GenericName[de]=Schaltplaneditor
GenericName[el]=Επεξεργαστής ηλεκτρικών διαγραμμάτων
GenericName[es]=Editor de esquemas eléctricos
GenericName[fr]=Éditeur de schémas électriques
GenericName[hr]=Editor elektro sheme
GenericName[it]=Programma per disegnare schemi elettrici
GenericName[ja]=電気回路図エディタ GenericName[ja]=電気回路図エディタ
GenericName[nl]=Elektrische schema editor
GenericName[pl]=Edytor schematów elektrycznych
GenericName[pt]=Editor de esquemas eléctricos.
GenericName[ru]=Редактор электрических схем
GenericName[sk]=Editor elektrických schém GenericName[sk]=Editor elektrických schém
@@ -46,125 +46,64 @@ XmlElementCollection::XmlElementCollection(QETProject *project) :
collection.appendChild(import); collection.appendChild(import);
NamesList names; NamesList names;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove const QChar chinese_data[4] ={
QChar(0x5BFC), QChar(0x5165), QChar(0x5143), QChar(0x4EF6)};
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] = { const QChar greek_data[18] = {
0x0395, QChar(0x0395), QChar(0x03b9), QChar(0x03c3), QChar(0x03b7),
0x03b9, QChar(0x03b3), QChar(0x03bc), QChar(0x03ad), QChar(0x03bd),
0x03c3, QChar(0x03b1), QChar(0x0020), QChar(0x03c3), QChar(0x03c4),
0x03b7, QChar(0x03bf), QChar(0x03b9), QChar(0x03c7), QChar(0x03b5),
0x03b3, QChar(0x03af), QChar(0x03b1)};
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] = { const QChar japanese_data[10] = {
0x30A4, QChar(0x30A4), QChar(0x30F3), QChar(0x30D0), QChar(0x30FC),
0x30F3, QChar(0x30C8), QChar(0x3055), QChar(0x308C), QChar(0x305F),
0x30D0, QChar(0x8981), QChar(0x7D20)};
0x30FC, const QChar russian_data[24] = {
0x30C8, QChar(0x0418), QChar(0x043C), QChar(0x043F), QChar(0x043E),
0x3055, QChar(0x0440), QChar(0x0442), QChar(0x0438), QChar(0x0440),
0x308C, QChar(0x043E), QChar(0x0432), QChar(0x0430), QChar(0x043D),
0x305F, QChar(0x043D), QChar(0x044B), QChar(0x0435), QChar(0x0020),
0x8981, QChar(0x044D), QChar(0x043B), QChar(0x0435), QChar(0x043C),
0x7D20}; 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("ca", "Elements importats");
names.addName("cs", "Zavedené prvky"); names.addName("cs", "Zavedené prvky");
names.addName("da", "Importerede elementer"); 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", QString(greek_data, 18));
//names.addName("el", "Εισηγμένα στοιχεία);
names.addName("en", "Imported elements"); names.addName("en", "Imported elements");
names.addName("es", "Elementos importados"); names.addName("es", "Elementos importados");
names.addName("fr", "Éléments importés"); names.addName("fr", "Éléments importés");
names.addName("hr", "Uvezeni elementi"); names.addName("hr", "Uvezeni elementi");
names.addName("it", "Elementi importati"); names.addName("it", "Elementi importati");
names.addName("ja", QString(japanese_data, 10)); 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", "Elementen geïmporteerd");
names.addName("nl_BE", "Elementen geïmporteerd");
names.addName("pl", "Elementy importowane"); 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("ro", "Elemente importate");
names.addName("ru", QString(russian_data, 24)); names.addName("ru", QString(russian_data, 24));
//names.addName("ru", "Импортированные элементы");
names.addName("sl", "Uvoženi elementi"); names.addName("sl", "Uvoženi elementi");
names.addName("sv", "Importerade element");
names.addName("tr", QString(turkish_data, 12)); names.addName("tr", QString(turkish_data, 12));
//names.addName("tr", "İthal öğeler");
names.addName("uk", QString(ukrainian_data, 20)); names.addName("uk", QString(ukrainian_data, 20));
#else //names.addName("uk", "Імпортовані елементи");
# if TODO_LIST names.addName("zh", QString(chinese_data, 4));
# pragma message("@TODO remove code for QT 6 or later") //names.addName("zh", "导入元件");
# 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
import.appendChild(names.toXml(m_dom_document)); import.appendChild(names.toXml(m_dom_document));
} }
+3 -10
View File
@@ -941,19 +941,12 @@ QString BorderTitleBlock::incrementLetters(const QString &string) {
} else { } else {
// separate previous digits from last digit // separate previous digits from last digit
// separe les digits precedents du dernier digit // separe les digits precedents du dernier digit
QString first_digits(string.left(string.count() - 1)); QString first_digits(string.left(string.length() - 1));
QChar last_digit(string.at(string.count() - 1)); char last_digit(string.at(string.length() - 1).unicode());
if (last_digit != 'Z') { if (last_digit != 'Z') {
// increments the last digit // increments the last digit
// incremente le dernier digit // incremente le dernier digit
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove last_digit = (char)(string[string.length()-1].unicode()) + 1;
last_digit = last_digit.toLatin1() + 1;
#else
# if TODO_LIST
# pragma message("@TODO remove code for QT 6 or later")
# endif
qDebug() << "Help code for QT 6 or later";
#endif
return(first_digits + QString(last_digit)); return(first_digits + QString(last_digit));
} else { } else {
return(incrementLetters(first_digits) + "A"); return(incrementLetters(first_digits) + "A");
+27 -6
View File
@@ -186,7 +186,7 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
p -> drawRect(r); p -> drawRect(r);
if (draw_grid_) { if (draw_grid_) {
/* Draw the point of the grid /* Draw the points of the grid
* if background color is black, * if background color is black,
* then grid spots shall be white, * then grid spots shall be white,
* else they shall be black in color. * else they shall be black in color.
@@ -213,8 +213,8 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
.insideBorderRect() .insideBorderRect()
.intersected(r); .intersected(r);
qreal limite_x = rect.x() + rect.width(); qreal limit_x = rect.x() + rect.width();
qreal limite_y = rect.y() + rect.height(); qreal limit_y = rect.y() + rect.height();
int g_x = (int)ceil(rect.x()); int g_x = (int)ceil(rect.x());
while (g_x % xGrid) ++ g_x; while (g_x % xGrid) ++ g_x;
@@ -222,12 +222,33 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
while (g_y % yGrid) ++ g_y; while (g_y % yGrid) ++ g_y;
QPolygon points; QPolygon points;
for (int gx = g_x ; gx < limite_x ; gx += xGrid) { for (int gx = g_x ; gx < limit_x ; gx += xGrid) {
for (int gy = g_y ; gy < limite_y ; gy += yGrid) { for (int gy = g_y ; gy < limit_y ; gy += yGrid) {
points << QPoint(gx, gy); points << QPoint(gx, gy);
} }
} }
p -> drawPoints(points);
qreal zoom_factor = p->transform().m11();
int minWidthPen = settings.value(QStringLiteral("diagrameditor/grid_pointsize_min"), 1).toInt();
int maxWidthPen = settings.value(QStringLiteral("diagrameditor/grid_pointsize_max"), 1).toInt();
pen.setWidth(minWidthPen);
if (minWidthPen != maxWidthPen) {
qreal stepPen = (maxWidthPen - minWidthPen) / (qreal)maxWidthPen;
qreal stepZoom = (5.0 - 1.0) / maxWidthPen;
for (int n=0; n<maxWidthPen; n++) {
if ((zoom_factor > (1.0 + n * stepZoom)) && (zoom_factor <= (1.0 + (n+1) * stepZoom))) {
int widthPen = minWidthPen + qRound(n * stepPen);
pen.setWidth(widthPen);
}
}
if (zoom_factor <= 1.0)
pen.setWidth(minWidthPen);
else if (zoom_factor > (1.0 + stepZoom * maxWidthPen))
pen.setWidth(maxWidthPen);
}
p -> setPen(pen);
if (zoom_factor > 0.5) // no grid below ... !
p -> drawPoints(points);
} }
if (use_border_) border_and_titleblock.draw(p); if (use_border_) border_and_titleblock.draw(p);
+1 -1
View File
@@ -1153,7 +1153,7 @@ void DiagramView::editSelection()
QGraphicsItem *item = m_diagram->selectedItems().first(); QGraphicsItem *item = m_diagram->selectedItems().first();
//We use dynamic_cast instead of qgraphicsitem_cast for QetGraphicsItem //We use dynamic_cast instead of qgraphicsitem_cast for QetGraphicsItem
//because they haven't got they own type(). //because they haven't got their own type().
//Use qgraphicsitem_cast will have weird behavior for this class. //Use qgraphicsitem_cast will have weird behavior for this class.
if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item))
iti -> edit(); iti -> edit();
@@ -63,9 +63,9 @@ void OpenElmtCommand::redo()
m_scene->addItems(m_graphics_item.toVector()); m_scene->addItems(m_graphics_item.toVector());
} }
#pragma message("@TODO uncommante slot_select when fixed, see itemChange function for each primitive") #pragma message("@TODO uncomment slot_select when fixed, see itemChange function for each primitive")
//Commented because take a lot of time //Commented because it takes a lot of time
//when a lot of primitive are loaded //when a lot of primitives are loaded!
//need work //needs work
//m_scene->slot_select(m_graphics_item); //m_scene->slot_select(m_graphics_item);
} }
+6 -4
View File
@@ -478,10 +478,12 @@ const QDomDocument ElementScene::toXml(bool all_parts)
root.appendChild(element_info); root.appendChild(element_info);
} }
//complementary information about the element //complementary information about the element, when available
QDomElement informations_element = xml_document.createElement("informations"); if (!(m_element_data.m_drawing_information.trimmed().isEmpty())) {
root.appendChild(informations_element); QDomElement informations_element = xml_document.createElement("informations");
informations_element.appendChild(xml_document.createTextNode(m_element_data.m_drawing_information.trimmed())); root.appendChild(informations_element);
informations_element.appendChild(xml_document.createTextNode(m_element_data.m_drawing_information.trimmed()));
}
QDomElement description = xml_document.createElement("description"); QDomElement description = xml_document.createElement("description");
+31 -8
View File
@@ -480,6 +480,7 @@ bool ElementView::event(QEvent *e) {
/** /**
Utilise le pincement du trackpad pour zoomer Utilise le pincement du trackpad pour zoomer
Use trackpad pinch to zoom
@brief ElementView::gestureEvent @brief ElementView::gestureEvent
@param event @param event
@return @return
@@ -502,6 +503,7 @@ bool ElementView::gestureEvent(QGestureEvent *event){
/** /**
Dessine l'arriere-plan de l'editeur, cad la grille. Dessine l'arriere-plan de l'editeur, cad la grille.
Draws the editor background, i.e. the grid.
@param p Le QPainter a utiliser pour dessiner @param p Le QPainter a utiliser pour dessiner
@param r Le rectangle de la zone a dessiner @param r Le rectangle de la zone a dessiner
*/ */
@@ -514,20 +516,23 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
p -> setRenderHint(QPainter::SmoothPixmapTransform, false); p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
// dessine un fond blanc // dessine un fond blanc
// draw a white background
p -> setPen(Qt::NoPen); p -> setPen(Qt::NoPen);
p -> setBrush(Qt::white); p -> setBrush(Qt::white);
p -> drawRect(r); p -> drawRect(r);
// determine le zoom en cours // determine le zoom en cours
// determine the zoom-level
qreal zoom_factor = transform().m11(); qreal zoom_factor = transform().m11();
// choisit la granularite de la grille en fonction du zoom en cours // choisit la granularite de la grille en fonction du zoom en cours
// selects the grid granularity according to the current zoom level
int drawn_x_grid = 1;//scene_ -> xGrid(); int drawn_x_grid = 1;//scene_ -> xGrid();
int drawn_y_grid = 1;//scene_ -> yGrid(); int drawn_y_grid = 1;//scene_ -> yGrid();
bool draw_grid = true; bool draw_grid = true;
bool draw_cross = false; bool draw_cross = false;
if (zoom_factor < (4.0/3.0)) { //< no grid if (zoom_factor < 1.0) { //< no grid
draw_grid = false; draw_grid = false;
} else if (zoom_factor < 4.0) { //< grid 10*10 } else if (zoom_factor < 4.0) { //< grid 10*10
drawn_x_grid *= 10; drawn_x_grid *= 10;
@@ -547,25 +552,43 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
m_scene->setGrid(drawn_x_grid, drawn_y_grid); m_scene->setGrid(drawn_x_grid, drawn_y_grid);
if (draw_grid) { if (draw_grid) {
// draw the dot of the grid // draw the dots of the grid
QPen pen(Qt::black); QPen pen(Qt::black);
pen.setCosmetic(true); pen.setCosmetic(true);
QSettings settings;
int minWidthPen = settings.value(QStringLiteral("elementeditor/grid_pointsize_min"), 1).toInt();
int maxWidthPen = settings.value(QStringLiteral("elementeditor/grid_pointsize_max"), 1).toInt();
pen.setWidth(minWidthPen);
if (minWidthPen != maxWidthPen) {
qreal stepPen = (maxWidthPen - minWidthPen) / (qreal)maxWidthPen;
qreal stepZoom = (25.0 - 1.0) / maxWidthPen;
for (int n=0; n<maxWidthPen; n++) {
if ((zoom_factor > (1.0 + n * stepZoom)) && (zoom_factor <= (1.0 + (n+1) * stepZoom))) {
int widthPen = minWidthPen + qRound(n * stepPen);
pen.setWidth(widthPen);
}
}
if (zoom_factor <= 1.0)
pen.setWidth(minWidthPen);
else if (zoom_factor > (1.0 + stepZoom * maxWidthPen))
pen.setWidth(maxWidthPen);
}
p -> setPen(pen); p -> setPen(pen);
p -> setBrush(Qt::NoBrush); p -> setBrush(Qt::NoBrush);
qreal limite_x = r.x() + r.width(); qreal limit_x = r.x() + r.width();
qreal limite_y = r.y() + r.height(); qreal limit_y = r.y() + r.height();
int g_x = (int)ceil(r.x()); int g_x = (int)ceil(r.x());
while (g_x % drawn_x_grid) ++ g_x; while (g_x % drawn_x_grid) ++ g_x;
int g_y = (int)ceil(r.y()); int g_y = (int)ceil(r.y());
while (g_y % drawn_y_grid) ++ g_y; while (g_y % drawn_y_grid) ++ g_y;
for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) { for (int gx = g_x ; gx < limit_x ; gx += drawn_x_grid) {
for (int gy = g_y ; gy < limite_y ; gy += drawn_y_grid) { for (int gy = g_y ; gy < limit_y ; gy += drawn_y_grid) {
if (draw_cross) { if (draw_cross) {
if (!(gx % 10) && !(gy % 10)) { if (!(gx % 10) && !(gy % 10)) {
p -> drawLine(QLineF(gx - 0.25, gy, gx + 0.25, gy)); p -> drawLine(QLineF(gx - (pen.width()/4.0), gy, gx + (pen.width()/4.0), gy));
p -> drawLine(QLineF(gx, gy - 0.25, gx, gy + 0.25)); p -> drawLine(QLineF(gx, gy - (pen.width()/4.0), gx, gy + (pen.width()/4.0)));
} else { } else {
p -> drawPoint(gx, gy); p -> drawPoint(gx, gy);
} }
+25 -28
View File
@@ -61,14 +61,7 @@ void PartArc::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
//Always remove the brush //Always remove the brush
painter -> setBrush(Qt::NoBrush); painter -> setBrush(Qt::NoBrush);
QPen t = painter -> pen(); 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); t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
#endif
painter -> setPen(t); painter -> setPen(t);
if (isSelected()) if (isSelected())
@@ -175,25 +168,25 @@ void PartArc::setRotation(qreal angle) {
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0;
m_rot = QET::correctAngle(angle, true); m_rot = QET::correctAngle(angle, true);
// idea taken from QET_ElementScaler: // 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) { if (diffAngle > 0) {
m_start_angle += 270.0 * 16; m_start_angle += 270.0 * 16;
while (m_start_angle < 0) { m_start_angle += (360*16); } while (m_start_angle < 0) { m_start_angle += (360*16); }
while (m_start_angle >= (360*16)) { m_start_angle -= (360*16); } while (m_start_angle >= (360*16)) { m_start_angle -= (360*16); }
qreal width = m_rect.height(); x = (p1.y() + m_rect.height()) * (-1);
qreal height = m_rect.width(); y = p1.x();
qreal x = (m_rect.y() + m_rect.height()) * (-1); } else {
qreal y = m_rect.x(); m_start_angle -= 270.0 * 16;
m_rect = QRectF(x, y, width, height); while (m_start_angle < 0) { m_start_angle += (360*16); }
} else { while (m_start_angle >= (360*16)) { m_start_angle -= (360*16); }
m_start_angle -= 270.0 * 16; x = p1.y();
while (m_start_angle < 0) { m_start_angle += (360*16); } y = (p1.x() + m_rect.width()) * (-1);
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);
} }
p1 = mapFromScene(x, y);
m_rect = QRectF(p1.x(), p1.y(), width, height);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
@@ -209,8 +202,10 @@ void PartArc::flip() {
m_span_angle = (-1) * m_span_angle; m_span_angle = (-1) * m_span_angle;
while (m_start_angle < 0) { m_start_angle += (360*16); } while (m_start_angle < 0) { m_start_angle += (360*16); }
while (m_start_angle >= (360*16)) { 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(); auto p1 = mapToScene(m_rect.x(),m_rect.y());
m_rect = QRectF(m_rect.x(), y, m_rect.width(), m_rect.height()); 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(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
emit rectChanged(); emit rectChanged();
@@ -221,8 +216,10 @@ void PartArc::mirror() {
m_span_angle = (-1) * m_span_angle; m_span_angle = (-1) * m_span_angle;
while (m_start_angle < 0) { m_start_angle += (360*16); } while (m_start_angle < 0) { m_start_angle += (360*16); }
while (m_start_angle >= (360*16)) { 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(); auto p1 = mapToScene(m_rect.x(),m_rect.y());
m_rect = QRectF(x, m_rect.y(), m_rect.width(), m_rect.height()); 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(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
emit rectChanged(); emit rectChanged();
+18 -21
View File
@@ -57,14 +57,7 @@ void PartEllipse::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
QPen t = painter -> pen(); 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); t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
#endif
if (isSelected()) if (isSelected())
t.setColor(Qt::red); t.setColor(Qt::red);
@@ -241,19 +234,19 @@ void PartEllipse::setRotation(qreal angle) {
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0;
m_rot = QET::correctAngle(angle, true); m_rot = QET::correctAngle(angle, true);
// idea taken from QET_ElementScaler: // 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) { if (diffAngle > 0) {
qreal width = m_rect.height(); x = (p1.y() + m_rect.height()) * (-1);
qreal height = m_rect.width(); y = p1.x();
qreal x = (m_rect.y() + m_rect.height()) * (-1);
qreal y = m_rect.x();
m_rect = QRectF(x, y, width, height);
} else { } else {
qreal width = m_rect.height(); x = m_rect.y();
qreal height = m_rect.width(); y = (m_rect.x() + m_rect.width()) * (-1);
qreal x = m_rect.y();
qreal y = (m_rect.x() + m_rect.width()) * (-1);
m_rect = QRectF(x, y, width, height);
} }
p1 = mapFromScene(x, y);
m_rect = QRectF(p1.x(), p1.y(), width, height);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
emit rectChanged(); emit rectChanged();
@@ -264,16 +257,20 @@ qreal PartEllipse::rotation() const {
} }
void PartEllipse::flip() { void PartEllipse::flip() {
qreal y = ((-1.0) * m_rect.y()) - m_rect.height(); auto p1 = mapToScene(m_rect.x(), m_rect.y());
m_rect = QRectF(m_rect.x(), y, m_rect.width(), m_rect.height()); 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(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
emit rectChanged(); emit rectChanged();
} }
void PartEllipse::mirror() { void PartEllipse::mirror() {
qreal x = ((-1.0) * m_rect.x()) - m_rect.width(); auto p1 = mapToScene(m_rect.x(), m_rect.y());
m_rect = QRectF(x, m_rect.y(), m_rect.width(), m_rect.height()); 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(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
emit rectChanged(); emit rectChanged();
+18 -13
View File
@@ -81,14 +81,7 @@ void PartLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
QPen t = painter -> pen(); QPen t = painter -> pen();
t.setJoinStyle(Qt::MiterJoin); t.setJoinStyle(Qt::MiterJoin);
#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); t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
#endif
if (isSelected()) t.setColor(Qt::red); if (isSelected()) t.setColor(Qt::red);
painter -> setPen(t); painter -> setPen(t);
@@ -581,8 +574,12 @@ void PartLine::setSecondEndLength(const qreal &l)
void PartLine::setRotation(qreal angle) { void PartLine::setRotation(qreal angle) {
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0;
m_rot = QET::correctAngle(angle, true); m_rot = QET::correctAngle(angle, true);
m_line.setP1(QTransform().rotate(diffAngle).map(m_line.p1())); auto p1 = mapToScene(m_line.p1());
m_line.setP2(QTransform().rotate(diffAngle).map(m_line.p2())); 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(); prepareGeometryChange();
setLine(m_line); setLine(m_line);
adjustHandlerPos(); adjustHandlerPos();
@@ -594,8 +591,12 @@ qreal PartLine::rotation() const {
} }
void PartLine::flip() { void PartLine::flip() {
m_line.setP1(QPointF(m_line.p1().x(), (-1) * m_line.p1().y())); auto p1 = mapToScene(m_line.p1());
m_line.setP2(QPointF(m_line.p2().x(), (-1) * m_line.p2().y())); 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); setLine(m_line);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
@@ -603,8 +604,12 @@ void PartLine::flip() {
} }
void PartLine::mirror() { void PartLine::mirror() {
m_line.setP1(QPointF((-1) * m_line.p1().x(), m_line.p1().y())); auto p1 = mapToScene(m_line.p1());
m_line.setP2(QPointF((-1) * m_line.p2().x(), m_line.p2().y())); 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); setLine(m_line);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
+10 -9
View File
@@ -66,14 +66,7 @@ void PartPolygon::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
applyStylesToQPainter(*painter); applyStylesToQPainter(*painter);
QPen t = painter -> pen(); 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); t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
#endif
if (isSelected()) t.setColor(Qt::red); if (isSelected()) t.setColor(Qt::red);
painter -> setPen(t); painter -> setPen(t);
@@ -299,8 +292,12 @@ void PartPolygon::resetAllHandlerColor()
void PartPolygon::setRotation(qreal angle) { void PartPolygon::setRotation(qreal angle) {
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0;
m_rot = QET::correctAngle(angle, true); m_rot = QET::correctAngle(angle, true);
QTransform rotation = QTransform().rotate(diffAngle); for (auto &pt : m_polygon) {
setPolygon(rotation.map(m_polygon)); pt = mapToScene(pt.x(), pt.y());
pt = QTransform().rotate(diffAngle).map(pt);
pt = mapFromScene(pt.x(), pt.y());
}
setPolygon(m_polygon);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
emit polygonChanged(); emit polygonChanged();
@@ -312,7 +309,9 @@ qreal PartPolygon::rotation() const {
void PartPolygon::flip() { void PartPolygon::flip() {
for (auto &pt : m_polygon) { for (auto &pt : m_polygon) {
pt = mapToScene(pt.x(), pt.y());
pt = QPointF(pt.x(), (-1) * pt.y()); pt = QPointF(pt.x(), (-1) * pt.y());
pt = mapFromScene(pt.x(), pt.y());
} }
setPolygon(m_polygon); setPolygon(m_polygon);
prepareGeometryChange(); prepareGeometryChange();
@@ -322,7 +321,9 @@ void PartPolygon::flip() {
void PartPolygon::mirror() { void PartPolygon::mirror() {
for (auto &pt : m_polygon) { for (auto &pt : m_polygon) {
pt = mapToScene(pt.x(), pt.y());
pt = QPointF((-1) * pt.x(), pt.y()); pt = QPointF((-1) * pt.x(), pt.y());
pt = mapFromScene(pt.x(), pt.y());
} }
setPolygon(m_polygon); setPolygon(m_polygon);
prepareGeometryChange(); prepareGeometryChange();
+21 -31
View File
@@ -54,14 +54,7 @@ void PartRectangle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
Q_UNUSED(widget); Q_UNUSED(widget);
applyStylesToQPainter(*painter); applyStylesToQPainter(*painter);
QPen t = painter -> pen(); 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); t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
#endif
if (isSelected()) if (isSelected())
t.setColor(Qt::red); t.setColor(Qt::red);
@@ -170,22 +163,19 @@ void PartRectangle::setYRadius(qreal Y)
void PartRectangle::setRotation(qreal angle) { void PartRectangle::setRotation(qreal angle) {
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0;
m_rot = QET::correctAngle(angle, true); m_rot = QET::correctAngle(angle, true);
// for whatever reason: with "rect" we need to use scene-positions... auto p1 = mapToScene(m_rect.x(),m_rect.y());
auto pos = mapToScene(m_rect.x(),m_rect.y());
qreal width = m_rect.height(); qreal width = m_rect.height();
qreal height = m_rect.width(); qreal height = m_rect.width();
qreal x; qreal y; qreal x; qreal y;
if (diffAngle > 0) { if (diffAngle > 0) {
x = (pos.y() + m_rect.height()) * (-1); x = (p1.y() + m_rect.height()) * (-1);
y = pos.x(); y = p1.x();
} else { } else {
x = pos.y(); x = p1.y();
y = (pos.x() + m_rect.width()) * (-1); y = (p1.x() + m_rect.width()) * (-1);
} }
p1 = mapFromScene(x, y);
pos = mapFromScene(x, y); m_rect = QRectF(p1.x(), p1.y(), width, height);
m_rect.setX(pos.x()); m_rect.setY(pos.y());
m_rect.setWidth(width); m_rect.setHeight(height);
std::swap (m_xRadius, m_yRadius); std::swap (m_xRadius, m_yRadius);
prepareGeometryChange(); prepareGeometryChange();
@@ -198,13 +188,13 @@ qreal PartRectangle::rotation() const {
} }
void PartRectangle::flip() { void PartRectangle::flip() {
// for whatever reason: with "rect" we need to use scene-positions... auto height = m_rect.height();
qreal height = m_rect.height(); auto p1 = mapToScene(m_rect.x(),m_rect.y());
auto pos = mapToScene(m_rect.x(),m_rect.y()); qreal x = p1.x();
qreal x = pos.x(); qreal y = ((-1.0) * p1.y()) - height;
qreal y = ((-1.0) * pos.y()) - height; p1 = mapFromScene(x, y);
pos = mapFromScene(x, y); m_rect.setX(p1.x());
m_rect.setX(pos.x()); m_rect.setY(pos.y()); m_rect.setY(p1.y());
m_rect.setHeight(height); m_rect.setHeight(height);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
@@ -212,13 +202,13 @@ void PartRectangle::flip() {
} }
void PartRectangle::mirror() { void PartRectangle::mirror() {
// for whatever reason: with "rect" we need to use scene-positions... auto width = m_rect.width();
qreal width = m_rect.width(); auto p1 = mapToScene(m_rect.x(),m_rect.y());
auto pos = mapToScene(m_rect.x(),m_rect.y()); qreal x = ((-1.0) * p1.x()) - width;
qreal x = ((-1.0) * pos.x()) - width; qreal y = p1.y();
qreal y = pos.y(); p1 = mapFromScene(x, y);
pos = mapFromScene(x, y); m_rect.setX(p1.x());
m_rect.setX(pos.x()); m_rect.setY(pos.y()); m_rect.setY(p1.y());
m_rect.setWidth(width); m_rect.setWidth(width);
prepareGeometryChange(); prepareGeometryChange();
adjustHandlerPos(); adjustHandlerPos();
+22 -26
View File
@@ -84,18 +84,8 @@ void PartTerminal::paint(
QPen t; QPen t;
t.setWidthF(1.0); t.setWidthF(1.0);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
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
// dessin de la borne en rouge // dessin de la borne en rouge
t.setColor(isSelected() ? Terminal::neutralColor : Qt::red); t.setColor(isSelected() ? Terminal::neutralColor : Qt::red);
painter -> setPen(t); painter -> setPen(t);
@@ -168,23 +158,20 @@ void PartTerminal::setRotation(qreal angle) {
else new_ori = Qet::West; else new_ori = Qet::West;
qreal diffAngle = qRound((angle - rotation()) * 100.0) / 100.0; 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); setPos(d->m_pos);
setOrientation(new_ori); setOrientation(new_ori);
updateSecondPoint();
prepareGeometryChange();
emit orientationChanged(); // all terminal-signals call "updateForm" emit orientationChanged(); // all terminal-signals call "updateForm"
} }
/**
@brief PartTerminal::rotation
@return current rotation-angle in degrees
*/
qreal PartTerminal::rotation() const { qreal PartTerminal::rotation() const {
switch (d->m_orientation) { switch (d->m_orientation) {
case Qet::North : return 0; case Qet::North : return 0;
@@ -195,9 +182,13 @@ qreal PartTerminal::rotation() const {
return 0; return 0;
} }
/**
@brief PartTerminal::flip
turn part upside down
*/
void PartTerminal::flip() { 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) { switch (d->m_orientation) {
case Qet::North : setOrientation(Qet::South); case Qet::North : setOrientation(Qet::South);
break; break;
@@ -212,8 +203,13 @@ void PartTerminal::flip() {
emit yChanged(); // all terminal-signals call "updateForm" emit yChanged(); // all terminal-signals call "updateForm"
} }
/**
@brief PartTerminal::mirror
turn part from left to right
*/
void PartTerminal::mirror() { 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) { switch (d->m_orientation) {
case Qet::North : break; case Qet::North : break;
case Qet::East : setOrientation(Qet::West); case Qet::East : setOrientation(Qet::West);
+1 -1
View File
@@ -180,7 +180,7 @@ void ElementsPanelWidget::reloadAndFilter()
} }
/** /**
* Emit the requestForProject signal with te selected project * Emit the requestForProject signal with the selected project
*/ */
void ElementsPanelWidget::activateProject() void ElementsPanelWidget::activateProject()
{ {
+5
View File
@@ -32,6 +32,10 @@
en orientation. Si la chaine fait plusieurs caracteres, seul le en orientation. Si la chaine fait plusieurs caracteres, seul le
premier est pris en compte. En cas d'incoherence, Qet::North est premier est pris en compte. En cas d'incoherence, Qet::North est
retourne. retourne.
Used to convert a string of characters (n, s, e or w)
into orientation. If the string is made up of several characters,
only the only the first is taken into account. In the event of an
inconsistency, Qet::North is returned.
@param s Chaine de caractere cense representer une orientation @param s Chaine de caractere cense representer une orientation
@return l'orientation designee par la chaine de caractere @return l'orientation designee par la chaine de caractere
*/ */
@@ -60,6 +64,7 @@ QString Qet::orientationToString(Qet::Orientation o) {
/** /**
Indique si deux orientations de Borne sont sur le meme axe (Vertical / Horizontal). Indique si deux orientations de Borne sont sur le meme axe (Vertical / Horizontal).
Indicates whether two terminal orientations are on the same axis (Vertical / Horizontal).
@param a La premiere orientation de Borne @param a La premiere orientation de Borne
@param b La seconde orientation de Borne @param b La seconde orientation de Borne
@return Un booleen a true si les deux orientations de bornes sont sur le meme axe @return Un booleen a true si les deux orientations de bornes sont sur le meme axe
+2 -2
View File
@@ -1260,7 +1260,7 @@ QFont QETApp::diagramTextsFont(qreal size)
} }
/** /**
@brief QETApp::diagramTextsItemFont @brief QETApp::diagramTextsItemFont
the font for to use in independent text item the font to use in independent text items
@param size of font @param size of font
@return @return
*/ */
@@ -1275,7 +1275,7 @@ QFont QETApp::diagramTextsItemFont(qreal size)
9.0).toDouble(); 9.0).toDouble();
auto diagram_texts_item_weight = auto diagram_texts_item_weight =
static_cast<QFont::Weight>( static_cast<QFont::Weight>(
settings.value("diagramitemweight").toInt()); settings.value("diagramitemweight", QFont::Normal).toInt());
QString diagram_texts_item_style = settings.value("diagramitemstyle", QString diagram_texts_item_style = settings.value("diagramitemstyle",
"normal").toString(); "normal").toString();
+2 -2
View File
@@ -1597,7 +1597,7 @@ void QETDiagramEditor::slot_updateUndoStack()
/** /**
@brief QETDiagramEditor::slot_updateComplexActions @brief QETDiagramEditor::slot_updateComplexActions
Manage the actions who need some conditions to be enable or not. Manage the actions that need some conditions to be enabled or not.
This method does nothing if there is no project opened This method does nothing if there is no project opened
*/ */
void QETDiagramEditor::slot_updateComplexActions() void QETDiagramEditor::slot_updateComplexActions()
@@ -1633,7 +1633,7 @@ void QETDiagramEditor::slot_updateComplexActions()
int selected_elements_count = dc.count(DiagramContent::Elements); int selected_elements_count = dc.count(DiagramContent::Elements);
m_find_element->setEnabled(selected_elements_count == 1); m_find_element->setEnabled(selected_elements_count == 1);
//Action that need items (elements, conductors, texts...) selected, to be enabled //Actions that need items (elements, conductors, texts...) selected, to be enabled
bool copiable_items = dc.hasCopiableItems(); bool copiable_items = dc.hasCopiableItems();
bool deletable_items = dc.hasDeletableItems(); bool deletable_items = dc.hasDeletableItems();
m_cut -> setEnabled(!ro && copiable_items); m_cut -> setEnabled(!ro && copiable_items);
@@ -991,21 +991,14 @@ void QetGraphicsTableItem::adjustColumnsWidth()
int sum_=0; int sum_=0;
for(auto i= 0 ; i<m_model->columnCount() ; ++i) 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((int)m_minimum_column_width.size()-1, i); //In case of the I is higher than m_minimum_column_width or
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((int)m_header_item->minimumSectionWidth().size()-1, i); //m_header_item->minimumSectionWidth().size()
auto at_b = std::min(m_header_item->minimumSectionWidth().size()-1, i); //m_header_item->minimumSectionWidth().size()
m_header_item->resizeSection( m_header_item->resizeSection(
i, i,
std::max( std::max(
m_minimum_column_width.at(at_a), m_minimum_column_width.at(at_a),
m_header_item->minimumSectionWidth().at(at_b))+b); m_header_item->minimumSectionWidth().at(at_b))+b);
sum_+= m_header_item->sectionSize(i); 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
} }
+20 -25
View File
@@ -384,9 +384,11 @@ void Conductor::generateConductorPath(const QPointF &p1, Qet::Orientation o1, co
points << depart0; points << depart0;
// prolongement de la borne de depart // prolongement de la borne de depart
// extend start terminal
points << depart; points << depart;
// commence le vrai trajet // commence le vrai trajet
// starts the real path
if (depart.y() < arrivee.y()) { if (depart.y() < arrivee.y()) {
// trajet descendant // trajet descendant
if ((ori_depart == Qet::North && (ori_arrivee == Qet::South || ori_arrivee == Qet::West)) || (ori_depart == Qet::East && ori_arrivee == Qet::West)) { if ((ori_depart == Qet::North && (ori_arrivee == Qet::South || ori_arrivee == Qet::West)) || (ori_depart == Qet::East && ori_arrivee == Qet::West)) {
@@ -519,15 +521,8 @@ void Conductor::paint(QPainter *painter, const QStyleOptionGraphicsItem *options
final_conductor_pen.setStyle(m_properties.style); final_conductor_pen.setStyle(m_properties.style);
final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // better rendering with dot final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // better rendering with dot
//Use a cosmetique line, below a certain zoom //Use a cosmetic line, below a certain zoom
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
if (options && options -> levelOfDetail < 1.0)
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
#endif
{ {
final_conductor_pen.setCosmetic(true); final_conductor_pen.setCosmetic(true);
} }
@@ -1100,7 +1095,7 @@ QDomElement Conductor::toXml(QDomDocument &dom_document,
dom_element.setAttribute("userx", QString::number(m_text_item->pos().x())); dom_element.setAttribute("userx", QString::number(m_text_item->pos().x()));
dom_element.setAttribute("usery", QString::number(m_text_item->pos().y())); dom_element.setAttribute("usery", QString::number(m_text_item->pos().y()));
} }
if(m_text_item->wasRotateByUser()) if(m_text_item->wasRotatedByUser())
dom_element.setAttribute("rotation", QString::number(m_text_item->rotation())); dom_element.setAttribute("rotation", QString::number(m_text_item->rotation()));
return(dom_element); return(dom_element);
@@ -1339,17 +1334,17 @@ void Conductor::calculateTextItemPosition()
relatedPotentialConductors(false).size() > 0) relatedPotentialConductors(false).size() > 0)
{ {
Conductor *longuest_conductor = longuestConductorInPotential(this); Conductor *longest_conductor = longestConductorInPotential(this);
//The longuest conductor isn't this conductor //The longest conductor isn't this conductor
//we call calculateTextItemPosition of the longuest conductor //we call calculateTextItemPosition of the longest conductor
if(longuest_conductor != this) if(longest_conductor != this)
{ {
longuest_conductor -> calculateTextItemPosition(); longest_conductor -> calculateTextItemPosition();
return; return;
} }
//At this point this conductor is the longuest conductor we hide all text of conductor_list //At this point this conductor is the longest conductor we hide all text of conductor_list
foreach (Conductor *c, relatedPotentialConductors(false)) { foreach (Conductor *c, relatedPotentialConductors(false)) {
c -> textItem() -> setVisible(false); c -> textItem() -> setVisible(false);
} }
@@ -1374,7 +1369,7 @@ void Conductor::calculateTextItemPosition()
Qt::Orientations rotation; Qt::Orientations rotation;
QPointF text_pos = posForText(rotation); QPointF text_pos = posForText(rotation);
if (!m_text_item -> wasRotateByUser()) if (!m_text_item -> wasRotatedByUser())
{ {
rotation == Qt::Vertical ? m_text_item -> setRotation(m_properties.verti_rotate_text): rotation == Qt::Vertical ? m_text_item -> setRotation(m_properties.verti_rotate_text):
m_text_item -> setRotation(m_properties.horiz_rotate_text); m_text_item -> setRotation(m_properties.horiz_rotate_text);
@@ -2072,19 +2067,19 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
} }
/** /**
@brief longuestConductorInPotential @brief longestConductorInPotential
@param conductor : a conductor in the potential to search @param conductor : a conductor in the potential to search
@param all_diagram : true -> search in the whole project, false -> search only in the diagram of conductor @param all_diagram : true -> search in the whole project, false -> search only in the diagram of conductor
@return the longuest conductor in the same potential of conductor @return the longest conductor in the same potential of conductor
*/ */
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram) { Conductor * longestConductorInPotential(Conductor *conductor, bool all_diagram) {
Conductor *longuest_conductor = conductor; Conductor *longest_conductor = conductor;
//Search the longuest conductor //Search the longest conductor
foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram)) foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram))
if (c -> length() > longuest_conductor -> length()) if (c -> length() > longest_conductor -> length())
longuest_conductor = c; longest_conductor = c;
return longuest_conductor; return longest_conductor;
} }
/** /**
+1 -1
View File
@@ -232,7 +232,7 @@ class Conductor : public QGraphicsObject
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &); static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &);
}; };
Conductor * longuestConductorInPotential (Conductor *conductor, bool all_diagram = false); Conductor * longestConductorInPotential (Conductor *conductor, bool all_diagram = false);
QList <Conductor *> relatedConductors (const Conductor *conductor); QList <Conductor *> relatedConductors (const Conductor *conductor);
@@ -90,10 +90,10 @@ bool ConductorTextItem::wasMovedByUser() const
} }
/** /**
@brief ConductorTextItem::wasRotateByUser @brief ConductorTextItem::wasRotatedByUser
@return true if text was explicit moved by user else false @return true if text was explicit moved by user else false
*/ */
bool ConductorTextItem::wasRotateByUser() const bool ConductorTextItem::wasRotatedByUser() const
{ {
return(rotate_by_user_); return(rotate_by_user_);
} }
+1 -1
View File
@@ -44,7 +44,7 @@ class ConductorTextItem : public DiagramTextItem
void fromXml(const QDomElement &) override; void fromXml(const QDomElement &) override;
int type() const override { return Type; } int type() const override { return Type; }
virtual bool wasMovedByUser() const; virtual bool wasMovedByUser() const;
virtual bool wasRotateByUser() const; virtual bool wasRotatedByUser() const;
virtual void forceMovedByUser(bool); virtual void forceMovedByUser(bool);
virtual void forceRotateByUser(bool); virtual void forceRotateByUser(bool);
virtual void setPos(const QPointF &pos); virtual void setPos(const QPointF &pos);
+7 -1
View File
@@ -483,7 +483,13 @@ void DiagramTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
m_mouse_hover = true; m_mouse_hover = true;
QString str_ToolTip = toPlainText(); QString str_ToolTip = toPlainText();
setToolTip( str_ToolTip );
// Add movement instruction for DynamicElementTextItem
if (inherits("DynamicElementTextItem")) {
str_ToolTip += tr("\n<Shift> to move");
}
setToolTip(str_ToolTip);
update(); update();
} }
+10 -22
View File
@@ -215,31 +215,24 @@ void Element::paint(
drawHighlight(painter, options); drawHighlight(painter, options);
} }
//Set default pen and brush to QPainter //Set default pen and brush to QPainter to avoid a strange bug when
//for avoid a strange bug when the Qt theme is a "dark" theme. //the Qt theme is a "dark" theme.
//Some part of an element are gray or white instead of black. //Some parts of an element are gray or white instead of black.
//This bug seems append only when the QPainter use drawPicture method. //This bug seems append only when the QPainter uses drawPicture method.
//See bug 175. https://qelectrotech.org/bugtracker/view.php?id=175 //See bug 175. https://qelectrotech.org/bugtracker/view.php?id=175
painter->save(); painter->save();
QPen pen; QPen pen;
QBrush brush; QBrush brush;
painter->setPen(pen); painter->setPen(pen);
painter->setBrush(brush); painter->setBrush(brush);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
if (options && options -> levelOfDetail < 1.0)
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
#endif
{ {
painter->drawPicture(0, 0, m_low_zoom_picture); painter->drawPicture(0, 0, m_low_zoom_picture);
} else { } else {
painter->drawPicture(0, 0, m_picture); 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 //Draw the selection rectangle
if ( isSelected() || m_mouse_over ) { if ( isSelected() || m_mouse_over ) {
@@ -765,15 +758,10 @@ bool Element::fromXml(QDomElement &e,
QList <QDomElement> uuid_list = QET::findInDomElement(e, QList <QDomElement> uuid_list = QET::findInDomElement(e,
QStringLiteral("links_uuids"), QStringLiteral("links_uuids"),
QStringLiteral("link_uuid")); QStringLiteral("link_uuid"));
foreach (QDomElement qdo, uuid_list) foreach (QDomElement qdo, uuid_list) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove tmp_uuids_link << QUuid(qdo.attribute(QStringLiteral("uuid")));
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
//uuid of this element //uuid of this element
m_uuid = QUuid(e.attribute(QStringLiteral("uuid"), QUuid::createUuid().toString())); m_uuid = QUuid(e.attribute(QStringLiteral("uuid"), QUuid::createUuid().toString()));
+17 -17
View File
@@ -37,6 +37,7 @@ const qreal Terminal::Z = 1000;
/** /**
@brief Terminal::init @brief Terminal::init
Methode privee pour initialiser la borne. Methode privee pour initialiser la borne.
Private method to initialize the terminal.
@param number of terminal @param number of terminal
@param name of terminal @param name of terminal
@param hiddenName @param hiddenName
@@ -92,17 +93,25 @@ Terminal::~Terminal() {
est bien un Element, cette fonction renvoie l'orientation par rapport a est bien un Element, cette fonction renvoie l'orientation par rapport a
la scene de la borne, en tenant compte du fait que l'element ait pu etre la scene de la borne, en tenant compte du fait que l'element ait pu etre
pivote. Sinon elle renvoie son sens normal. pivote. Sinon elle renvoie son sens normal.
Used to find out the orientation of the terminal. If the terminal's parent
is in fact an Element, this function returns the orientation of the
terminal with respect to the scene, taking into account the angle of
rotation. scene, taking into account the fact that the element may have
been rotated. Otherwise it returns its normal direction.
@return L'orientation actuelle de la Terminal. @return L'orientation actuelle de la Terminal.
*/ */
Qet::Orientation Terminal::orientation() const Qet::Orientation Terminal::orientation() const
{ {
if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) { if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) {
// orientations actuelle et par defaut de l'element // orientations actuelle et par defaut de l'element
// current and default element orientations
int ori_cur = elt -> orientation(); int ori_cur = elt -> orientation();
if (ori_cur == 0) return(d->m_orientation); if (ori_cur == 0) return(d->m_orientation);
else { else {
// calcul l'angle de rotation implique par l'orientation de l'element parent // calcul l'angle de rotation implique par l'orientation de l'element parent
// angle de rotation de la borne sur la scene, divise par 90 // angle de rotation de la borne sur la scene, divise par 90
// calculates the angle of rotation implied by the orientation of the parent
// element angle of rotation of the terminal on the scene, divided by 90
int angle = ori_cur + d->m_orientation; int angle = ori_cur + d->m_orientation;
while (angle >= 4) angle -= 4; while (angle >= 4) angle -= 4;
return((Qet::Orientation)angle); return((Qet::Orientation)angle);
@@ -163,47 +172,38 @@ void Terminal::paint(
QWidget *) QWidget *)
{ {
// en dessous d'un certain zoom, les bornes ne sont plus dessinees // en dessous d'un certain zoom, les bornes ne sont plus dessinees
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove // below a certain zoom level, the terminals are no longer drawn
if (options && options -> levelOfDetail < 0.5) return;
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5) if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
return; return;
#endif
painter -> save(); painter -> save();
//annulation des renderhints // annulation des renderhints
// cancel renderhints
painter -> setRenderHint(QPainter::Antialiasing, false); painter -> setRenderHint(QPainter::Antialiasing, false);
painter -> setRenderHint(QPainter::TextAntialiasing, false); painter -> setRenderHint(QPainter::TextAntialiasing, false);
painter -> setRenderHint(QPainter::SmoothPixmapTransform, false); painter -> setRenderHint(QPainter::SmoothPixmapTransform, false);
// on travaille avec les coordonnees de l'element parent // on travaille avec les coordonnees de l'element parent
// work with the coordinates of the parent element
QPointF c = mapFromParent(d->m_pos); QPointF c = mapFromParent(d->m_pos);
QPointF e = mapFromParent(dock_elmt_); QPointF e = mapFromParent(dock_elmt_);
QPen t; QPen t;
t.setWidthF(1.0); t.setWidthF(1.0);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
if (options && options -> levelOfDetail < 1.0)
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0) if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
#endif
{ {
t.setCosmetic(true); t.setCosmetic(true);
} }
// dessin de la borne en rouge // dessin de la borne en rouge
// draw the terminal in red
t.setColor(Qt::red); t.setColor(Qt::red);
painter -> setPen(t); painter -> setPen(t);
painter -> drawLine(c, e); painter -> drawLine(c, e);
// dessin du point d'amarrage au conducteur en bleu // dessin du point d'amarrage au conducteur en bleu
// draw the docking point to the conductor in blue
t.setColor(m_hovered_color); t.setColor(m_hovered_color);
painter -> setPen(t); painter -> setPen(t);
painter -> setBrush(m_hovered_color); painter -> setBrush(m_hovered_color);
@@ -314,7 +314,7 @@ QLineF Terminal::HelpLine() const
QLineF line(scene_dock , QPointF()); QLineF line(scene_dock , QPointF());
//Set te second point of line to the edge of diagram, //Set the second point of line to the edge of diagram,
//according with the orientation of this terminal //according with the orientation of this terminal
switch (orientation()) switch (orientation())
{ {
@@ -645,7 +645,7 @@ QDomElement Terminal::toXml(QDomDocument &doc) const
// for backward compatibility // for backward compatibility
qdo.setAttribute("x", QString("%1").arg(dock_elmt_.x())); qdo.setAttribute("x", QString("%1").arg(dock_elmt_.x()));
qdo.setAttribute("y", QString("%1").arg(dock_elmt_.y())); qdo.setAttribute("y", QString("%1").arg(dock_elmt_.y()));
// end for backward compatibility // end for backward compatibility
qdo.setAttribute("orientation", d->m_orientation); qdo.setAttribute("orientation", d->m_orientation);
+1 -129
View File
@@ -1777,134 +1777,6 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
updateDiagramsFolioData(); 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 @brief QETProject::writeBackup
Write a backup file of this project, in the case that QET crash 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 @param template_name Name of the template
*/ */
void QETProject::usedTitleBlockTemplateChanged(const QString &template_name) { void QETProject::usedTitleBlockTemplateChanged(const QString &template_name) {
-1
View File
@@ -234,7 +234,6 @@ class QETProject : public QObject
void writeProjectPropertiesXml(QDomElement &); void writeProjectPropertiesXml(QDomElement &);
void writeDefaultPropertiesXml(QDomElement &); void writeDefaultPropertiesXml(QDomElement &);
void addDiagram(Diagram *diagram, int pos = -1); void addDiagram(Diagram *diagram, int pos = -1);
NamesList namesListForIntegrationCategory();
void writeBackup(); void writeBackup();
void init(); void init();
ProjectState openFile(QFile *file); ProjectState openFile(QFile *file);
+2 -2
View File
@@ -1083,7 +1083,7 @@ void PasteTemplateCellsCommand::redo()
} }
/** /**
@param cell Pointer to the cell impacted by te paste operation @param cell Pointer to the cell impacted by the paste operation
@param new_cell_content Content pasted to the cell @param new_cell_content Content pasted to the cell
*/ */
void PasteTemplateCellsCommand::addPastedCell(TitleBlockCell *cell, const TitleBlockCell &new_cell_content) { void PasteTemplateCellsCommand::addPastedCell(TitleBlockCell *cell, const TitleBlockCell &new_cell_content) {
@@ -1091,7 +1091,7 @@ void PasteTemplateCellsCommand::addPastedCell(TitleBlockCell *cell, const TitleB
} }
/** /**
@param cell Pointer to the cell impacted by te paste operation @param cell Pointer to the cell impacted by the paste operation
@param former_cell_content Content of the cell before the paste operation @param former_cell_content Content of the cell before the paste operation
*/ */
void PasteTemplateCellsCommand::addErasedCell(TitleBlockCell *cell, const TitleBlockCell &former_cell_content) { void PasteTemplateCellsCommand::addErasedCell(TitleBlockCell *cell, const TitleBlockCell &former_cell_content) {
@@ -71,6 +71,8 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->DiagramEditor_yKeyGrid_sb->setValue(settings.value("diagrameditor/key_Ygrid", 10).toInt()); ui->DiagramEditor_yKeyGrid_sb->setValue(settings.value("diagrameditor/key_Ygrid", 10).toInt());
ui->DiagramEditor_xKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Xgrid", 1).toInt()); ui->DiagramEditor_xKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Xgrid", 1).toInt());
ui->DiagramEditor_yKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Ygrid", 1).toInt()); ui->DiagramEditor_yKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Ygrid", 1).toInt());
ui->DiagramEditor_Grid_PointSize_min_sb->setValue(settings.value("diagrameditor/grid_pointsize_min", 1).toInt());
ui->DiagramEditor_Grid_PointSize_max_sb->setValue(settings.value("diagrameditor/grid_pointsize_max", 1).toInt());
ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool()); ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed"; bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
if(tabbed) if(tabbed)
@@ -128,7 +130,9 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
et que la liste ne sera donc pas mise a jour. et que la liste ne sera donc pas mise a jour.
*/ */
ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt()); ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt());
ui->ElementEditor_Grid_PointSize_min_sb->setValue(settings.value("elementeditor/grid_pointsize_min", 1).toInt());
ui->ElementEditor_Grid_PointSize_max_sb->setValue(settings.value("elementeditor/grid_pointsize_max", 1).toInt());
QString path = settings.value("elements-collections/common-collection-path", "default").toString(); QString path = settings.value("elements-collections/common-collection-path", "default").toString();
if (path != "default") if (path != "default")
{ {
@@ -210,6 +214,8 @@ void GeneralConfigurationPage::applyConf()
//ELEMENT EDITOR //ELEMENT EDITOR
settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText()); settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText());
settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value()); settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value());
settings.setValue("elementeditor/grid_pointsize_min", ui->ElementEditor_Grid_PointSize_min_sb->value());
settings.setValue("elementeditor/grid_pointsize_max", ui->ElementEditor_Grid_PointSize_max_sb->value());
//DIAGRAM VIEW //DIAGRAM VIEW
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked()); settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
@@ -237,6 +243,8 @@ void GeneralConfigurationPage::applyConf()
settings.setValue("diagrameditor/key_Ygrid", ui->DiagramEditor_yKeyGrid_sb->value()); settings.setValue("diagrameditor/key_Ygrid", ui->DiagramEditor_yKeyGrid_sb->value());
settings.setValue("diagrameditor/key_fine_Xgrid", ui->DiagramEditor_xKeyGridFine_sb->value()); settings.setValue("diagrameditor/key_fine_Xgrid", ui->DiagramEditor_xKeyGridFine_sb->value());
settings.setValue("diagrameditor/key_fine_Ygrid", ui->DiagramEditor_yKeyGridFine_sb->value()); settings.setValue("diagrameditor/key_fine_Ygrid", ui->DiagramEditor_yKeyGridFine_sb->value());
settings.setValue("diagrameditor/grid_pointsize_min", ui->DiagramEditor_Grid_PointSize_min_sb->value());
settings.setValue("diagrameditor/grid_pointsize_max", ui->DiagramEditor_Grid_PointSize_max_sb->value());
//Dynamic text item //Dynamic text item
settings.setValue("diagrameditor/dynamic_text_rotation", ui->m_dyn_text_rotation_sb->value()); settings.setValue("diagrameditor/dynamic_text_rotation", ui->m_dyn_text_rotation_sb->value());
settings.setValue("diagrameditor/dynamic_text_width", ui->m_dyn_text_width_sb->value()); settings.setValue("diagrameditor/dynamic_text_width", ui->m_dyn_text_width_sb->value());
@@ -529,3 +537,25 @@ void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int
ui->MaxPartsElementEditorList_sb->setStyleSheet(""); ui->MaxPartsElementEditorList_sb->setStyleSheet("");
} }
} }
/**
@brief GeneralConfigurationPage::on_DiagramEditor_Grid_PointSize_min_sb_valueChanged
the min-value of the max-SpinBox has to be limited:
may not be smaller than current value of min-SpinBox
@param value - the new value of the min-SpinBox
*/
void GeneralConfigurationPage::on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value)
{
ui->DiagramEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
}
/**
@brief GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChanged
the min-value of the max-SpinBox has to be limited:
may not be smaller than current value of min-SpinBox
@param value - the new value of the min-SpinBox
*/
void GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value)
{
ui->ElementEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
}
@@ -48,6 +48,8 @@ class GeneralConfigurationPage : public ConfigPage
void on_m_custom_tbt_path_cb_currentIndexChanged(int index); void on_m_custom_tbt_path_cb_currentIndexChanged(int index);
void on_m_indi_text_font_pb_clicked(); void on_m_indi_text_font_pb_clicked();
void on_MaxPartsElementEditorList_sb_valueChanged(int value); void on_MaxPartsElementEditorList_sb_valueChanged(int value);
void on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value);
void on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value);
private: private:
void fillLang(); void fillLang();
@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>872</width> <width>872</width>
<height>411</height> <height>471</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -17,7 +17,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
@@ -868,6 +868,134 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="title">
<string>Affichage Grille</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>555</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_18">
<property name="text">
<string>max:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="Label_Diagram_Grid_PointSize">
<property name="text">
<string>Taille des points de la grille de Diagram-Editor : 1 - 5</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QSpinBox" name="DiagramEditor_Grid_PointSize_max_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_19">
<property name="text">
<string>min:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="DiagramEditor_Grid_PointSize_min_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Taille des points de la grille de l'éditeur d'éléments : 1 - 5</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QSpinBox" name="ElementEditor_Grid_PointSize_max_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label_21">
<property name="text">
<string>max:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="ElementEditor_Grid_PointSize_min_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_22">
<property name="text">
<string>min:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_5"> <spacer name="verticalSpacer_5">
<property name="orientation"> <property name="orientation">
@@ -179,7 +179,7 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
//If a conductor was already created between these two terminals //If a conductor was already created between these two terminals
//in this undo command, from another removed element, we do nothing //in this undo command, from another removed element, we do nothing
bool exist_ = false; 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) { if (pair.first == hub_terminal && pair.second == t) {
exist_ = true; exist_ = true;
@@ -192,14 +192,8 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
if (exist_ == false) if (exist_ == false)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove m_connected_terminals.append(std::make_pair<Terminal *, Terminal *>((Terminal *)hub_terminal, (Terminal *)t));
m_connected_terminals.append(qMakePair<Terminal *, Terminal *>(hub_terminal, t)); qInfo() << "m_connected_terminals" << m_connected_terminals;
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
qDebug()<<"Help code for QT 6 or later";
#endif
Conductor *new_cond = new Conductor(hub_terminal, t); Conductor *new_cond = new Conductor(hub_terminal, t);
new_cond->setProperties(properties); new_cond->setProperties(properties);
new AddGraphicsObjectCommand(new_cond, t->diagram(), QPointF(), this); 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 <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 *, 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 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; QHash <QetGraphicsTableItem *, QPointer<QGraphicsScene>> m_table_scene_hash;
bool m_remove_linked_table = false; bool m_remove_linked_table = false;
}; };
@@ -91,7 +91,7 @@ void RotateSelectionCommand::undo()
for(const QPointer<ConductorTextItem>& cti : m_cond_text) for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{ {
cti->forceRotateByUser(m_rotate_by_user.value(cti.data())); cti->forceRotateByUser(m_rotate_by_user.value(cti.data()));
if(!cti->wasRotateByUser()) if(!cti->wasRotatedByUser())
cti->parentConductor()->calculateTextItemPosition(); cti->parentConductor()->calculateTextItemPosition();
} }
} }
@@ -106,7 +106,7 @@ void RotateSelectionCommand::redo()
for(const QPointer<ConductorTextItem>& cti : m_cond_text) for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{ {
m_rotate_by_user.insert(cti, cti->wasRotateByUser()); m_rotate_by_user.insert(cti, cti->wasRotatedByUser());
cti->forceRotateByUser(true); cti->forceRotateByUser(true);
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ m_diagram(diagram)
if(dti->type() == ConductorTextItem::Type) if(dti->type() == ConductorTextItem::Type)
{ {
ConductorTextItem *cti = static_cast<ConductorTextItem *>(dti); ConductorTextItem *cti = static_cast<ConductorTextItem *>(dti);
m_cond_texts.insert(cti, cti->wasRotateByUser()); m_cond_texts.insert(cti, cti->wasRotatedByUser());
} }
} }
for(ElementTextItemGroup *etig : dc.selectedTextsGroup()) for(ElementTextItemGroup *etig : dc.selectedTextsGroup())