Compare commits

...

37 Commits

Author SHA1 Message Date
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
67 changed files with 5964 additions and 4941 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.
+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.
+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;
Keywords=Graphics;Science;Electricity;Engineering;
Comment=Edit electrical diagrams.
Comment[de]=Elektroschaltpläne erstellen und bearbeiten.
Comment[fr]=Éditer des schémas électriques.
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[ca]=Editar esquemes elèctrics.
Comment[cs]=Editor výkresů elektrických obvodů
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[nl]=Bewerken bedradingsdiagrammen.
Comment[pl]=Edycja schematów elektrycznych
Comment[pt]=Criar esquemas eléctricos.
Comment[ru]=Создание и редактирование электрических схем.
Comment[sk]=Úprava elektrických schém.
GenericName=Electrical diagram editor
GenericName[de]=Schaltplaneditor
GenericName[fr]=Éditeur de schémas électriques
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[cs]=Editor výkresů elektrických obvodů
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[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
@@ -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));
}
+3 -10
View File
@@ -941,19 +941,12 @@ QString BorderTitleBlock::incrementLetters(const QString &string) {
} else {
// separate previous digits from last digit
// separe les digits precedents du dernier digit
QString first_digits(string.left(string.count() - 1));
QChar last_digit(string.at(string.count() - 1));
QString first_digits(string.left(string.length() - 1));
char last_digit(string.at(string.length() - 1).unicode());
if (last_digit != 'Z') {
// increments the last digit
// incremente le dernier digit
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
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
last_digit = (char)(string[string.length()-1].unicode()) + 1;
return(first_digits + QString(last_digit));
} else {
return(incrementLetters(first_digits) + "A");
+25 -5
View File
@@ -213,8 +213,8 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
.insideBorderRect()
.intersected(r);
qreal limite_x = rect.x() + rect.width();
qreal limite_y = rect.y() + rect.height();
qreal limit_x = rect.x() + rect.width();
qreal limit_y = rect.y() + rect.height();
int g_x = (int)ceil(rect.x());
while (g_x % xGrid) ++ g_x;
@@ -222,12 +222,32 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
while (g_y % yGrid) ++ g_y;
QPolygon points;
for (int gx = g_x ; gx < limite_x ; gx += xGrid) {
for (int gy = g_y ; gy < limite_y ; gy += yGrid) {
for (int gx = g_x ; gx < limit_x ; gx += xGrid) {
for (int gy = g_y ; gy < limit_y ; gy += yGrid) {
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);
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);
@@ -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);
}
+6 -4
View File
@@ -478,10 +478,12 @@ const QDomDocument ElementScene::toXml(bool all_parts)
root.appendChild(element_info);
}
//complementary information about the element
QDomElement informations_element = xml_document.createElement("informations");
root.appendChild(informations_element);
informations_element.appendChild(xml_document.createTextNode(m_element_data.m_drawing_information.trimmed()));
//complementary information about the element, when available
if (!(m_element_data.m_drawing_information.trimmed().isEmpty())) {
QDomElement informations_element = xml_document.createElement("informations");
root.appendChild(informations_element);
informations_element.appendChild(xml_document.createTextNode(m_element_data.m_drawing_information.trimmed()));
}
QDomElement description = xml_document.createElement("description");
+30 -8
View File
@@ -480,6 +480,7 @@ bool ElementView::event(QEvent *e) {
/**
Utilise le pincement du trackpad pour zoomer
Use trackpad pinch to zoom
@brief ElementView::gestureEvent
@param event
@return
@@ -502,6 +503,7 @@ bool ElementView::gestureEvent(QGestureEvent *event){
/**
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 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);
// dessine un fond blanc
// draw a white background
p -> setPen(Qt::NoPen);
p -> setBrush(Qt::white);
p -> drawRect(r);
// determine le zoom en cours
// determine the zoom-level
qreal zoom_factor = transform().m11();
// 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_y_grid = 1;//scene_ -> yGrid();
bool draw_grid = true;
bool draw_cross = false;
if (zoom_factor < (4.0/3.0)) { //< no grid
if (zoom_factor < 1.0) { //< no grid
draw_grid = false;
} else if (zoom_factor < 4.0) { //< grid 10*10
drawn_x_grid *= 10;
@@ -547,25 +552,42 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
m_scene->setGrid(drawn_x_grid, drawn_y_grid);
if (draw_grid) {
// draw the dot of the grid
// draw the dots of the grid
QPen pen(Qt::black);
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);
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 -> setBrush(Qt::NoBrush);
qreal limite_x = r.x() + r.width();
qreal limite_y = r.y() + r.height();
qreal limit_x = r.x() + r.width();
qreal limit_y = r.y() + r.height();
int g_x = (int)ceil(r.x());
while (g_x % drawn_x_grid) ++ g_x;
int g_y = (int)ceil(r.y());
while (g_y % drawn_y_grid) ++ g_y;
for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) {
for (int gy = g_y ; gy < limite_y ; gy += drawn_y_grid) {
for (int gx = g_x ; gx < limit_x ; gx += drawn_x_grid) {
for (int gy = g_y ; gy < limit_y ; gy += drawn_y_grid) {
if (draw_cross) {
if (!(gx % 10) && !(gy % 10)) {
p -> drawLine(QLineF(gx - 0.25, gy, gx + 0.25, gy));
p -> drawLine(QLineF(gx, gy - 0.25, gx, gy + 0.25));
p -> drawLine(QLineF(gx - (pen.width()/4.0), gy, gx + (pen.width()/4.0), gy));
p -> drawLine(QLineF(gx, gy - (pen.width()/4.0), gx, gy + (pen.width()/4.0)));
} else {
p -> drawPoint(gx, gy);
}
+25 -28
View File
@@ -61,14 +61,7 @@ void PartArc::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
//Always remove the brush
painter -> setBrush(Qt::NoBrush);
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
painter -> setPen(t);
if (isSelected())
@@ -175,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();
@@ -209,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();
@@ -221,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();
+18 -21
View File
@@ -57,14 +57,7 @@ void PartEllipse::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
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);
@@ -241,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();
@@ -264,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();
+18 -13
View File
@@ -81,14 +81,7 @@ void PartLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
QPen t = painter -> pen();
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);
#endif
if (isSelected()) t.setColor(Qt::red);
painter -> setPen(t);
@@ -581,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();
@@ -594,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();
@@ -603,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();
+10 -9
View File
@@ -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();
+21 -31
View File
@@ -54,14 +54,7 @@ void PartRectangle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
Q_UNUSED(widget);
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);
@@ -170,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();
@@ -198,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();
@@ -212,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();
+22 -26
View File
@@ -84,18 +84,8 @@ void PartTerminal::paint(
QPen t;
t.setWidthF(1.0);
#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
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
// dessin de la borne en rouge
t.setColor(isSelected() ? Terminal::neutralColor : Qt::red);
painter -> setPen(t);
@@ -168,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;
@@ -195,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;
@@ -212,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);
+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()
{
+2 -2
View File
@@ -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
}
+18 -25
View File
@@ -519,15 +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 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)
#endif
//Use a cosmetic line, below a certain zoom
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
{
final_conductor_pen.setCosmetic(true);
}
@@ -1100,7 +1093,7 @@ QDomElement Conductor::toXml(QDomDocument &dom_document,
dom_element.setAttribute("userx", QString::number(m_text_item->pos().x()));
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()));
return(dom_element);
@@ -1339,17 +1332,17 @@ void Conductor::calculateTextItemPosition()
relatedPotentialConductors(false).size() > 0)
{
Conductor *longuest_conductor = longuestConductorInPotential(this);
Conductor *longest_conductor = longestConductorInPotential(this);
//The longuest conductor isn't this conductor
//we call calculateTextItemPosition of the longuest conductor
if(longuest_conductor != this)
//The longest conductor isn't this conductor
//we call calculateTextItemPosition of the longest conductor
if(longest_conductor != this)
{
longuest_conductor -> calculateTextItemPosition();
longest_conductor -> calculateTextItemPosition();
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)) {
c -> textItem() -> setVisible(false);
}
@@ -1374,7 +1367,7 @@ void Conductor::calculateTextItemPosition()
Qt::Orientations 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):
m_text_item -> setRotation(m_properties.horiz_rotate_text);
@@ -2072,19 +2065,19 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
}
/**
@brief longuestConductorInPotential
@brief longestConductorInPotential
@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
@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 *longuest_conductor = conductor;
//Search the longuest conductor
Conductor * longestConductorInPotential(Conductor *conductor, bool all_diagram) {
Conductor *longest_conductor = conductor;
//Search the longest conductor
foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram))
if (c -> length() > longuest_conductor -> length())
longuest_conductor = c;
if (c -> length() > longest_conductor -> length())
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 &);
};
Conductor * longuestConductorInPotential (Conductor *conductor, bool all_diagram = false);
Conductor * longestConductorInPotential (Conductor *conductor, bool all_diagram = false);
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
*/
bool ConductorTextItem::wasRotateByUser() const
bool ConductorTextItem::wasRotatedByUser() const
{
return(rotate_by_user_);
}
+1 -1
View File
@@ -44,7 +44,7 @@ class ConductorTextItem : public DiagramTextItem
void fromXml(const QDomElement &) override;
int type() const override { return Type; }
virtual bool wasMovedByUser() const;
virtual bool wasRotateByUser() const;
virtual bool wasRotatedByUser() const;
virtual void forceMovedByUser(bool);
virtual void forceRotateByUser(bool);
virtual void setPos(const QPointF &pos);
+7 -1
View File
@@ -483,7 +483,13 @@ void DiagramTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
m_mouse_hover = true;
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();
}
+10 -22
View File
@@ -215,31 +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 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)
#endif
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 ) {
@@ -765,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()));
+8 -17
View File
@@ -163,47 +163,38 @@ void Terminal::paint(
QWidget *)
{
// en dessous d'un certain zoom, les bornes ne sont plus dessinees
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
if (options && options -> levelOfDetail < 0.5) return;
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
// below a certain zoom level, the terminals are no longer drawn
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
return;
#endif
painter -> save();
//annulation des renderhints
// annulation des renderhints
// cancel renderhints
painter -> setRenderHint(QPainter::Antialiasing, false);
painter -> setRenderHint(QPainter::TextAntialiasing, false);
painter -> setRenderHint(QPainter::SmoothPixmapTransform, false);
// on travaille avec les coordonnees de l'element parent
// work with the coordinates of the parent element
QPointF c = mapFromParent(d->m_pos);
QPointF e = mapFromParent(dock_elmt_);
QPen t;
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)
#endif
{
t.setCosmetic(true);
}
// dessin de la borne en rouge
// draw the terminal in red
t.setColor(Qt::red);
painter -> setPen(t);
painter -> drawLine(c, e);
// dessin du point d'amarrage au conducteur en bleu
// draw the docking point to the conductor in blue
t.setColor(m_hovered_color);
painter -> setPen(t);
painter -> setBrush(m_hovered_color);
@@ -314,7 +305,7 @@ QLineF Terminal::HelpLine() const
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
switch (orientation())
{
@@ -645,7 +636,7 @@ QDomElement Terminal::toXml(QDomDocument &doc) const
// for backward compatibility
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
qdo.setAttribute("orientation", d->m_orientation);
+1 -129
View File
@@ -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) {
-1
View File
@@ -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);
+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
*/
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
*/
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_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_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());
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
if(tabbed)
@@ -128,7 +130,9 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
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->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();
if (path != "default")
{
@@ -210,6 +214,8 @@ void GeneralConfigurationPage::applyConf()
//ELEMENT EDITOR
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/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
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_fine_Xgrid", ui->DiagramEditor_xKeyGridFine_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
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());
@@ -529,3 +537,25 @@ void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int
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_indi_text_font_pb_clicked();
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:
void fillLang();
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>872</width>
<height>411</height>
<height>471</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>5</number>
</property>
<widget class="QWidget" name="tab_3">
<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>
</widget>
</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>
<spacer name="verticalSpacer_5">
<property name="orientation">
@@ -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;
};
@@ -91,7 +91,7 @@ void RotateSelectionCommand::undo()
for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{
cti->forceRotateByUser(m_rotate_by_user.value(cti.data()));
if(!cti->wasRotateByUser())
if(!cti->wasRotatedByUser())
cti->parentConductor()->calculateTextItemPosition();
}
}
@@ -106,7 +106,7 @@ void RotateSelectionCommand::redo()
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);
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ m_diagram(diagram)
if(dti->type() == ConductorTextItem::Type)
{
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())