mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-07 18:43:14 +02:00
Compare commits
42 Commits
qt6-cmake
...
31aaf50572
| Author | SHA1 | Date | |
|---|---|---|---|
| 31aaf50572 | |||
| 81ec28d1cf | |||
| 3bbb6385b8 | |||
| 757df90951 | |||
| eeb453f120 | |||
| 6afd9fe48d | |||
| 6eff69bc6b | |||
| c9304892e0 | |||
| 59f547b4a2 | |||
| 0084dcf289 | |||
| 0804d3524a | |||
| 2b0dd1b188 | |||
| 3c2c889922 | |||
| 27cff81ee7 | |||
| 40a7995993 | |||
| 45afd9af0e | |||
| 20b7e1763d | |||
| 9044d532ac | |||
| 50efc318e0 | |||
| e4d2dbd2a6 | |||
| ddf40854dc | |||
| ef0fa6e7ac | |||
| 237c21bad8 | |||
| 260ce2a8bc | |||
| 6199367166 | |||
| d073e810b8 | |||
| a1572be8fa | |||
| 6c52d95201 | |||
| d3463def98 | |||
| 4009e6aaab | |||
| 6ff518ec3b | |||
| 513927424f | |||
| 864a3f166f | |||
| 6111d8ca2c | |||
| e0b26592c7 | |||
| a17ceaba85 | |||
| e987d8c271 | |||
| 74e6657ca5 | |||
| e1d15f3b77 | |||
| 81f51b3d58 | |||
| a36de7de74 | |||
| 15ae8b0058 |
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+197
-159
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+201
-163
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+198
-159
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+196
-158
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
+196
-158
File diff suppressed because it is too large
Load Diff
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
+26
-5
@@ -186,7 +186,7 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
||||
p -> drawRect(r);
|
||||
|
||||
if (draw_grid_) {
|
||||
/* Draw the point of the grid
|
||||
/* Draw the points of the grid
|
||||
* if background color is black,
|
||||
* then grid spots shall be white,
|
||||
* else they shall be black in color.
|
||||
@@ -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,11 +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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1153,7 +1153,7 @@ void DiagramView::editSelection()
|
||||
QGraphicsItem *item = m_diagram->selectedItems().first();
|
||||
|
||||
//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.
|
||||
if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item))
|
||||
iti -> edit();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -478,10 +478,12 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
||||
root.appendChild(element_info);
|
||||
}
|
||||
|
||||
//complementary information about the element
|
||||
//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");
|
||||
|
||||
|
||||
@@ -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,43 @@ 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);
|
||||
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 -> 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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
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); }
|
||||
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 = 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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
en orientation. Si la chaine fait plusieurs caracteres, seul le
|
||||
premier est pris en compte. En cas d'incoherence, Qet::North est
|
||||
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
|
||||
@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).
|
||||
Indicates whether two terminal orientations are on the same axis (Vertical / Horizontal).
|
||||
@param a La premiere 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
|
||||
|
||||
+2
-2
@@ -1260,7 +1260,7 @@ QFont QETApp::diagramTextsFont(qreal size)
|
||||
}
|
||||
/**
|
||||
@brief QETApp::diagramTextsItemFont
|
||||
the font for to use in independent text item
|
||||
the font to use in independent text items
|
||||
@param size of font
|
||||
@return
|
||||
*/
|
||||
@@ -1275,7 +1275,7 @@ QFont QETApp::diagramTextsItemFont(qreal size)
|
||||
9.0).toDouble();
|
||||
auto diagram_texts_item_weight =
|
||||
static_cast<QFont::Weight>(
|
||||
settings.value("diagramitemweight").toInt());
|
||||
settings.value("diagramitemweight", QFont::Normal).toInt());
|
||||
QString diagram_texts_item_style = settings.value("diagramitemstyle",
|
||||
"normal").toString();
|
||||
|
||||
|
||||
@@ -1597,7 +1597,7 @@ void QETDiagramEditor::slot_updateUndoStack()
|
||||
|
||||
/**
|
||||
@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
|
||||
*/
|
||||
void QETDiagramEditor::slot_updateComplexActions()
|
||||
@@ -1633,7 +1633,7 @@ void QETDiagramEditor::slot_updateComplexActions()
|
||||
int selected_elements_count = dc.count(DiagramContent::Elements);
|
||||
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 deletable_items = dc.hasDeletableItems();
|
||||
m_cut -> setEnabled(!ro && copiable_items);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -384,9 +384,11 @@ void Conductor::generateConductorPath(const QPointF &p1, Qet::Orientation o1, co
|
||||
points << depart0;
|
||||
|
||||
// prolongement de la borne de depart
|
||||
// extend start terminal
|
||||
points << depart;
|
||||
|
||||
// commence le vrai trajet
|
||||
// starts the real path
|
||||
if (depart.y() < arrivee.y()) {
|
||||
// trajet descendant
|
||||
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.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 +1095,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 +1334,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 +1369,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 +2067,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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_);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -483,6 +483,12 @@ void DiagramTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
||||
|
||||
m_mouse_hover = true;
|
||||
QString str_ToolTip = toPlainText();
|
||||
|
||||
// Add movement instruction for DynamicElementTextItem
|
||||
if (inherits("DynamicElementTextItem")) {
|
||||
str_ToolTip += tr("\n<Shift> to move");
|
||||
}
|
||||
|
||||
setToolTip(str_ToolTip);
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ const qreal Terminal::Z = 1000;
|
||||
/**
|
||||
@brief Terminal::init
|
||||
Methode privee pour initialiser la borne.
|
||||
Private method to initialize the terminal.
|
||||
@param number of terminal
|
||||
@param name of terminal
|
||||
@param hiddenName
|
||||
@@ -92,17 +93,25 @@ Terminal::~Terminal() {
|
||||
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
|
||||
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.
|
||||
*/
|
||||
Qet::Orientation Terminal::orientation() const
|
||||
{
|
||||
if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) {
|
||||
// orientations actuelle et par defaut de l'element
|
||||
// current and default element orientations
|
||||
int ori_cur = elt -> orientation();
|
||||
if (ori_cur == 0) return(d->m_orientation);
|
||||
else {
|
||||
// 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
|
||||
// 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;
|
||||
while (angle >= 4) angle -= 4;
|
||||
return((Qet::Orientation)angle);
|
||||
@@ -163,47 +172,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
|
||||
// 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 +314,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())
|
||||
{
|
||||
|
||||
+1
-129
@@ -1777,134 +1777,6 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
|
||||
updateDiagramsFolioData();
|
||||
}
|
||||
|
||||
/**
|
||||
@return La liste des noms a utiliser pour la categorie dediee aux elements
|
||||
integres automatiquement dans le projet.
|
||||
*/
|
||||
NamesList QETProject::namesListForIntegrationCategory()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
NamesList names;
|
||||
const QChar russian_data[24] = {
|
||||
0x0418, 0x043C, 0x043F, 0x043E, 0x0440, 0x0442, 0x0438, 0x0440,
|
||||
0x043E, 0x0432, 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, 0x0020,
|
||||
0x044D, 0x043B, 0x0435, 0x043C, 0x0435, 0x043D, 0x0442, 0x044B};
|
||||
const QChar greek_data[18] = {
|
||||
0x0395,
|
||||
0x03b9,
|
||||
0x03c3,
|
||||
0x03b7,
|
||||
0x03b3,
|
||||
0x03bc,
|
||||
0x03ad,
|
||||
0x03bd,
|
||||
0x03b1,
|
||||
0x0020,
|
||||
0x03c3,
|
||||
0x03c4,
|
||||
0x03bf,
|
||||
0x03b9,
|
||||
0x03c7,
|
||||
0x03b5,
|
||||
0x03af,
|
||||
0x03b1};
|
||||
const QChar turkish_data[12] = {
|
||||
0x0130,
|
||||
0x0074,
|
||||
0x0068,
|
||||
0x0061,
|
||||
0x006C,
|
||||
0x0020,
|
||||
0x00F6,
|
||||
0x011F,
|
||||
0x0065,
|
||||
0x006C,
|
||||
0x0065,
|
||||
0x0072};
|
||||
const QChar ukrainian_data[20] = {
|
||||
0x0406,
|
||||
0x043c,
|
||||
0x043f,
|
||||
0x043e,
|
||||
0x0440,
|
||||
0x0442,
|
||||
0x043e,
|
||||
0x0432,
|
||||
0x0430,
|
||||
0x043d,
|
||||
0x0456,
|
||||
0x0020,
|
||||
0x0435,
|
||||
0x043b,
|
||||
0x0435,
|
||||
0x043c,
|
||||
0x0435,
|
||||
0x043d,
|
||||
0x0442,
|
||||
0x0438};
|
||||
const QChar japanese_data[10] = {
|
||||
0x30A4,
|
||||
0x30F3,
|
||||
0x30D0,
|
||||
0x30FC,
|
||||
0x30C8,
|
||||
0x3055,
|
||||
0x308C,
|
||||
0x305F,
|
||||
0x8981,
|
||||
0x7D20};
|
||||
const QChar chinese_data[4] ={
|
||||
0x5BFC,
|
||||
0x5165,
|
||||
0x5143,
|
||||
0x4EF6};
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("ru", QString(russian_data, 24));
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("el", QString(greek_data, 18));
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("tr", QString(turkish_data, 12));
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
names.addName("sv", "Importerade element");
|
||||
names.addName("ja", QString(japanese_data, 10));
|
||||
names.addName("uk", QString(ukrainian_data, 20));
|
||||
names.addName("zh", QString(chinese_data, 4));
|
||||
return (names);
|
||||
#else
|
||||
# if TODO_LIST
|
||||
# pragma message("@TODO remove code for QT 6 or later")
|
||||
# endif
|
||||
qDebug() << "Help code for QT 6 or later";
|
||||
NamesList names;
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
names.addName("uk", "Імпортовані елементи");
|
||||
return (names);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETProject::writeBackup
|
||||
Write a backup file of this project, in the case that QET crash
|
||||
@@ -2110,7 +1982,7 @@ void QETProject::removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection
|
||||
}
|
||||
|
||||
/**
|
||||
Handles the fact a digram changed the title block template it used
|
||||
Handles the fact that a diagram changed the title block template it uses
|
||||
@param template_name Name of the template
|
||||
*/
|
||||
void QETProject::usedTitleBlockTemplateChanged(const QString &template_name) {
|
||||
|
||||
@@ -234,7 +234,6 @@ class QETProject : public QObject
|
||||
void writeProjectPropertiesXml(QDomElement &);
|
||||
void writeDefaultPropertiesXml(QDomElement &);
|
||||
void addDiagram(Diagram *diagram, int pos = -1);
|
||||
NamesList namesListForIntegrationCategory();
|
||||
void writeBackup();
|
||||
void init();
|
||||
ProjectState openFile(QFile *file);
|
||||
|
||||
@@ -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,6 +130,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user