From 45fb97f41058bd51001fd7bf13307df985a2c8b8 Mon Sep 17 00:00:00 2001 From: David Varley Date: Thu, 10 Sep 2020 00:16:03 +1000 Subject: [PATCH 01/34] Start cborn branch - disable annoying startup warning --- sources/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/main.cpp b/sources/main.cpp index b575d7cba..04b110c3d 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -206,7 +206,7 @@ int main(int argc, char **argv) my_ma->send_info_to_debug(); delete my_ma; } - +#if 0 // So Annoying! (Perhaps make it once only, or once a day/week? if(! QET::FileFormatStable){ QMessageBox::StandardButton btn = QMessageBox::critical( nullptr, @@ -233,6 +233,7 @@ int main(int argc, char **argv) if (!(btn == QMessageBox::Yes)) return 1; } +#endif return app.exec(); } From 07df62e3623ff764b275e3080c2afa2bf39cf36b Mon Sep 17 00:00:00 2001 From: David Varley Date: Mon, 14 Sep 2020 12:29:36 +1000 Subject: [PATCH 02/34] DXF - Fix single shape rectangle scaling --- sources/createdxf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 98fdd63dd..56d18dbd8 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -675,7 +675,8 @@ void Createdxf::drawRectangle( const QString &filepath, const QRectF &rect, const int &colorcode) { - QPolygonF poly(scaleRect(rect)); + //QPolygonF poly(scaleRect(rect)); + QPolygonF poly(rect); drawPolyline(filepath,poly,colorcode); } From 4d7ece07abc32a2beb806a65e1d816190b399aba Mon Sep 17 00:00:00 2001 From: David Varley Date: Thu, 17 Sep 2020 21:45:14 +1000 Subject: [PATCH 03/34] DXF - Simplifying, WIP --- sources/createdxf.cpp | 22 +++++++++- sources/createdxf.h | 7 ++++ sources/exportdialog.cpp | 86 +++++++++------------------------------- 3 files changed, 46 insertions(+), 69 deletions(-) diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 56d18dbd8..7a63e19d2 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -255,6 +255,26 @@ void Createdxf::dxfEnd(const QString& fileName) } } +/** + @brief Createdxf::drawCircle + draw circle in qt format + @param fileName + @param center + @param radius + @param colour +*/ +void Createdxf::drawCircle( + const QString& fileName, + QPointF centre, + double radius, + int colour) +{ + qreal x = centre.x() * xScale; + qreal y = sheetHeight - centre.y() * yScale; + qreal r = radius * xScale; + drawCircle(fileName,r,x,y,colour); +} + /** @brief Createdxf::drawCircle draw circle in dxf format @@ -447,7 +467,7 @@ int Createdxf::dxfColor(QPen pen) { /** @brief Createdxf::drawLine - Conveniance function to draw line + Convenience function to draw line @param filepath @param line @param colorcode diff --git a/sources/createdxf.h b/sources/createdxf.h index 198c2892d..14b64807f 100644 --- a/sources/createdxf.h +++ b/sources/createdxf.h @@ -39,6 +39,13 @@ class Createdxf double, double, int); + + static void drawCircle( + const QString& , + QPointF, + double, + int ); + static void drawArc( const QString&, double x, diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 67d908aa3..1393aa87d 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -443,18 +443,10 @@ void ExportDialog::generateDxf( //Add project elements (lines, rectangles, circles, texts) to dxf file if (epw -> exportProperties().draw_border) { - double bx0 = Diagram::margin * Createdxf::xScale; - double by0 = Diagram::margin * Createdxf::yScale; - Createdxf::drawRectangle( - file_path, - bx0, - -by0, - double(width)*Createdxf::xScale, - double(height)*Createdxf::yScale, - 0); + QRectF rect(Diagram::margin,Diagram::margin,width,height); + Createdxf::drawRectangle(file_path,rect,0); } - diagram -> border_and_titleblock.drawDxf(file_path, - 0); + diagram -> border_and_titleblock.drawDxf(file_path, 0); // Build the lists of elements. QList list_elements; @@ -542,71 +534,32 @@ void ExportDialog::generateDxf( for (QLineF line : primitives.m_lines) { - qreal x1 = (elem_pos_x + line.p1().x()) * Createdxf::xScale; - qreal y1 = Createdxf::sheetHeight - (elem_pos_y + line.p1().y()) * Createdxf::yScale; - QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle); - x1 = transformed_point.x(); - y1 = transformed_point.y(); - qreal x2 = (elem_pos_x + line.p2().x()) * Createdxf::xScale; - qreal y2 = Createdxf::sheetHeight - (elem_pos_y + line.p2().y()) * Createdxf::yScale; - transformed_point = rotation_transformed(x2, y2, hotspot_x, hotspot_y, rotation_angle); - x2 = transformed_point.x(); - y2 = transformed_point.y(); - Createdxf::drawLine(file_path, x1, y1, x2, y2, 0); + QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); + QLineF l = t.map(line); + Createdxf::drawLine(file_path, l, 0); } for (QRectF rect : primitives.m_rectangles) { - qreal x1 = (elem_pos_x + rect.bottomLeft().x()) * Createdxf::xScale; - qreal y1 = Createdxf::sheetHeight - (elem_pos_y + rect.bottomLeft().y()) * Createdxf::yScale; - qreal w = rect.width() * Createdxf::xScale; - qreal h = rect.height() * Createdxf::yScale; - // opposite corner - qreal x2 = x1 + w; - qreal y2 = y1 + h; - QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle); - x1 = transformed_point.x(); - y1 = transformed_point.y(); - transformed_point = rotation_transformed(x2, y2, hotspot_x, hotspot_y, rotation_angle); - x2 = transformed_point.x(); - y2 = transformed_point.y(); - qreal bottom_left_x = (x1 < x2) ? x1 : x2; - qreal bottom_left_y = (y1 < y2) ? y1 : y2; - w = (x1 < x2) ? x2-x1 : x1-x2; - h = (y1 < y2) ? y2-y1 : y1-y2; - Createdxf::drawRectangle(file_path, bottom_left_x, bottom_left_y, w, h, 0); + QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); + QRectF r = t.mapRect(rect); + Createdxf::drawRectangle(file_path,r,0); } for (QRectF circle_rect : primitives.m_circles) { - qreal x1 = (elem_pos_x + circle_rect.center().x()) * Createdxf::xScale; - qreal y1 = Createdxf::sheetHeight - (elem_pos_y + circle_rect.center().y()) * Createdxf::yScale; - qreal r = circle_rect.width() * Createdxf::xScale / 2; - QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle); - x1 = transformed_point.x(); - y1 = transformed_point.y(); - Createdxf::drawCircle(file_path, r, x1, y1, 0); + QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); + QPointF c = t.map(QPointF(circle_rect.center().x(),circle_rect.center().y())); + Createdxf::drawCircle(file_path,c,circle_rect.width()/2,0); } for (QVector polygon : primitives.m_polygons) { if (polygon.size() == 0) continue; - qreal x1 = (elem_pos_x + polygon.at(0).x()) * Createdxf::xScale; - qreal y1 = Createdxf::sheetHeight - (elem_pos_y + polygon.at(0).y()) * Createdxf::yScale; - QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle); - x1 = transformed_point.x(); - y1 = transformed_point.y(); - for (int i = 1; i < polygon.size(); ++i ) { - qreal x2 = (elem_pos_x + polygon.at(i).x()) * Createdxf::xScale; - qreal y2 = Createdxf::sheetHeight - (elem_pos_y + polygon.at(i).y()) * Createdxf::yScale; - QPointF transformed_point = rotation_transformed(x2, y2, hotspot_x, hotspot_y, rotation_angle); - x2 = transformed_point.x(); - y2 = transformed_point.y(); - Createdxf::drawLine(file_path, x1, y1, x2, y2, 0); - x1 = x2; - y1 = y2; - } + QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); + QPolygonF poly = t.map(polygon); + Createdxf::drawPolygon(file_path,poly,0); } // Draw arcs and ellipses @@ -626,13 +579,10 @@ void ExportDialog::generateDxf( // Draw terminals QList list_terminals = elmt->terminals(); QColor col("red"); + QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); foreach(Terminal *tp, list_terminals) { - qreal x = (elem_pos_x + tp->dock_elmt_.x()) * Createdxf::xScale; - qreal y = Createdxf::sheetHeight - (elem_pos_y + tp->dock_elmt_.y()) * Createdxf::yScale; - QPointF transformed_point = rotation_transformed(x, y, hotspot_x, hotspot_y, rotation_angle); - x = transformed_point.x(); - y = transformed_point.y(); - Createdxf::drawCircle(file_path, 3.0* Createdxf::xScale, x, y, Createdxf::dxfColor(col)); + QPointF c = t.map(QPointF(tp->dock_elmt_.x(),tp->dock_elmt_.y())); + Createdxf::drawCircle(file_path,c,3.0,Createdxf::dxfColor(col)); } } } From 215ddbd87838cd2b62e8399a264ea8b60769ed49 Mon Sep 17 00:00:00 2001 From: Claveau Joshua Date: Fri, 18 Sep 2020 11:48:11 +0200 Subject: [PATCH 04/34] Minor : minimize code --- sources/factory/propertieseditorfactory.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sources/factory/propertieseditorfactory.cpp b/sources/factory/propertieseditorfactory.cpp index d14a7ea4a..d01407f79 100644 --- a/sources/factory/propertieseditorfactory.cpp +++ b/sources/factory/propertieseditorfactory.cpp @@ -77,26 +77,21 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor( PropertiesEditorWidget *editor, QWidget *parent) { - int count_ = items.size(); + const int count_ = items.size(); + if (count_ == 0) { + return nullptr; + } + QGraphicsItem *item = items.first(); + const int type_ = item->type(); //The editor widget can only edit one item //or several items of the same type - if (count_ != 1) - { - if (count_ == 0) { + for (auto qgi : items) { + if (qgi->type() != type_) { return nullptr; } - - int type_ = items.first()->type(); - for (QGraphicsItem *qgi : items) { - if (qgi->type() != type_) { - return nullptr; - } - } } - QGraphicsItem *item = items.first(); - const int type_ = item->type(); QString class_name; if (editor) { class_name = editor->metaObject()->className(); From c7f138a0e3f7e2f1711076d2e0e84da7fa8fefae Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:01:19 +0200 Subject: [PATCH 05/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/ui/diagramcontextwidget.cpp | 38 +++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/sources/ui/diagramcontextwidget.cpp b/sources/ui/diagramcontextwidget.cpp index 88bf8621a..222f5b514 100644 --- a/sources/ui/diagramcontextwidget.cpp +++ b/sources/ui/diagramcontextwidget.cpp @@ -1,23 +1,25 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #include "diagramcontextwidget.h" #include "ui_diagramcontextwidget.h" +#include + DiagramContextWidget::DiagramContextWidget(QWidget *parent) : QWidget(parent), ui(new Ui::DiagramContextWidget) @@ -38,7 +40,7 @@ DiagramContextWidget::~DiagramContextWidget() DiagramContext DiagramContextWidget::context() const { DiagramContext context; - + for (int i = 0 ; i < ui->m_table-> rowCount() ; ++ i) { QTableWidgetItem *qtwi_name = ui->m_table-> item(i, 0); @@ -46,16 +48,16 @@ DiagramContext DiagramContextWidget::context() const if (!qtwi_name || !qtwi_value) { continue; } - + QString key = qtwi_name -> text(); if (key.isEmpty()) { continue; } - + QString value = qtwi_value -> text(); context.addValue(key, value); } - + return(context); } @@ -67,7 +69,7 @@ DiagramContext DiagramContextWidget::context() const void DiagramContextWidget::setContext (const DiagramContext &context) { clear(); - + int i = 0; for (QString key : context.keys(DiagramContext::Alphabetical)) { @@ -75,7 +77,7 @@ void DiagramContextWidget::setContext (const DiagramContext &context) ui->m_table->setItem(i, 1, new QTableWidgetItem(context[key].toString())); ++ i; } - + checkTableRows(); } @@ -93,7 +95,7 @@ int DiagramContextWidget::nameLessRowsCount() const ++ name_less_rows_count; } } - + return(name_less_rows_count); } @@ -107,7 +109,7 @@ void DiagramContextWidget::clear() for (int i = 1 ; i < ui->m_table->rowCount() ; ++ i) { ui->m_table->removeRow(i); } - + refreshFormatLabel(); } @@ -118,10 +120,10 @@ void DiagramContextWidget::clear() */ int DiagramContextWidget::highlightNonAcceptableKeys() { - static QRegExp re(DiagramContext::validKeyRegExp()); - + static QRegularExpression re(DiagramContext::validKeyRegExp()); + QBrush fg_brush = ui->m_table->palette().brush(QPalette::WindowText); - + int invalid_keys = 0; for (int i = 0 ; i < ui->m_table->rowCount() ; ++ i) { @@ -129,11 +131,11 @@ int DiagramContextWidget::highlightNonAcceptableKeys() if (!qtwi_name) { continue; } - + bool highlight = false; if (!qtwi_name -> text().isEmpty()) { - if (!re.exactMatch(qtwi_name -> text())) + if (re!=QRegularExpression(qtwi_name -> text())) { highlight = true; ++ invalid_keys; @@ -141,7 +143,7 @@ int DiagramContextWidget::highlightNonAcceptableKeys() } qtwi_name -> setForeground(highlight ? Qt::red : fg_brush); } - + return(invalid_keys); } @@ -156,7 +158,7 @@ void DiagramContextWidget::refreshFormatLabel() "Les noms ne peuvent contenir que des lettres minuscules, des " "chiffres et des tirets." ); - + if (highlightNonAcceptableKeys()) { format_text = QString("%1").arg(format_text); } From 0a46b83dca7c4f26064a9b0101b9eeeddddaf4e3 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:01:38 +0200 Subject: [PATCH 06/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- .../ElementsCollection/elementslocation.cpp | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index cd09896e4..02822a100 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -144,9 +144,9 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const */ QString ElementsLocation::baseName() const { - QRegExp regexp("^.*([^/]+)\\.elmt$"); - if (regexp.exactMatch(m_collection_path)) { - return(regexp.capturedTexts().at(1)); + QRegularExpression regexp("^.*([^/]+)\\.elmt$"); + if (regexp==QRegularExpression(m_collection_path)) { + return(regexp.namedCaptureGroups().at(1)); } return(QString()); } @@ -241,17 +241,19 @@ void ElementsLocation::setPath(const QString &path) //The path start with project, we get the project and the path from the string else if (tmp_path.startsWith("project")) { - QRegExp rx("^project([0-9]+)\\+(embed:\\/\\/.*)$", Qt::CaseInsensitive); - if (rx.exactMatch(tmp_path)) + QRegularExpression rx + ("^project([0-9]+)\\+(embed:\\/\\/.*)$", + QRegularExpression::CaseInsensitiveOption); + if (rx==QRegularExpression(tmp_path)) { bool conv_ok; - uint project_id = rx.capturedTexts().at(1).toUInt(&conv_ok); + uint project_id = rx.namedCaptureGroups().at(1).toUInt(&conv_ok); if (conv_ok) { QETProject *project = QETApp::project(project_id); if (project) { - m_collection_path = rx.capturedTexts().at(2); + m_collection_path = rx.namedCaptureGroups().at(2); m_project = project; } } @@ -351,11 +353,11 @@ bool ElementsLocation::addToPath(const QString &string) ElementsLocation ElementsLocation::parent() const { ElementsLocation copy(*this); - QRegExp re1("^([a-z]+://)(.*)/*$"); - if (re1.exactMatch(m_collection_path)) { - QString path_proto = re1.capturedTexts().at(1); - QString path_path = re1.capturedTexts().at(2); - QString parent_path = path_path.remove(QRegExp("/*[^/]+$")); + QRegularExpression re1("^([a-z]+://)(.*)/*$"); + if (re1==QRegularExpression(m_collection_path)) { + QString path_proto = re1.namedCaptureGroups().at(1); + QString path_path = re1.namedCaptureGroups().at(2); + QString parent_path = path_path.remove(QRegularExpression("/*[^/]+$")); copy.setPath(path_proto + parent_path); } return(copy); @@ -718,14 +720,14 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const else { QString path_ = collectionPath(false); - QRegExp rx ("^(.*)/(.*\\.elmt)$"); + QRegularExpression rx ("^(.*)/(.*\\.elmt)$"); - if (rx.exactMatch(path_)) { + if (rx==QRegularExpression(path_)) { return project() ->embeddedElementCollection() ->addElementDefinition( - rx.cap(1), - rx.cap(2), + rx.namedCaptureGroups().at(1), + rx.namedCaptureGroups().at(2), xml_document .documentElement()); } From c5be1a98ba4c82495ef5b542833657b9ae8bb164 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:01:51 +0200 Subject: [PATCH 07/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/autoNum/numerotationcontext.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/autoNum/numerotationcontext.cpp b/sources/autoNum/numerotationcontext.cpp index 1f932e9fa..a94fe7ec9 100644 --- a/sources/autoNum/numerotationcontext.cpp +++ b/sources/autoNum/numerotationcontext.cpp @@ -16,9 +16,10 @@ along with QElectroTech. If not, see . */ #include "numerotationcontext.h" +#include "qet.h" #include -#include "qet.h" +#include /** Constructor @@ -141,7 +142,7 @@ QString NumerotationContext::validRegExpNumber() const */ bool NumerotationContext::keyIsAcceptable(const QString &type) const { - return (type.contains(QRegExp(validRegExpNum()))); + return (type.contains(QRegularExpression(validRegExpNum()))); } /** @@ -150,7 +151,7 @@ bool NumerotationContext::keyIsAcceptable(const QString &type) const */ bool NumerotationContext::keyIsNumber(const QString &type) const { - return (type.contains(QRegExp(validRegExpNumber()))); + return (type.contains(QRegularExpression(validRegExpNumber()))); } /** From 271fd096e2596a5c9023c76f4560a6edf16ac8c0 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:02:20 +0200 Subject: [PATCH 08/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/autoNum/ui/numparteditorw.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sources/autoNum/ui/numparteditorw.cpp b/sources/autoNum/ui/numparteditorw.cpp index 7e4e3ae80..2ab28f366 100644 --- a/sources/autoNum/ui/numparteditorw.cpp +++ b/sources/autoNum/ui/numparteditorw.cpp @@ -1,21 +1,20 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ -#include #include "numparteditorw.h" #include "ui_numparteditorw.h" From 402d2fbf4a081d6e4ab3dc3baffa1f00e8d21ced Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:05:42 +0200 Subject: [PATCH 09/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/qetregexpvalidator.cpp | 24 ++++++++++++++++-------- sources/qetregexpvalidator.h | 22 +++++++++++----------- sources/qfilenameedit.cpp | 14 +++++++------- sources/qfilenameedit.h | 20 ++++++++++---------- 4 files changed, 44 insertions(+), 36 deletions(-) diff --git a/sources/qetregexpvalidator.cpp b/sources/qetregexpvalidator.cpp index d6c01b3fb..e4f409b3f 100644 --- a/sources/qetregexpvalidator.cpp +++ b/sources/qetregexpvalidator.cpp @@ -1,27 +1,30 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #include "qetregexpvalidator.h" +#include /** Constructeur @param parent QObject parent */ -QETRegExpValidator::QETRegExpValidator(QObject *parent) : QRegExpValidator(parent) { +QETRegExpValidator::QETRegExpValidator(QObject *parent) + : QRegularExpressionValidator(parent) +{ } /** @@ -29,7 +32,10 @@ QETRegExpValidator::QETRegExpValidator(QObject *parent) : QRegExpValidator(paren @param regexp Expression reguliere a valider @param parent QObject parent */ -QETRegExpValidator::QETRegExpValidator(const QRegExp ®exp, QObject *parent) : QRegExpValidator(regexp, parent) { +QETRegExpValidator::QETRegExpValidator( + const QRegularExpression ®exp, QObject *parent) : + QRegularExpressionValidator(regexp, parent) +{ } /** @@ -40,13 +46,15 @@ QETRegExpValidator::~QETRegExpValidator() } /** - @see QRegExpValidator::validate + @see QRegularExpressionValidator::validate @see validationFailed() Emet le signal validationFailed si la validation echoue */ QValidator::State QETRegExpValidator::validate(QString &input, int &pos) const { - QValidator::State result = QRegExpValidator::validate(input, pos); - if (result == QValidator::Invalid) emit(validationFailed()); + QValidator::State result = QRegularExpressionValidator::validate( + input, pos); + if (result == QValidator::Invalid) + emit(validationFailed()); return(result); } diff --git a/sources/qetregexpvalidator.h b/sources/qetregexpvalidator.h index d11981ff4..4224112b1 100644 --- a/sources/qetregexpvalidator.h +++ b/sources/qetregexpvalidator.h @@ -1,42 +1,42 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #ifndef QET_REGEXP_VALIDATOR_H #define QET_REGEXP_VALIDATOR_H -#include +#include /** - This class acts like a QRegExpValidator except it emits a signal when the - input validation fails. + This class acts like a QRegularExpressionValidator + except it emits a signal when the input validation fails. */ -class QETRegExpValidator : public QRegExpValidator { +class QETRegExpValidator : public QRegularExpressionValidator { Q_OBJECT - + // constructors, destructor public: QETRegExpValidator(QObject *); - QETRegExpValidator(const QRegExp &, QObject *); + QETRegExpValidator(const QRegularExpression &, QObject *); ~QETRegExpValidator() override; private: QETRegExpValidator(const QETRegExpValidator &); - + // methods public: QValidator::State validate(QString &, int &) const override; - + signals: void validationFailed() const; }; diff --git a/sources/qfilenameedit.cpp b/sources/qfilenameedit.cpp index 918329713..2999ba829 100644 --- a/sources/qfilenameedit.cpp +++ b/sources/qfilenameedit.cpp @@ -1,24 +1,24 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #include "qfilenameedit.h" #include "qetregexpvalidator.h" #include -#include +#include #include /** @@ -36,7 +36,7 @@ QFileNameEdit::QFileNameEdit(QWidget *parent) : QLineEdit(parent) { */ QFileNameEdit::QFileNameEdit(const QString &contents, QWidget *parent) : QLineEdit(parent) { init(); - if (!contents.isEmpty() && regexp_.exactMatch(contents)) { + if (!contents.isEmpty() && regexp_==QRegularExpression(contents)) { setText(contents); } } @@ -61,7 +61,7 @@ bool QFileNameEdit::isEmpty() */ bool QFileNameEdit::isValid() { - return(regexp_.exactMatch(text())); + return(regexp_==QRegularExpression(text())); } /** @@ -69,7 +69,7 @@ bool QFileNameEdit::isValid() */ void QFileNameEdit::init() { - regexp_ = QRegExp("^[0-9a-z_\\-\\.]+$", Qt::CaseSensitive); + regexp_ = QRegularExpression("^[0-9a-z_\\-\\.]+$"); validator_ = new QETRegExpValidator(regexp_, this); setValidator(validator_); tooltip_text_ = QString( diff --git a/sources/qfilenameedit.h b/sources/qfilenameedit.h index 5d5ca8fc2..c688e1a8b 100644 --- a/sources/qfilenameedit.h +++ b/sources/qfilenameedit.h @@ -1,25 +1,25 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #ifndef Q_FILENAME_EDIT_H #define Q_FILENAME_EDIT_H #include -#include #include +#include class QETRegExpValidator; /** This class represents a textfield dedicated to input a portable filename (not @@ -31,7 +31,7 @@ class QETRegExpValidator; */ class QFileNameEdit : public QLineEdit { Q_OBJECT - + // constructors, destructor public: QFileNameEdit(QWidget * = nullptr); @@ -39,22 +39,22 @@ class QFileNameEdit : public QLineEdit { ~QFileNameEdit() override; private: QFileNameEdit(const QFileNameEdit &); - + // methods public: bool isEmpty(); bool isValid(); - + private: void init(); void displayToolTip(); - + private slots: void validationFailed(); - + // attributes private: - QRegExp regexp_; + QRegularExpression regexp_; QETRegExpValidator *validator_; QString tooltip_text_; }; From 0ee8f4187b25a5f5b88375950eba535ef05f90f6 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:03:35 +0200 Subject: [PATCH 10/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/qet.cpp | 59 +++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/sources/qet.cpp b/sources/qet.cpp index dac87f5f3..6f485e193 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -24,6 +24,7 @@ #include #include #include +#include /** Permet de convertir une chaine de caracteres ("n", "s", "e" ou "w") @@ -169,10 +170,10 @@ bool QET::orthogonalProjection(const QPointF &point, // recupere le vecteur normal de `line' QLineF line_normal_vector(line.normalVector()); QPointF normal_vector(line_normal_vector.dx(), line_normal_vector.dy()); - + // cree une droite perpendiculaire a `line' passant par `point' QLineF perpendicular_line(point, point + normal_vector); - + // determine le point d'intersection des deux droites = le projete orthogonal QPointF intersection_point; @@ -184,15 +185,15 @@ bool QET::orthogonalProjection(const QPointF &point, intersects #endif (perpendicular_line, &intersection_point); - + // ne devrait pas arriver (mais bon...) if (it == QLineF::NoIntersection) return(false); - + // fournit le point d'intersection a l'appelant si necessaire if (intersection) { *intersection = intersection_point; } - + // determine si le point d'intersection appartient au segment de droite if (QET::lineContainsPoint(line, intersection_point)) { return(true); @@ -272,7 +273,7 @@ QString QET::ElementsAndConductorsSentence(int elements_count, elements_count ); } - + if (conductors_count) { if (!text.isEmpty()) text += ", "; text += QObject::tr( @@ -281,7 +282,7 @@ QString QET::ElementsAndConductorsSentence(int elements_count, conductors_count ); } - + if (texts_count) { if (!text.isEmpty()) text += ", "; text += QObject::tr( @@ -308,7 +309,7 @@ QString QET::ElementsAndConductorsSentence(int elements_count, shapes_count ); } - + if (element_text_count) { if (!text.isEmpty()) text += ", "; text += QObject::tr( @@ -324,7 +325,7 @@ QString QET::ElementsAndConductorsSentence(int elements_count, "part of a sentence listing the content of diagram", tables_count); } - + return(text); } @@ -354,7 +355,7 @@ QList QET::findInDomElement(const QDomElement &e, const QString &parent, const QString &children) { QList return_list; - + // parcours des elements parents for (QDomNode enfant = e.firstChild() ; !enfant.isNull() ; enfant = enfant.nextSibling()) { // on s'interesse a l'element XML "parent" @@ -417,15 +418,15 @@ QList QET::forbiddenCharacters() */ QString QET::stringToFileName(const QString &name) { QString file_name(name.toLower()); - + // remplace les caracteres interdits par des tirets foreach(QChar c, QET::forbiddenCharacters()) { file_name.replace(c, '-'); } - + // remplace les espaces par des underscores file_name.replace(' ', '_'); - + return(file_name); } @@ -455,12 +456,12 @@ QString QET::unescapeSpaces(const QString &string) { */ QString QET::joinWithSpaces(const QStringList &string_list) { QString returned_string; - + for (int i = 0 ; i < string_list.count() ; ++ i) { returned_string += QET::escapeSpaces(string_list.at(i)); if (i != string_list.count() - 1) returned_string += " "; } - + return(returned_string); } @@ -475,7 +476,7 @@ QStringList QET::splitWithSpaces(const QString &string) { // = avec un nombre nul ou pair de backslashes devant #pragma message("@TODO remove code for QT 5.14 or later") - QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), + QStringList escaped_strings = string.split(QRegularExpression("[^\\]?(?:\\\\)* "), #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove QString #else @@ -570,13 +571,13 @@ bool QET::compareCanonicalFilePaths(const QString &first, const QString &second) QString second_canonical_path = QFileInfo(second).canonicalFilePath(); if (second_canonical_path.isEmpty()) return(false); - + #ifdef Q_OS_WIN // sous Windows, on ramene les chemins en minuscules first_canonical_path = first_canonical_path.toLower(); second_canonical_path = second_canonical_path.toLower(); #endif - + return(first_canonical_path == second_canonical_path); } @@ -592,7 +593,7 @@ bool QET::compareCanonicalFilePaths(const QString &first, const QString &second) bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *error_message) { QSaveFile file(filepath); - + // Note: we do not set QIODevice::Text to avoid generating CRLF end of lines bool file_opening = file.open(QIODevice::WriteOnly); if (!file_opening) @@ -605,7 +606,7 @@ bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString * } return(false); } - + QTextStream out(&file); out.setCodec("UTF-8"); out.setGenerateByteOrderMark(false); @@ -617,10 +618,10 @@ bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString * "Une erreur est survenue lors de l'écriture du fichier %1, erreur %2 rencontrée.", "error message when attempting to write an XML file")).arg(filepath).arg(file.error()); } - + return false; } - + return(true); } @@ -687,7 +688,7 @@ QActionGroup *QET::depthActionGroup(QObject *parent) { QActionGroup *action_group = new QActionGroup(parent); - QAction *edit_forward = new QAction(QET::Icons::BringForward, QObject::tr("Amener au premier plan"), action_group); + QAction *edit_forward = new QAction(QET::Icons::BringForward, QObject::tr("Amener au premier plan"), action_group); QAction *edit_raise = new QAction(QET::Icons::Raise, QObject::tr("Rapprocher"), action_group); QAction *edit_lower = new QAction(QET::Icons::Lower, QObject::tr("Éloigner"), action_group); QAction *edit_backward = new QAction(QET::Icons::SendBackward, QObject::tr("Envoyer au fond"), action_group); @@ -696,17 +697,17 @@ QActionGroup *QET::depthActionGroup(QObject *parent) edit_raise ->setStatusTip(QObject::tr("Rapproche la ou les sélections")); edit_lower ->setStatusTip(QObject::tr("Éloigne la ou les sélections")); edit_backward->setStatusTip(QObject::tr("Envoie en arrière plan la ou les sélections")); - + edit_raise ->setShortcut(QKeySequence(QObject::tr("Ctrl+Shift+Up"))); edit_lower ->setShortcut(QKeySequence(QObject::tr("Ctrl+Shift+Down"))); edit_backward->setShortcut(QKeySequence(QObject::tr("Ctrl+Shift+End"))); edit_forward ->setShortcut(QKeySequence(QObject::tr("Ctrl+Shift+Home"))); - + edit_forward ->setData(QET::BringForward); edit_raise ->setData(QET::Raise); edit_lower ->setData(QET::Lower); edit_backward->setData(QET::SendBackward); - + return action_group; } From 46e96f0a67acafc3754ef11eadaaf26870b5579c Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:04:17 +0200 Subject: [PATCH 11/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/bordertitleblock.cpp | 99 ++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 9f230cc63..b9f1a4f32 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -49,18 +49,19 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) : // at first, the internal titleblock template renderer uses the default titleblock template m_titleblock_template_renderer = new TitleBlockTemplateRenderer(this); m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate()); - + // disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes - if (!QRegExp("4\\.[0-7]\\.").exactMatch(qVersion())) { - m_titleblock_template_renderer -> setUseCache(false); - } - +#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove +#else + m_titleblock_template_renderer -> setUseCache(false); +#endif + // dimensions par defaut du schema importBorder(BorderProperties()); - + // contenu par defaut du cartouche importTitleBlock(TitleBlockProperties()); - + display_titleblock_ = true; display_border_ = true; setFolioData(1, 1); @@ -227,11 +228,11 @@ void BorderTitleBlock::borderToXml(QDomElement &xml_elmt) { xml_elmt.setAttribute("cols", columnsCount()); xml_elmt.setAttribute("colsize", QString("%1").arg(columnsWidth())); xml_elmt.setAttribute("displaycols", columnsAreDisplayed() ? "true" : "false"); - + xml_elmt.setAttribute("rows", rowsCount()); xml_elmt.setAttribute("rowsize", QString("%1").arg(rowsHeight())); xml_elmt.setAttribute("displayrows", rowsAreDisplayed() ? "true" : "false"); - + // attribut datant de la version 0.1 - laisse pour retrocompatibilite xml_elmt.setAttribute("height", QString("%1").arg(diagramHeight())); } @@ -246,18 +247,18 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) { // columns count int cols_count = xml_elmt.attribute("cols").toInt(&ok); if (ok) setColumnsCount(cols_count); - + // columns width double cols_width = xml_elmt.attribute("colsize").toDouble(&ok); if (ok) setColumnsWidth(cols_width); - + // backward compatibility: // diagrams saved with 0.1 version have a "height" attribute if (xml_elmt.hasAttribute("rows") && xml_elmt.hasAttribute("rowsize")) { // rows counts int rows_count = xml_elmt.attribute("rows").toInt(&ok); if (ok) setRowsCount(rows_count); - + // taille des lignes double rows_size = xml_elmt.attribute("rowsize").toDouble(&ok); if (ok) setRowsHeight(rows_size); @@ -266,7 +267,7 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) { double height = xml_elmt.attribute("height").toDouble(&ok); if (ok) setDiagramHeight(height); } - + // rows and columns display displayColumns(xml_elmt.attribute("displaycols") != "false"); displayRows(xml_elmt.attribute("displayrows") != "false"); @@ -282,7 +283,7 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) { TitleBlockProperties BorderTitleBlock::exportTitleBlock() { TitleBlockProperties ip; - + ip.author = author(); ip.date = date(); ip.title = title(); @@ -297,7 +298,7 @@ TitleBlockProperties BorderTitleBlock::exportTitleBlock() ip.auto_page_num = autoPageNum(); ip.context = additional_fields_; ip.collection = QET::QetCollection::Embedded; - + return(ip); } @@ -322,7 +323,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) { emit(displayChanged()); } additional_fields_ = ip.context; - + emit(needFolioData()); // Note: we expect additional data to be provided // through setFolioData(), // which in turn calls updateDiagramContextForTitleBlock(). @@ -422,7 +423,7 @@ void BorderTitleBlock::titleBlockTemplateRemoved( const QString &removed_template_name, const TitleBlockTemplate *new_template) { if (titleBlockTemplateName() != removed_template_name) return; - + if (new_template) { setTitleBlockTemplate(new_template); } else { @@ -516,14 +517,14 @@ void BorderTitleBlock::draw(QPainter *painter) pen.setCosmetic(true); painter -> setPen(pen); painter -> setBrush(Qt::NoBrush); - + QSettings settings; - + //Draw the borer if (display_border_) painter -> drawRect(diagram_rect_); - + painter -> setFont(QETApp::diagramTextsFont()); - + //Draw the empty case at the top left of diagram when there is header if (display_border_ && (display_columns_ || display_rows_)) { @@ -535,7 +536,7 @@ void BorderTitleBlock::draw(QPainter *painter) ); painter -> drawRect(first_rectangle); } - + //Draw the nums of columns if (display_border_ && display_columns_) { for (int i = 1 ; i <= columns_count_ ; ++ i) { @@ -561,7 +562,7 @@ void BorderTitleBlock::draw(QPainter *painter) } } } - + //Draw the nums of rows if (display_border_ && display_rows_) { QString row_string("A"); @@ -584,7 +585,7 @@ void BorderTitleBlock::draw(QPainter *painter) row_string = incrementLetters(row_string); } } - + // render the titleblock, using the TitleBlockTemplate object if (display_titleblock_) { QRectF tbt_rect = titleBlockRectForQPainter(); @@ -607,7 +608,7 @@ void BorderTitleBlock::draw(QPainter *painter) painter -> translate(-tbt_rect.topLeft()); } } - + painter -> restore(); } @@ -646,18 +647,18 @@ void BorderTitleBlock::drawDxf( } QSettings settings; - + // draw the numbering of the columns // dessine la numerotation des colonnes if (display_border_ && display_columns_) { - int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0; + int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0; for (int i = 1 ; i <= columns_count_ ; ++ i) { - double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale + + double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale + (rows_header_width_ + ((i - 1) * columns_width_)); double yCoord = Createdxf::sheetHeight - - diagram_rect_.topLeft().y()*Createdxf::yScale + - diagram_rect_.topLeft().y()*Createdxf::yScale - columns_header_height_; double recWidth = columns_width_; double recHeight = columns_header_height_; @@ -665,18 +666,18 @@ void BorderTitleBlock::drawDxf( recWidth, recHeight, color); Createdxf::drawTextAligned(file_path, - QString::number(i + offset), - xCoord+recWidth/4, - yCoord + recHeight*0.5, + QString::number(i + offset), + xCoord+recWidth/4, + yCoord + recHeight*0.5, recHeight*0.7, 0, 0, 1, 2, - xCoord+recWidth/2, - 1, + xCoord+recWidth/2, + 1, color); - } + } } // draw line numbering @@ -686,8 +687,8 @@ void BorderTitleBlock::drawDxf( for (int i = 1 ; i <= rows_count_ ; ++ i) { double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale; - double yCoord = Createdxf::sheetHeight - - diagram_rect_.topLeft().y() + double yCoord = Createdxf::sheetHeight + - diagram_rect_.topLeft().y() *Createdxf::yScale - ( columns_header_height_ @@ -700,15 +701,15 @@ void BorderTitleBlock::drawDxf( recWidth, recHeight, color); Createdxf::drawTextAligned(file_path, row_string, - xCoord+recWidth*0.1, - yCoord + recHeight*0.4, + xCoord+recWidth*0.1, + yCoord + recHeight*0.4, recWidth*0.7, 0, 0, 1, 2, xCoord+recWidth/2, - 1, + 1, color); row_string = incrementLetters(row_string); } @@ -869,11 +870,11 @@ DiagramPosition BorderTitleBlock::convertPosition(const QPointF &pos) QPointF relative_pos = pos - insideBorderRect().topLeft(); int row_number = int(ceil(relative_pos.x() / columnsWidth())); int column_number = int(ceil(relative_pos.y() / rowsHeight())); - + QString letter = "A"; for (int i = 1 ; i < column_number ; ++ i) letter = incrementLetters(letter); - + return(DiagramPosition(letter, row_number)); } @@ -931,7 +932,7 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock( foreach (QString key, additional_fields_.keys()) { context.addValue(key, additional_fields_[key]); } - + // ... overridden by the historical and/or dynamically generated fields context.addValue("author", btb_author_); context.addValue("date", btb_date_.toString( @@ -948,7 +949,7 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock( context.addValue("auto_page_num", btb_auto_page_num_); context.addValue("previous-folio-num", m_previous_folio_num); context.addValue("next-folio-num", m_next_folio_num); - + m_titleblock_template_renderer -> setContext(context); } @@ -1000,12 +1001,12 @@ void BorderTitleBlock::setFolioData( const QString& autonum, const DiagramContext &project_properties) { if (index < 1 || total < 1 || index > total) return; - + // memorize information // memorise les informations folio_index_ = index; folio_total_ = total; - + // regenerate the content of the folio field // regenere le contenu du champ folio btb_final_folio_ = btb_folio_; From 432e80cecb34dffa8cc6c5ba8d198d6579a9d6cc Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:04:34 +0200 Subject: [PATCH 12/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/conductorproperties.cpp | 91 +++++++++++++++++---------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index 0377c103f..4d368e6b8 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -1,24 +1,24 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #include "conductorproperties.h" #include #include - +#include /** Constructeur par defaut */ @@ -70,7 +70,7 @@ void SingleLineProperties::draw(QPainter *painter, const QRectF &rect) { // s'il n'y a rien a dessiner, on retourne immediatement if (!hasNeutral && !hasGround && !phases) return; - + // prepare le QPainter painter -> save(); QPen pen(painter -> pen()); @@ -80,12 +80,12 @@ void SingleLineProperties::draw(QPainter *painter, pen.setWidthF(1); painter -> setPen(pen); painter -> setRenderHint(QPainter::Antialiasing, true); - + uint symbols_count = (hasNeutral ? 1 : 0) + (hasGround ? 1 : 0) - (isPen() ? 1 : 0) + phases; qreal interleave_base = (direction == QET::Horizontal ? rect.width() : rect.height()); qreal interleave = interleave_base / (symbols_count + 1);; qreal symbol_width = interleave_base / 12; - + for (uint i = 1 ; i <= symbols_count ; ++ i) { // dessine le tronc du symbole QPointF symbol_p1, symbol_p2; @@ -97,7 +97,7 @@ void SingleLineProperties::draw(QPainter *painter, symbol_p1 = QPointF(rect.x() + rect.width() * 0.25, rect.y() + (i * interleave) + symbol_width); } painter -> drawLine(QLineF(symbol_p1, symbol_p2)); - + // dessine le reste des symboles terre et neutre if (isPen()) { if (i == 1) { @@ -126,13 +126,13 @@ void SingleLineProperties::drawGround(QPainter *painter, QPointF center, qreal size) { painter -> save(); - + // prepare le QPainter painter -> setRenderHint(QPainter::Antialiasing, false); QPen pen2(painter -> pen()); pen2.setCapStyle(Qt::SquareCap); painter -> setPen(pen2); - + // dessine le segment representant la terre qreal half_size = size / 2.0; QPointF offset_point( @@ -145,7 +145,7 @@ void SingleLineProperties::drawGround(QPainter *painter, center - offset_point ) ); - + painter -> restore(); } @@ -161,11 +161,11 @@ void SingleLineProperties::drawNeutral( qreal size) { painter -> save(); - + // prepare le QPainter if (painter -> brush() == Qt::NoBrush) painter -> setBrush(Qt::black); painter -> setPen(Qt::NoPen); - + // desine le cercle representant le neutre painter -> drawEllipse( QRectF( @@ -173,7 +173,7 @@ void SingleLineProperties::drawNeutral( QSizeF(size, size) ) ); - + painter -> restore(); } @@ -192,7 +192,7 @@ void SingleLineProperties::drawPen(QPainter *painter, QPointF center, qreal size) { painter -> save(); - + //painter -> setBrush(Qt::white); // desine le cercle representant le neutre //painter -> drawEllipse( @@ -202,7 +202,7 @@ void SingleLineProperties::drawPen(QPainter *painter, // ) //); drawNeutral(painter, center, size * 1.5); - + int offset = (size * 1.5 / 2.0); QPointF pos = center + (direction == QET::Horizontal ? QPointF(0.0, -offset - 0.5) : QPointF(offset + 0.5, 0.0)); drawGround(painter, direction, pos, 2.0 * size); @@ -271,11 +271,11 @@ void ConductorProperties::toXml(QDomElement &e) const if (color != QColor(Qt::black)) e.setAttribute("color", color.name()); - + e.setAttribute("bicolor", m_bicolor? "true" : "false"); e.setAttribute("color2", m_color_2.name()); e.setAttribute("dash-size", QString::number(m_dash_size)); - + if (type == Single) singleLineProperties.toXml(e); @@ -292,11 +292,11 @@ void ConductorProperties::toXml(QDomElement &e) const e.setAttribute("onetextperfolio", m_one_text_per_folio); e.setAttribute("vertirotatetext", QString::number(verti_rotate_text)); e.setAttribute("horizrotatetext", QString::number(horiz_rotate_text)); - + QMetaEnum me = QMetaEnum::fromType(); e.setAttribute("horizontal-alignment", me.valueToKey(m_horizontal_alignment)); e.setAttribute("vertical-alignment", me.valueToKey(m_vertical_alignment)); - + QString conductor_style = writeStyle(); if (!conductor_style.isEmpty()) e.setAttribute("style", conductor_style); @@ -316,15 +316,15 @@ void ConductorProperties::fromXml(QDomElement &e) QString bicolor_str = e.attribute("bicolor", "false"); m_bicolor = bicolor_str == "true"? true : false; - + QColor xml_color_2 = QColor(e.attribute("color2")); m_color_2 = xml_color_2.isValid()? xml_color_2 : QColor(Qt::black); - + m_dash_size = e.attribute("dash-size", QString::number(1)).toInt(); - + // read style of conductor readStyle(e.attribute("style")); - + if (e.attribute("type") == typeToString(Single)) { // get specific properties for single conductor @@ -349,7 +349,7 @@ void ConductorProperties::fromXml(QDomElement &e) m_one_text_per_folio = e.attribute("onetextperfolio", QString::number(0)).toInt(); verti_rotate_text = e.attribute("vertirotatetext").toDouble(); horiz_rotate_text = e.attribute("horizrotatetext").toDouble(); - + QMetaEnum me = QMetaEnum::fromType(); m_horizontal_alignment = Qt::Alignment( me.keyToValue( @@ -396,7 +396,7 @@ void ConductorProperties::toSettings(QSettings &settings, const QString &prefix) settings.setValue(prefix + "onetextperfolio", m_one_text_per_folio); settings.setValue(prefix + "vertirotatetext", QString::number(verti_rotate_text)); settings.setValue(prefix + "horizrotatetext", QString::number(horiz_rotate_text)); - + QMetaEnum me = QMetaEnum::fromType(); settings.setValue(prefix + "horizontal-alignment", me.valueToKey(m_horizontal_alignment)); settings.setValue(prefix + "vertical-alignment", me.valueToKey(m_vertical_alignment)); @@ -412,13 +412,13 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi { QColor settings_color = QColor(settings.value(prefix + "color").toString()); color = (settings_color.isValid()? settings_color : QColor(Qt::black)); - + QColor settings_color_2 = QColor(settings.value(prefix + "color2").toString()); m_color_2 = (settings_color_2.isValid()? settings_color_2 : QColor(Qt::black)); - + m_bicolor = settings.value(prefix + "bicolor", false).toBool(); m_dash_size = settings.value(prefix + "dash-size", 1).toInt(); - + QString setting_type = settings.value(prefix + "type", typeToString(Multi)).toString(); type = (setting_type == typeToString(Single)? Single : Multi); @@ -438,11 +438,11 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi m_one_text_per_folio = settings.value(prefix + "onetextperfolio", false).toBool(); verti_rotate_text = settings.value((prefix + "vertirotatetext"), "270").toDouble(); horiz_rotate_text = settings.value((prefix + "horizrotatetext"), "0").toDouble(); - + QMetaEnum me = QMetaEnum::fromType(); m_horizontal_alignment = Qt::Alignment(me.keyToValue(settings.value(prefix + "horizontal-alignment", "AlignBottom").toString().toStdString().data())); m_vertical_alignment = Qt::Alignment(me.keyToValue(settings.value(prefix + "vertical-alignment", "AlignRight").toString().toStdString().data())); - + readStyle(settings.value(prefix + "style").toString()); } @@ -468,7 +468,7 @@ QString ConductorProperties::typeToString(ConductorType t) void ConductorProperties::applyForEqualAttributes(QList list) { const QList clist = std::move(list); - + if (clist.isEmpty()) return; @@ -505,7 +505,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis int i_value; double d_value; Qt::Alignment align_value; - + //Color c_value = clist.first().color; for(ConductorProperties cp : clist) @@ -516,7 +516,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis if (equal) color = c_value; equal = true; - + //bicolor b_value = clist.first().m_bicolor; for(ConductorProperties cp : clist) @@ -527,7 +527,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis if (equal) m_bicolor = b_value; equal = true; - + //second color c_value = clist.first().m_color_2; for(ConductorProperties cp : clist) @@ -538,7 +538,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis if (equal) m_color_2 = c_value; equal = true; - + //Dash size i_value = clist.first().m_dash_size; for(ConductorProperties cp : clist) @@ -693,7 +693,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis if (equal) horiz_rotate_text = d_value; equal = true; - + //Text alignment for horizontal conducor align_value = clist.first().m_horizontal_alignment; for(ConductorProperties cp : clist) @@ -704,7 +704,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis if (equal) m_horizontal_alignment = align_value; equal = true; - + //Text alignment for vertical conducor align_value = clist.first().m_vertical_alignment; for(ConductorProperties cp : clist) @@ -778,9 +778,9 @@ bool ConductorProperties::operator!=(const ConductorProperties &other) const{ */ void ConductorProperties::readStyle(const QString &style_string) { style = Qt::SolidLine; // style par defaut - + if (style_string.isEmpty()) return; - + // recupere la liste des couples style / valeur #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove QStringList styles = style_string.split(";", QString::SkipEmptyParts); @@ -788,12 +788,13 @@ void ConductorProperties::readStyle(const QString &style_string) { #pragma message("@TODO remove code QString::SkipEmptyParts for QT 5.14 or later") QStringList styles = style_string.split(";", Qt::SkipEmptyParts); #endif - - QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$"); + + QRegularExpression Rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$"); foreach (QString style_str, styles) { - if (rx.exactMatch(style_str)) { - QString style_name = rx.cap(1); - QString style_value = rx.cap(2); + if (Rx==QRegularExpression(style_str)) { + + QString style_name = Rx.namedCaptureGroups().at(1); + QString style_value = Rx.namedCaptureGroups().at(2); if (style_name == "line-style") { if (style_value == "dashed") style = Qt::DashLine; else if (style_value == "dashdotted") style = Qt::DashDotLine; From 859f6dd06db5f2cca20f11f5effc5b919b514394 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:04:43 +0200 Subject: [PATCH 13/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/diagramcontext.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sources/diagramcontext.cpp b/sources/diagramcontext.cpp index 2e0ddf8de..b7e711099 100644 --- a/sources/diagramcontext.cpp +++ b/sources/diagramcontext.cpp @@ -1,24 +1,25 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #include "diagramcontext.h" -#include #include "qet.h" #include +#include +#include /** @brief DiagramContext::add @@ -241,8 +242,9 @@ bool DiagramContext::stringLongerThan(const QString &a, const QString &b) { */ bool DiagramContext::keyIsAcceptable(const QString &key) const { - QRegExp re(DiagramContext::validKeyRegExp()); - return(re.exactMatch(key)); + QRegularExpression re(DiagramContext::validKeyRegExp()); + QRegularExpressionMatch match =re.match(key); + return match.hasMatch(); } QDebug operator <<(QDebug debug, const DiagramContext &context) From 0b3238aac03869acbb34ea244a808d7dff1875bf Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:04:48 +0200 Subject: [PATCH 14/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/diagramposition.cpp | 10 +++++----- sources/diagramposition.h | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sources/diagramposition.cpp b/sources/diagramposition.cpp index df4632a2d..cfdae4a9b 100644 --- a/sources/diagramposition.cpp +++ b/sources/diagramposition.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -29,7 +29,7 @@ DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) { // purifie les lettres letter_ = letter.toUpper(); - letter_.remove(QRegExp("[^A-Z]")); + letter_.remove(QRegularExpression("[^A-Z]")); number_ = number; } @@ -64,7 +64,7 @@ QString DiagramPosition::toString() return("-"); } QSettings settings; - + if (settings.value("border-columns_0", true).toBool()){ return(QString("%1%2").arg(letter_).arg(number_ - 1)); }else{ diff --git a/sources/diagramposition.h b/sources/diagramposition.h index b6eb7e79e..8d2add4e8 100644 --- a/sources/diagramposition.h +++ b/sources/diagramposition.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -19,7 +19,6 @@ #define DIAGRAM_POSITION_H #include #include -#include /** This class stores the position of an electrical element on its parent diagram. While exact coordinates can be stored for convenience, the concept of diagram @@ -31,7 +30,7 @@ class DiagramPosition { public: DiagramPosition(const QString & = "", unsigned int = 0); virtual ~DiagramPosition(); - + // methods public: QPointF position() const; @@ -40,7 +39,7 @@ class DiagramPosition { bool isOutOfBounds() const; unsigned int number()const {return number_;} QString letter()const {return letter_;} - + // attributes private: QString letter_; From 7fb4033eceb85b58652e7656487c060b2fd1a974 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:04:52 +0200 Subject: [PATCH 15/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/diagramprintdialog.cpp | 110 +++++++++++++++++---------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/sources/diagramprintdialog.cpp b/sources/diagramprintdialog.cpp index 36e6b6118..bd4b8cdd4 100644 --- a/sources/diagramprintdialog.cpp +++ b/sources/diagramprintdialog.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -38,7 +38,7 @@ DiagramPrintDialog::DiagramPrintDialog(QETProject *project, QWidget *parent) : { // initialise l'imprimante printer_ = new QPrinter(); - + // orientation paysage par defaut printer_ -> setOrientation(QPrinter::Landscape); backup_diagram_background_color = Diagram::background_color; @@ -95,16 +95,16 @@ QRect DiagramPrintDialog::diagramRect(Diagram *diagram, const ExportProperties &options) const { if (!diagram) return(QRect()); - + QRectF diagram_rect = diagram -> border_and_titleblock.borderAndTitleBlockRect(); if (!options.draw_titleblock) { qreal titleblock_height = diagram -> border_and_titleblock.titleBlockRect().height(); diagram_rect.setHeight(diagram_rect.height() - titleblock_height); } - + // ajuste la bordure du schema d'un pixel (epaisseur du trait) diagram_rect = diagram_rect.adjusted(0.0, 0.0, 1.0, 1.0); - + return(diagram_rect.toAlignedRect()); } @@ -113,16 +113,16 @@ QRect DiagramPrintDialog::diagramRect(Diagram *diagram, */ void DiagramPrintDialog::exec() { - + // prise en compte du nom du document if (!doc_name_.isEmpty()) printer_ -> setDocName(doc_name_); printer_ -> setCreator(QString("QElectroTech %1").arg(QET::displayedVersion)); - + // affichage d'un premier dialogue demandant a l'utilisateur le type // d'impression qu'il souhaite effectuer buildPrintTypeDialog(); if (dialog_ -> exec() == QDialog::Rejected) return; - + // parametrage de l'imprimante en fonction du type d'impression choisi if (printer_choice_ -> isChecked()) { // affichage du dialogue d'impression standard pour parametrer l'imprimante @@ -141,7 +141,7 @@ void DiagramPrintDialog::exec() } loadPageSetupForCurrentPrinter(); - + //Preview before print #if defined Q_OS_LINUX //Due to some bug with xfwm, we display this dialog has a windows on linux os (X11) @@ -159,9 +159,9 @@ void DiagramPrintDialog::exec() DiagramsChooser *dc = preview_dialog.diagramsChooser(); dc -> setSelectedAllDiagrams(); if (preview_dialog.exec() == QDialog::Rejected) return; - + savePageSetupForCurrentPrinter(); - + // effectue l'impression en elle-meme print( dc -> selectedDiagrams(), @@ -194,7 +194,7 @@ int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportPrope // note : pageRect et Paper Rect tiennent compte de l'orientation du papier QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect diagram_rect = diagramRect(diagram, options); - + int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width()))); return(h_pages_count); } @@ -211,7 +211,7 @@ int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportPropert // note : pageRect et Paper Rect tiennent compte de l'orientation du papier QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect diagram_rect = diagramRect(diagram, options); - + int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height()))); return(v_pages_count); } @@ -227,7 +227,7 @@ void DiagramPrintDialog::buildPrintTypeDialog() #ifdef Q_OS_MACOS dialog_ -> setWindowFlags(Qt::Sheet); #endif - + printtype_label_ = new QLabel(tr("Quel type d'impression désirez-vous effectuer ?")); printer_icon_ = new QLabel(); pdf_icon_ = new QLabel(); @@ -239,7 +239,7 @@ void DiagramPrintDialog::buildPrintTypeDialog() filepath_field_ = new QLineEdit(); browse_button_ = new QPushButton("..."); buttons_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - + dialog_ -> setWindowTitle(tr("Choix du type d'impression")); printer_icon_ -> setPixmap(QET::Icons::Printer.pixmap(32, 32)); pdf_icon_ -> setPixmap(QET::Icons::PDF.pixmap(32, 32)); @@ -249,19 +249,19 @@ void DiagramPrintDialog::buildPrintTypeDialog() printer_choice_ -> setChecked(true); if (!file_name_.isEmpty()) filepath_field_ -> setText(file_name_ + ".pdf"); - + // connexions signaux / slots connect(printer_choice_, SIGNAL(toggled(bool)), this, SLOT(updatePrintTypeDialog())); connect(pdf_choice_, SIGNAL(toggled(bool)), this, SLOT(updatePrintTypeDialog())); connect(browse_button_, SIGNAL(clicked(bool)), this, SLOT(browseFilePrintTypeDialog())); connect(buttons_, SIGNAL(accepted()), this, SLOT(acceptPrintTypeDialog())); connect(buttons_, SIGNAL(rejected()), dialog_, SLOT(reject())); - + // organisation graphique glayout0_ = new QGridLayout(); hlayout0_ = new QHBoxLayout(); vlayout0_ = new QVBoxLayout(); - + hlayout0_ -> addWidget(filepath_field_); hlayout0_ -> addWidget(browse_button_); glayout0_ -> addWidget(printer_icon_, 0, 0); @@ -269,13 +269,13 @@ void DiagramPrintDialog::buildPrintTypeDialog() glayout0_ -> addWidget(pdf_icon_, 1, 0); glayout0_ -> addWidget(pdf_choice_, 1, 1); glayout0_ -> addLayout(hlayout0_, 3, 1); - + vlayout0_ -> addWidget(printtype_label_); vlayout0_ -> addLayout(glayout0_); vlayout0_ -> addWidget(buttons_); - + dialog_ -> setLayout(vlayout0_); - + updatePrintTypeDialog(); } @@ -286,11 +286,11 @@ void DiagramPrintDialog::updatePrintTypeDialog() { // imprime-t-on vers un fichier ? bool file_print = !(printer_choice_ -> isChecked()); - + // on n'active le champ fichier que pour les impressions vers un fichier filepath_field_ -> setEnabled(file_print); browse_button_ -> setEnabled(file_print); - + // on corrige eventuellement l'extension du fichier deja selectionne if (file_print) { @@ -299,7 +299,9 @@ void DiagramPrintDialog::updatePrintTypeDialog() { if (pdf_choice_ -> isChecked() && filepath.endsWith(".ps")) { - QRegExp re("\\.ps$", Qt::CaseInsensitive); + QRegularExpression re + ("\\.ps$", + QRegularExpression::CaseInsensitiveOption); filepath.replace(re, ".pdf"); filepath_field_ -> setText(filepath); } @@ -331,7 +333,7 @@ void DiagramPrintDialog::acceptPrintTypeDialog() } /** - Permet a l'utilisateur de choisir un fichier + Permet a l'utilisateur de choisir un fichier */ void DiagramPrintDialog::browseFilePrintTypeDialog() { @@ -343,14 +345,14 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() extension = ".pdf"; filter = tr("Fichiers PDF (*.pdf)", "file filter"); } - + QString filepath = QFileDialog::getSaveFileName( parentWidget(), QString(), filepath_field_ -> text(), filter ); - + if (!filepath.isEmpty()) { if (!filepath.endsWith(extension)) filepath += extension; filepath = QDir::toNativeSeparators(QDir::cleanPath(filepath)); @@ -390,13 +392,13 @@ void DiagramPrintDialog::print(const QList &diagrams, #endif // QPainter utiliser pour effectuer le rendu QPainter qp(printer_); - + // cas special : il n'y a aucun schema a imprimer if (!diagrams.count()) { qp.end(); return; } - + // imprime les schemas for (int i = 0 ; i < diagrams.count() ; ++ i) { printDiagram(diagrams[i], fit_page, options, &qp, printer_); @@ -422,18 +424,18 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, //qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title(); // l'imprimante utilise-t-elle toute la feuille ? bool full_page = printer -> fullPage(); - + // impression physique (!= fichier PDF) if (printer -> outputFileName().isEmpty()) { // utiliser cette condition pour agir differemment en cas d'impression physique } - + saveReloadDiagramParameters(diagram, options, true); - + // deselectionne tous les elements QList selected_elmts = diagram -> selectedItems(); foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(false); - + // enleve le flag focusable de tous les elements concernes pour eviter toute reprise de focus par un champ de texte editable QList focusable_items; foreach (QGraphicsItem *qgi, diagram -> items()) { @@ -442,12 +444,12 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, qgi -> setFlag(QGraphicsItem::ItemIsFocusable, false); } } - + // evite toute autre forme d'interaction foreach (QGraphicsView *view, diagram -> views()) { view -> setInteractive(false); } - + QRect diagram_rect = diagramRect(diagram, options); if (fit_page) { // impression adaptee sur une seule page @@ -458,19 +460,19 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, //qDebug() << "impression sur une ou plusieurs pages"; //qDebug() << " schema :" << diagram_rect; //qDebug() << " page :" << printed_area; - + int used_width = printed_area.width(); int used_height = printed_area.height(); int h_pages_count = horizontalPagesCount(diagram, options, full_page); int v_pages_count = verticalPagesCount(diagram, options, full_page); - + QVector< QVector< QRect > > pages_grid; // le schema est imprime sur une matrice de feuilles // parcourt les lignes de la matrice int y_offset = 0; for (int i = 0 ; i < v_pages_count ; ++ i) { pages_grid << QVector< QRect >(); - + // parcourt les feuilles de la ligne int x_offset = 0; for (int j = 0 ; j < h_pages_count ; ++ j) { @@ -483,10 +485,10 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, ); x_offset += used_width; } - + y_offset += used_height; } - + // ne retient que les pages a imprimer QVector pages_to_print; for (int i = 0 ; i < v_pages_count ; ++ i) { @@ -495,7 +497,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, } } //qDebug() << " " << pages_to_print.count() << " pages a imprimer :"; - + // parcourt les pages pour impression for (int i = 0 ; i < pages_to_print.count() ; ++ i) { QRect current_rect(pages_to_print.at(i)); @@ -511,20 +513,20 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, } } } - + // remet en place les interactions foreach (QGraphicsView *view, diagram -> views()) { view -> setInteractive(true); } - + // restaure les flags focusable foreach (QGraphicsItem *qgi, focusable_items) { qgi -> setFlag(QGraphicsItem::ItemIsFocusable, true); } - + // restaure les elements selectionnes foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true); - + saveReloadDiagramParameters(diagram, options, false); } @@ -537,7 +539,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, */ void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const ExportProperties& options, bool save) { static ExportProperties state_exportProperties; - + if (save) { // memorise les parametres relatifs au schema tout en appliquant les nouveaux state_exportProperties = diagram -> applyProperties(options); @@ -556,11 +558,11 @@ void DiagramPrintDialog::savePageSetupForCurrentPrinter() { QSettings settings; QString printer_section = settingsSectionName(printer_); - + while (!settings.group().isEmpty()) settings.endGroup(); settings.beginGroup("printers"); settings.beginGroup(printer_section); - + settings.setValue("orientation", printer_ -> orientation() == QPrinter::Portrait ? "portrait" : "landscape"); settings.setValue("papersize", int(printer_ -> paperSize())); if (printer_ -> paperSize() == QPrinter::Custom) { @@ -592,14 +594,14 @@ void DiagramPrintDialog::loadPageSetupForCurrentPrinter() { QSettings settings; QString printer_section = settingsSectionName(printer_); - + while (!settings.group().isEmpty()) settings.endGroup(); settings.beginGroup("printers"); if (!settings.childGroups().contains(printer_section)) { settings.endGroup(); return; } - + settings.beginGroup(printer_section); if (settings.contains("orientation")) { QString value = settings.value("orientation", "landscape").toString(); @@ -618,7 +620,7 @@ void DiagramPrintDialog::loadPageSetupForCurrentPrinter() printer_ -> setPaperSize(static_cast(value)); } } - + qreal margins[4]; printer_ -> getPageMargins(&margins[0], &margins[1], &margins[2], &margins[3], QPrinter::Millimeter); QStringList margins_names(QStringList() << "left" << "top" << "right" << "bottom"); @@ -629,7 +631,7 @@ void DiagramPrintDialog::loadPageSetupForCurrentPrinter() } printer_ -> setPageMargins(margins[0], margins[1], margins[2], margins[3], QPrinter::Millimeter); printer_ -> setFullPage(settings.value("fullpage", "false").toString() == "true"); - + settings.endGroup(); settings.endGroup(); } From 93055c6a96e3bc9b1dac27a054248cabb827ff3f Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:04:59 +0200 Subject: [PATCH 16/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- .../graphicspart/customelementgraphicpart.cpp | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/sources/editor/graphicspart/customelementgraphicpart.cpp b/sources/editor/graphicspart/customelementgraphicpart.cpp index 73494aa5a..6ffc7f904 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.cpp +++ b/sources/editor/graphicspart/customelementgraphicpart.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -19,6 +19,8 @@ #include "elementscene.h" #include "QPropertyUndoCommand/qpropertyundocommand.h" +#include + /** @brief CustomElementGraphicPart::CustomElementGraphicPart Default constructor. @@ -162,13 +164,13 @@ void CustomElementGraphicPart::setAntialiased(const bool b) void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const { QString css_like_styles; - + css_like_styles += "line-style:"; if (_linestyle == DashedStyle) css_like_styles += "dashed"; else if (_linestyle == DottedStyle) css_like_styles += "dotted"; else if (_linestyle == DashdottedStyle) css_like_styles += "dashdotted"; else if (_linestyle == NormalStyle) css_like_styles += "normal"; - + css_like_styles += ";line-weight:"; if (_lineweight == NoneWeight) css_like_styles += "none"; else if (_lineweight == ThinWeight) css_like_styles += "thin"; @@ -508,7 +510,7 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde) { resetStyles(); - + //Get the list of pair style/value #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts); @@ -516,14 +518,14 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde) #pragma message("@TODO remove code for QT 5.14 or later") QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts); #endif - + //Check each pair of style - QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); + QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); foreach (QString style, styles) { - if (!rx.exactMatch(style)) continue; - QString style_name = rx.cap(1); - QString style_value = rx.cap(2); + if (rx!=QRegularExpression(style)) continue; + QString style_name = rx.namedCaptureGroups().at(1); + QString style_value = rx.namedCaptureGroups().at(2); if (style_name == "line-style") { if (style_value == "dashed") _linestyle = DashedStyle; @@ -887,13 +889,13 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const //Get the pen and brush QPen pen = painter.pen(); QBrush brush = painter.brush(); - + //Apply pen style if (_linestyle == DashedStyle) pen.setStyle(Qt::DashLine); else if (_linestyle == DashdottedStyle) pen.setStyle(Qt::DashDotLine); else if (_linestyle == DottedStyle) pen.setStyle(Qt::DotLine); else if (_linestyle == NormalStyle) pen.setStyle(Qt::SolidLine); - + //Apply pen width if (_lineweight == NoneWeight) pen.setColor(QColor(0, 0, 0, 0)); else if (_lineweight == ThinWeight) pen.setWidth(0); @@ -1064,7 +1066,7 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const else if (_filling == HTMLGrayDarkSlateGrayFilling) brush.setColor(QColor(47, 79, 79)); else if (_filling == HTMLGrayBlackFilling) brush.setColor(QColor(0, 0, 0)); } - + //Apply pen color if (_color == WhiteColor) pen.setColor(QColor(255, 255, 255, pen.color().alpha())); else if (_color == BlackColor) pen.setColor(QColor( 0, 0, 0, pen.color().alpha())); @@ -1220,12 +1222,12 @@ void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const else if (_color == HTMLGrayDarkSlateGrayColor) pen.setColor(QColor(47, 79, 79)); else if (_color == HTMLGrayBlackColor) pen.setColor(QColor(0, 0, 0)); else if (_color == NoneColor) pen.setBrush(Qt::transparent); - + //Apply antialiasing painter.setRenderHint(QPainter::Antialiasing, _antialiased); painter.setRenderHint(QPainter::TextAntialiasing, _antialiased); painter.setRenderHint(QPainter::SmoothPixmapTransform, _antialiased); - + painter.setPen(pen); painter.setBrush(brush); } From 3eca82baad2b3c021c63262fdd006d096c48b895 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:05:29 +0200 Subject: [PATCH 17/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/factory/elementpicturefactory.cpp | 49 ++++++++++++----------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index d21b237ae..4dd11ff0f 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -28,6 +28,7 @@ #include #include #include +#include ElementPictureFactory* ElementPictureFactory::m_factory = nullptr; @@ -44,14 +45,14 @@ void ElementPictureFactory::getPictures(const ElementsLocation &location, QPictu if(!location.exist()) { return; } - + QUuid uuid = location.uuid(); if(Q_UNLIKELY(uuid.isNull())) { build(location, &picture, &low_picture); return; } - + if(m_pictures_H.keys().contains(uuid)) { picture = m_pictures_H.value(uuid); @@ -76,11 +77,11 @@ void ElementPictureFactory::getPictures(const ElementsLocation &location, QPictu QPixmap ElementPictureFactory::pixmap(const ElementsLocation &location) { QUuid uuid = location.uuid(); - + if (m_pixmap_H.contains(uuid)) { return m_pixmap_H.value(uuid); } - + if(build(location)) { auto doc = location.pugiXml(); @@ -95,19 +96,19 @@ QPixmap ElementPictureFactory::pixmap(const ElementsLocation &location) QPixmap pix(w, h); pix.fill(QColor(255, 255, 255, 0)); - + QPainter painter(&pix); painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::SmoothPixmapTransform, true); painter.translate(hsx, hsy); painter.drawPicture(0, 0, m_pictures_H.value(uuid)); - + if (!uuid.isNull()) { m_pixmap_H.insert(uuid, pix); } return pix; } - + return QPixmap(); } @@ -122,7 +123,7 @@ ElementPictureFactory::primitives ElementPictureFactory::getPrimitives( { if(!m_primitives_H.contains(location.uuid())) build(location); - + return m_primitives_H.value(location.uuid()); } @@ -143,14 +144,14 @@ ElementPictureFactory::~ElementPictureFactory() this function draw on it and don't store it. if null, this function create a QPicture for normal and low zoom, draw on it and store it in m_pictures_H and m_low_pictures_H - @return + @return */ bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *picture, QPicture *low_picture) { QDomElement dom = location.xml(); - + //Check if the curent version can read the xml description if (dom.hasAttribute("version")) { @@ -165,7 +166,7 @@ bool ElementPictureFactory::build(const ElementsLocation &location, ) << std::endl; } } - + //This attributes must be present and valid int w, h, hot_x, hot_y; if (!QET::attributeIsAnInteger(dom, QString("width"), &w) ||\ @@ -175,7 +176,7 @@ bool ElementPictureFactory::build(const ElementsLocation &location, { return(false); } - + QPainter painter; QPicture pic; primitives primitives_; @@ -188,8 +189,8 @@ bool ElementPictureFactory::build(const ElementsLocation &location, painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::TextAntialiasing, true); painter.setRenderHint(QPainter::SmoothPixmapTransform,true); - - + + QPainter low_painter; QPicture low_pic; if (low_picture) { @@ -201,12 +202,12 @@ bool ElementPictureFactory::build(const ElementsLocation &location, low_painter.setRenderHint(QPainter::Antialiasing, true); low_painter.setRenderHint(QPainter::TextAntialiasing, true); low_painter.setRenderHint(QPainter::SmoothPixmapTransform,true); - + QPen tmp; tmp.setWidthF(1.0); //Vaudoo line to take into account the setCosmetic - don't remove tmp.setCosmetic(true); low_painter.setPen(tmp); - + //scroll of the Children of the Definition: Parts of the Drawing for (QDomNode node = dom.firstChild() ; !node.isNull() ; node = node.nextSibling()) { @@ -214,9 +215,9 @@ bool ElementPictureFactory::build(const ElementsLocation &location, if (elmts.isNull()) { continue; } - + if (elmts.tagName() == "description") - { + { //Manage the graphic description = part of drawing for (QDomNode n = node.firstChild() ; !n.isNull() ; n = n.nextSibling()) { @@ -230,7 +231,7 @@ bool ElementPictureFactory::build(const ElementsLocation &location, } } } - + //End of the drawing painter.end(); low_painter.end(); @@ -458,7 +459,7 @@ void ElementPictureFactory::parsePolygon(const QDomElement &dom, QPainter &paint if (i < 3) { return; } - + QVector points; // empty vector created instead of default initialized vector with i-1 elements. for (int j = 1 ; j < i ; ++ j) { points.insert( @@ -568,11 +569,11 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa #pragma message("@TODO remove code for QT 5.14 or later") const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts); #endif - QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); + QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); for (QString style : styles) { - if (rx.exactMatch(style)) { - QString style_name = rx.cap(1); - QString style_value = rx.cap(2); + if (rx==QRegularExpression(style)) { + QString style_name = rx.namedCaptureGroups().at(1); + QString style_value = rx.namedCaptureGroups().at(2); if (style_name == "line-style") { if (style_value == "dashed") pen.setStyle(Qt::DashLine); else if (style_value == "dotted") pen.setStyle(Qt::DotLine); From 4c54335301701c1b5e644e5d3cca7b6445deb811 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:05:37 +0200 Subject: [PATCH 18/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/qetapp.cpp | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index fff72edc4..c2a7aef36 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -33,14 +33,14 @@ #include "projectview.h" #include "elementpicturefactory.h" #include "aboutqetdialog.h" +#include "factory/elementfactory.h" #include #include #define QUOTE(x) STRINGIFY(x) #define STRINGIFY(x) #x #include -#include "factory/elementfactory.h" - +#include #include #ifdef QET_ALLOW_OVERRIDE_CED_OPTION @@ -97,7 +97,7 @@ QETApp::QETApp() : "splash screen caption")); if (!collections_cache_) { QString cache_path = QETApp::configDir() + "/elements_cache.sqlite"; - + collections_cache_ = new ElementsCollectionCache(cache_path, this); collections_cache_->setLocale(langFromSetting()); } @@ -113,12 +113,12 @@ QETApp::QETApp() : "splash screen caption")); openFiles(qet_arguments_); } - + buildSystemTrayMenu(); if (m_splash_screen) { m_splash_screen -> hide(); } - + checkBackupFiles(); } @@ -129,17 +129,17 @@ QETApp::~QETApp() { m_elements_recent_files->save(); m_projects_recent_files->save(); - + delete m_splash_screen; delete m_elements_recent_files; delete m_projects_recent_files; delete m_qsti; - + if (m_custom_tbt_collection) delete m_custom_tbt_collection; if (m_common_tbt_collection) delete m_common_tbt_collection; - + ElementFactory::dropInstance(); ElementPictureFactory::dropInstance(); } @@ -409,12 +409,12 @@ QString QETApp::elementTranslatedInfoKey(const QString &info) else if (info == "label") return tr("Label"); else if (info == "plant") return tr("Installation"); else if (info == "location") return tr("Localisation"); - + else if (info == "comment") return tr("Commentaire"); else if (info == "function") return tr("Fonction"); else if (info == "auxiliary1") return tr("Bloc auxiliaire 1"); else if (info == "auxiliary2") return tr("Bloc auxiliaire 2"); - + else if (info == "description") return tr("Description textuelle"); else if (info == "designation") return tr("Numéro d'article"); else if (info == "manufacturer") return tr("Fabricant"); @@ -455,7 +455,7 @@ QStringList QETApp::conductorInfoKeys() keys.append("tension/protocol"); keys.append("conductor_color"); keys.append("conductor_section"); - + return keys; } @@ -492,7 +492,7 @@ QStringList QETApp::diagramInfoKeys() list.append("indexrev"); list.append("date"); list.append("display_folio"); - + return list; } @@ -625,7 +625,7 @@ QString QETApp::commonElementsDir() else if (m_user_common_elements_dir != "default") { return m_user_common_elements_dir; } - + #ifdef QET_ALLOW_OVERRIDE_CED_OPTION if (common_elements_dir != QString()) return(common_elements_dir); #endif @@ -687,7 +687,7 @@ QString QETApp::customElementsDir() else if (m_user_custom_elements_dir != "default") { return m_user_custom_elements_dir; } - + return(configDir() + "elements/"); } @@ -786,7 +786,7 @@ QString QETApp::customTitleBlockTemplatesDir() else if (m_user_custom_tbt_dir != "default") { return m_user_custom_tbt_dir; } - + return(configDir() + "titleblocks/"); } @@ -911,7 +911,7 @@ QStringList QETApp::handledFileExtensions() if (!ext.count()) { ext << "qet"; ext << "elmt"; - ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegExp("^\\.")); + ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegularExpression("^\\.")); } return(ext); } @@ -1159,7 +1159,7 @@ QFont QETApp::diagramTextsItemFont(qreal size) ).toDouble(); QString diagram_texts_item_style = settings.value("diagramitemstyle", "normal").toString(); - + if (size != -1.0) { diagram_texts_item_size = size; } @@ -1359,9 +1359,9 @@ QList QETApp::elementEditors(QETProject *project) { void QETApp::receiveMessage(int instanceId, QByteArray message) { Q_UNUSED(instanceId); - + QString str(message); - + if (str.startsWith("launched-with-args: ")) { QString my_message(str.mid(20)); @@ -2102,10 +2102,10 @@ template void QETApp::addWindowsListToMenu( or -1 if none could be found. */ int QETApp::projectIdFromString(const QString &url) { - QRegExp embedded("^project([0-9]+)\\+embed.*$", Qt::CaseInsensitive); - if (embedded.exactMatch(url)) { + QRegularExpression embedded("^project([0-9]+)\\+embed.*$", QRegularExpression::CaseInsensitiveOption); + if (embedded==QRegularExpression(url)) { bool conv_ok = false; - int project_id = embedded.capturedTexts().at(1).toInt(&conv_ok); + int project_id = embedded.namedCaptureGroups().at(1).toInt(&conv_ok); if (conv_ok) { return(project_id); } @@ -2191,7 +2191,7 @@ void QETApp::buildSystemTrayMenu() void QETApp::checkBackupFiles() { QList stale_files = KAutoSaveFile::allStaleFiles(); - + //Remove from the list @stale_files, the stales file of opened project const QList sf = stale_files; for (KAutoSaveFile *kasf : sf) @@ -2227,10 +2227,10 @@ void QETApp::checkBackupFiles() for(const KAutoSaveFile *kasf : stale_files) { #ifdef Q_OS_WIN - //Remove the first character '/' before the name of the drive - text.append("
" + kasf->managedFile().path().remove(0,1)); + //Remove the first character '/' before the name of the drive + text.append("
" + kasf->managedFile().path().remove(0,1)); #else - text.append("
" + kasf->managedFile().path()); + text.append("
" + kasf->managedFile().path()); #endif } @@ -2319,12 +2319,12 @@ void QETApp::fetchWindowStats( bool QETApp::eventFiltrer(QObject *object, QEvent *e) { // gere l'ouverture de fichiers (sous MacOs) if (e -> type() == QEvent::FileOpen) { - // nom du fichier a ouvrir - QString filename = static_cast(e) -> file(); - openFiles(QStringList() << filename); - return(true); + // nom du fichier a ouvrir + QString filename = static_cast(e) -> file(); + openFiles(QStringList() << filename); + return(true); } else { - return QObject::eventFilter(object, e); + return QObject::eventFilter(object, e); } } #endif From 813014ec3378234fba17748a862441f7e5de1f37 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:05:47 +0200 Subject: [PATCH 19/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/titleblock/templatelocation.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sources/titleblock/templatelocation.cpp b/sources/titleblock/templatelocation.cpp index 95c40a717..3a20f7ef5 100644 --- a/sources/titleblock/templatelocation.cpp +++ b/sources/titleblock/templatelocation.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -19,6 +19,8 @@ #include "templatescollection.h" #include "qetapp.h" +#include + // make this class usable with QVariant int TitleBlockTemplateLocation::MetaTypeId = qRegisterMetaType("TitleBlockTemplateLocation"); @@ -97,10 +99,10 @@ bool TitleBlockTemplateLocation::isValid() const */ void TitleBlockTemplateLocation::fromString(const QString &loc_str) { collection_ = QETApp::titleBlockTemplatesCollection(QUrl(loc_str).scheme()); - - QRegExp name_from_url("^[^:]*:\\/\\/(.*)$"); - if (name_from_url.exactMatch(loc_str)) { - name_ = name_from_url.capturedTexts().at(1); + + QRegularExpression name_from_url("^[^:]*:\\/\\/(.*)$"); + if (name_from_url==QRegularExpression(loc_str)) { + name_ = name_from_url.namedCaptureGroups().at(1); } else { name_ = QString(); } From 176dcd376b69394f7641b3f873da5562ec8f25f1 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:05:51 +0200 Subject: [PATCH 20/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/titleblock/templatescollection.cpp | 64 +++++++++++----------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/sources/titleblock/templatescollection.cpp b/sources/titleblock/templatescollection.cpp index 001b08945..cb2ed3d7a 100644 --- a/sources/titleblock/templatescollection.cpp +++ b/sources/titleblock/templatescollection.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -20,6 +20,8 @@ #include "qetapp.h" #include "qetproject.h" +#include + /** Constructor @param parent Parent QObject @@ -136,7 +138,7 @@ TitleBlockTemplatesProjectCollection::~TitleBlockTemplatesProjectCollection() QString TitleBlockTemplatesProjectCollection::title() const { if (!title_.isEmpty()) return(title_); - + // if the title attribute is empty, we generate a suitable one using the // parent project QString final_title; @@ -204,12 +206,12 @@ TitleBlockTemplate *TitleBlockTemplatesProjectCollection::getTemplate(const QStr if (titleblock_templates_.contains(template_name)) { return(titleblock_templates_[template_name]); } - + // No? Do we even know of it? if (!titleblock_templates_xml_.contains(template_name)) { return(nullptr); } - + // Ok, we have its XML description, we have to generate a TitleBlockTemplate object TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(this); if (titleblock_template -> loadFromXmlElement(titleblock_templates_xml_[template_name])) { @@ -248,16 +250,16 @@ bool TitleBlockTemplatesProjectCollection::setTemplateXmlDescription(const QStri if (xml_elmt.tagName() != "titleblocktemplate") { return(false); } - + // we *require* a project (at least for the moment...) if (!project_) return(false); - + // we import the provided XML element in the project document QDomElement import = xml_document_.importNode(xml_elmt, true).toElement(); - + // ensure the name stored in the XML description remains consistent with the provided template name import.setAttribute("name", template_name); - + // we either replace the previous description if (titleblock_templates_xml_.contains(template_name)) { QDomElement old_description = titleblock_templates_xml_[template_name]; @@ -266,12 +268,12 @@ bool TitleBlockTemplatesProjectCollection::setTemplateXmlDescription(const QStri } } titleblock_templates_xml_.insert(template_name, import); - + if (titleblock_templates_.contains(template_name)) { titleblock_templates_[template_name] -> loadFromXmlElement(titleblock_templates_xml_[template_name]); } emit(changed(this, template_name)); - + return(true); } @@ -282,11 +284,11 @@ bool TitleBlockTemplatesProjectCollection::setTemplateXmlDescription(const QStri */ void TitleBlockTemplatesProjectCollection::removeTemplate(const QString &template_name) { emit(aboutToRemove(this, template_name)); - + // remove the template itself titleblock_templates_xml_.remove(template_name); titleblock_templates_.remove(template_name); - + // warn the rest of the world that the list of templates embedded within this project has changed emit(changed(this, template_name)); } @@ -339,10 +341,10 @@ void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_elemen // each titleblock template must have a name if (!e.hasAttribute("name")) continue; QString titleblock_template_name = e.attribute("name"); - + // if several templates have the same name, we keep the first one encountered if (titleblock_templates_xml_.contains(titleblock_template_name)) continue; - + // we simply store the XML element describing the titleblock template, // without any further analysis for the moment titleblock_templates_xml_.insert(titleblock_template_name, e); @@ -355,7 +357,7 @@ void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_elemen void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates() { if (!project_) return; - + foreach (QString template_name, templates()) { if (!project_ -> usesTitleBlockTemplate(location(template_name))) { removeTemplate(template_name); @@ -408,7 +410,7 @@ QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) c QStringList TitleBlockTemplatesFilesCollection::templates() { QStringList templates_names; - QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION)); + QRegularExpression replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION)); foreach(QString name, dir_.entryList()) { templates_names << name.replace(replace_regexp, ""); } @@ -421,10 +423,10 @@ QStringList TitleBlockTemplatesFilesCollection::templates() */ TitleBlockTemplate *TitleBlockTemplatesFilesCollection::getTemplate(const QString &template_name) { if (!templates().contains(template_name)) return(nullptr); - + TitleBlockTemplate *tbtemplate = new TitleBlockTemplate(); QString tbt_file_path = path(template_name); - + bool loading = tbtemplate -> loadFromXmlFile(tbt_file_path); if (!loading) { delete tbtemplate; @@ -439,17 +441,17 @@ TitleBlockTemplate *TitleBlockTemplatesFilesCollection::getTemplate(const QStrin */ QDomElement TitleBlockTemplatesFilesCollection::getTemplateXmlDescription(const QString &template_name) { QString xml_file_path = path(template_name); - + QFileInfo xml_file_info(xml_file_path); if (!xml_file_info.exists() || !xml_file_info.isReadable()) { return(QDomElement()); } - + QFile xml_file(xml_file_path); if (!xml_file.open(QIODevice::ReadOnly)) { return(QDomElement()); } - + QDomDocument *xml_document = new QDomDocument(); bool xml_parsing = xml_document -> setContent(&xml_file); if (!xml_parsing) { @@ -466,16 +468,16 @@ QDomElement TitleBlockTemplatesFilesCollection::getTemplateXmlDescription(const */ bool TitleBlockTemplatesFilesCollection::setTemplateXmlDescription(const QString &template_name, const QDomElement &xml_element) { if (template_name.isEmpty()) return(false); - + // prevent the watcher from emitting signals while we open and write to file blockSignals(true); - + QDomDocument doc; doc.appendChild(doc.importNode(xml_element, true)); - + bool writing = QET::writeXmlFile(doc, path(template_name)); if (!writing) return(false); - + // emit a single signal for the change blockSignals(false); emit(changed(this, template_name)); @@ -489,9 +491,9 @@ void TitleBlockTemplatesFilesCollection::removeTemplate(const QString &template_ emit(aboutToRemove(this, template_name)); // prevent the watcher from emitting signals while we open and write to file blockSignals(true); - + dir_.remove(toFileName(template_name)); - + // emit a single signal for the removal blockSignals(false); emit(changed(this, template_name)); @@ -500,7 +502,7 @@ void TitleBlockTemplatesFilesCollection::removeTemplate(const QString &template_ /** @param template_name Name of a template supposed to be contained within this collection. - @return + @return */ TitleBlockTemplateLocation TitleBlockTemplatesFilesCollection::location(const QString &template_name) { return(TitleBlockTemplateLocation(template_name, this)); @@ -544,7 +546,7 @@ bool TitleBlockTemplatesFilesCollection::isReadOnly(const QString &template_name @return the template name for \a file_name */ QString TitleBlockTemplatesFilesCollection::toTemplateName(const QString &file_name) { - static QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION)); + static QRegularExpression replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION)); QString template_name(file_name); return(template_name.replace(replace_regexp, "")); } From b7c8ae88e25fdd01807c47549249856bebaba91c Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 18 Sep 2020 23:05:57 +0200 Subject: [PATCH 21/34] Fix code style --- sources/titleblocktemplate.cpp | 296 +++++++++++++++++---------------- 1 file changed, 156 insertions(+), 140 deletions(-) diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 479c57c52..3d72dd3db 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -23,6 +23,8 @@ // uncomment the line below to get more debug information //#define TITLEBLOCK_TEMPLATE_DEBUG +#include +#include /** @brief TitleBlockTemplate::TitleBlockTemplate Constructor @@ -97,7 +99,7 @@ bool TitleBlockTemplate::loadFromXmlFile(const QString &filepath) { #ifdef TITLEBLOCK_TEMPLATE_DEBUG qDebug() << Q_FUNC_INFO << filepath << "opened"; #endif - + // parse its content as XML QDomDocument xml_doc; bool xml_parsing = xml_doc.setContent(&template_file); @@ -124,11 +126,11 @@ bool TitleBlockTemplate::loadFromXmlElement(const QDomElement &xml_element) { return(false); } name_ = xml_element.attribute("name"); - + loadInformation(xml_element); loadLogos(xml_element, true); loadGrid(xml_element); - + return(true); } @@ -141,14 +143,14 @@ bool TitleBlockTemplate::loadFromXmlElement(const QDomElement &xml_element) { */ bool TitleBlockTemplate::saveToXmlFile(const QString &filepath) { if (filepath.isEmpty()) return(false); - + // generate the XML document QDomDocument doc; QDomElement e = doc.createElement("root"); bool saving = saveToXmlElement(e); if (!saving) return(false); doc.appendChild(e); - + return(QET::writeXmlFile(doc, filepath)); } @@ -163,7 +165,7 @@ bool TitleBlockTemplate::saveToXmlElement(QDomElement &xml_element) const { // we are supposed to have at least a name if (name_.isEmpty()) return(false); - + xml_element.setTagName("titleblocktemplate"); xml_element.setAttribute("name", name_); saveInformation(xml_element); @@ -195,7 +197,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const TitleBlockTemplate *copy = new TitleBlockTemplate(); copy -> name_ = name_; copy -> information_ = information_; - + // this does not really duplicates pixmaps, // only the objects that hold a key to the implicitly shared pixmaps foreach (QString logo_key, bitmap_logos_.keys()) { @@ -209,20 +211,20 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const << copy -> bitmap_logos_[logo_key] -> cacheKey(); #endif } - + // we have to create new QSvgRenderer objects from the data // (no copy constructor) foreach (QString logo_key, vector_logos_.keys()) { copy -> vector_logos_[logo_key] = new QSvgRenderer(data_logos_[logo_key]); } - + copy -> data_logos_ = data_logos_; copy -> storage_logos_ = storage_logos_; copy -> type_logos_ = type_logos_; copy -> rows_heights_ = rows_heights_; copy -> columns_width_ = columns_width_; - + // copy cells basically copy -> cells_ = cells_; for (int j = 0 ; j < rows_heights_.count() ; ++ j) { @@ -230,7 +232,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const copy -> cells_[i][j] = copy -> createCell(cells_[i][j]); } } - + // ensure the copy has no spanner_cell attribute pointing to a cell // from the original object for (int j = 0 ; j < rows_heights_.count() ; ++ j) { @@ -247,7 +249,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const } } } - + return(copy); } @@ -278,15 +280,15 @@ bool TitleBlockTemplate::loadLogos(const QDomElement &xml_element, bool reset) { if (reset) { qDeleteAll(vector_logos_.begin(), vector_logos_.end()); vector_logos_.clear(); - + // Note: // QPixmap are only a key to access the implicitly shared pixmap bitmap_logos_.clear(); - + data_logos_.clear(); storage_logos_.clear(); } - + // we look for //logos/logo elements for (QDomNode n = xml_element.firstChild() ; !n.isNull() ; @@ -302,7 +304,7 @@ bool TitleBlockTemplate::loadLogos(const QDomElement &xml_element, bool reset) { } } } - + return(true); } @@ -321,7 +323,7 @@ bool TitleBlockTemplate::loadLogo(const QDomElement &xml_element) { QString logo_name = xml_element.attribute("name"); QString logo_type = xml_element.attribute("type", "png"); QString logo_storage = xml_element.attribute("storage", "base64"); - + // Both QSvgRenderer and QPixmap read their data from a QByteArray, so // we convert the available data to that format. QByteArray logo_data; @@ -342,7 +344,7 @@ bool TitleBlockTemplate::loadLogo(const QDomElement &xml_element) { qDebug() << Q_FUNC_INFO << logo_name << logo_type << logo_storage; #endif addLogo(logo_name, &logo_data, logo_type, logo_storage); - + return(true); } @@ -362,12 +364,12 @@ bool TitleBlockTemplate::loadGrid(const QDomElement &xml_element) { break; } } - + if (!grid_element.hasAttribute("rows") || !grid_element.hasAttribute("cols")) { return(false); } - + parseRows(grid_element.attribute("rows")); parseColumns(grid_element.attribute("cols")); initCells(); @@ -508,7 +510,7 @@ void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const { QDomNode information_text_node = xml_element.ownerDocument().createTextNode(information()); - + QDomElement information_element = xml_element.ownerDocument().createElement("information"); information_element.appendChild(information_text_node); @@ -544,11 +546,11 @@ void TitleBlockTemplate::saveLogo(const QString &logo_name, QDomElement &xml_element) const { if (!type_logos_.contains(logo_name)) return; - + xml_element.setAttribute("name", logo_name); xml_element.setAttribute("type", type_logos_[logo_name]); xml_element.setAttribute("storage", storage_logos_[logo_name]); - + if (storage_logos_[logo_name] == "xml" && type_logos_[logo_name] == "svg") { QDomDocument svg_logo; @@ -575,7 +577,7 @@ void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const { QDomElement grid_element = xml_element.ownerDocument().createElement("grid"); - + QString rows_attr, cols_attr; foreach(int row_height, rows_heights_) rows_attr += QString("%1;").arg(row_height); @@ -583,9 +585,9 @@ void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const cols_attr += col_width.toShortString(); grid_element.setAttribute("rows", rows_attr); grid_element.setAttribute("cols", cols_attr); - + saveCells(grid_element); - + xml_element.appendChild(grid_element); } @@ -625,12 +627,12 @@ void TitleBlockTemplate::saveCell(TitleBlockCell *cell, if (cell -> spanner_cell) return; if (!save_empty && cell -> cell_type == TitleBlockCell::EmptyCell) return; - - + + QDomElement cell_elmt = xml_element.ownerDocument().createElement("cell"); xml_element.appendChild(cell_elmt); - + // save information dependent from this template cell_elmt.setAttribute("row", cell -> num_row); cell_elmt.setAttribute("col", cell -> num_col); @@ -638,7 +640,7 @@ void TitleBlockTemplate::saveCell(TitleBlockCell *cell, cell -> row_span); if (cell -> col_span) cell_elmt.setAttribute("colspan", cell -> col_span); - + // save other information cell -> saveContentToXml(cell_elmt); } @@ -659,15 +661,15 @@ bool TitleBlockTemplate::checkCell(const QDomElement &xml_element, TitleBlockCell **titleblock_cell_ptr) { int col_count = columns_width_.count(), row_count = rows_heights_.count(); - + #ifdef TITLEBLOCK_TEMPLATE_DEBUG qDebug() << Q_FUNC_INFO << "begin" << row_count << col_count; #endif - + int row_num, col_num, row_span, col_span; row_num = col_num = -1; row_span = col_span = 0; - + // parse the row and col attributes if (!QET::attributeIsAnInteger(xml_element, "row", &row_num) || row_num < 0 @@ -679,7 +681,7 @@ bool TitleBlockTemplate::checkCell(const QDomElement &xml_element, || col_num >= col_count) { return(false); } - + // check whether the target cell can be used or not #ifdef TITLEBLOCK_TEMPLATE_DEBUG qDebug() << Q_FUNC_INFO << "cell access" << col_num << row_num; @@ -692,20 +694,20 @@ bool TitleBlockTemplate::checkCell(const QDomElement &xml_element, // ensure the num_row and num_col attributes are alright cell_ptr -> num_row = row_num; cell_ptr -> num_col = col_num; - + // parse the rowspan and colspan attributes if (QET::attributeIsAnInteger(xml_element, "rowspan", &row_span) && row_span > 0) { cell_ptr -> row_span = row_span; } - + if (QET::attributeIsAnInteger(xml_element, "colspan", &col_span) && col_span > 0) { cell_ptr -> col_span = col_span; } // these attributes are stored "as is" -- whether they can be applied // directly or must be restricted will be checked later - + if (titleblock_cell_ptr) *titleblock_cell_ptr = cell_ptr; return(true); } @@ -719,7 +721,7 @@ bool TitleBlockTemplate::checkCell(const QDomElement &xml_element, void TitleBlockTemplate::initCells() { if (columns_width_.count() < 1 || rows_heights_.count() < 1) return; - + cells_.clear(); qDeleteAll(registered_cells_); registered_cells_.clear(); @@ -838,12 +840,12 @@ int TitleBlockTemplate::rowsCount() const QList TitleBlockTemplate::columnsWidth(int total_width) const { if (total_width < 0) return(QList()); - + // we first iter to determine the absolute and total-width-related widths QVector final_widths(columns_width_.count()); int abs_widths_sum = 0, rel_widths_sum = 0; QList relative_columns; - + for (int i = 0 ; i < columns_width_.count() ; ++ i) { TitleBlockDimension icd = columns_width_.at(i); if (icd.type == QET::Absolute) { @@ -856,10 +858,10 @@ QList TitleBlockTemplate::columnsWidth(int total_width) const final_widths[i] = abs_value; } } - + // we can now deduce the remaining width int remaining_width = total_width - abs_widths_sum; - + // we do a second iteration to build the final widths list for (int i = 0 ; i < columns_width_.count() ; ++ i) { TitleBlockDimension icd = columns_width_.at(i); @@ -870,14 +872,14 @@ QList TitleBlockTemplate::columnsWidth(int total_width) const rel_widths_sum += final_widths[i]; } } - + // Have we computed widths from percentage for relative columns? if (relative_columns.count()) { // Due to the rounding process, // we may get a slight difference between the // sum of the columns widths and the total width. int difference = total_width - abs_widths_sum - rel_widths_sum; - + if (difference) { // We consider we should not attempt to compensate // this difference if it is under @@ -886,7 +888,7 @@ QList TitleBlockTemplate::columnsWidth(int total_width) const // columns can "bring" up to 0.5px of difference). qreal max_acceptable_difference = relative_columns.count() * 0.5; - + int share = difference > 0 ? 1 : -1; if (qAbs(difference) <= max_acceptable_difference) { while (difference) { @@ -914,32 +916,32 @@ QList TitleBlockTemplate::rowsHeights() const /** @brief TitleBlockTemplate::columnTypeCount @param type : a column type - @return the count of \a type columns + @return the count of \a type columns */ int TitleBlockTemplate::columnTypeCount(QET::TitleBlockColumnLength type) { int count = 0; - + for (int i = 0 ; i < columns_width_.count() ; ++ i) { if (columns_width_.at(i).type == type) ++ count; } - + return(count); } /** @brief TitleBlockTemplate::columnTypeTotal @param type : a column type - @return the sum of values attached to \a type columns + @return the sum of values attached to \a type columns */ int TitleBlockTemplate::columnTypeTotal(QET::TitleBlockColumnLength type) { int total = 0; - + for (int i = 0 ; i < columns_width_.count() ; ++ i) { if (columns_width_.at(i).type == type) { total += columns_width_.at(i).value; } } - + return(total); } @@ -951,7 +953,7 @@ int TitleBlockTemplate::minimumWidth() // Abbreviations: ABS: absolute, RTT: relative to total, RTR: // relative to remaining, // TOT: total diagram/TBT width (variable). - + // Minimum size may be enforced by ABS and RTT widths: // TOT >= ((sum(REL)/100)*TOT)+sum(ABS) // => (1 - (sum(REL)/100))TOT >= sum(ABS) @@ -1050,7 +1052,7 @@ bool TitleBlockTemplate::insertRow(int dimension, const QList &row, int i) { int index = (i == -1) ? rows_heights_.count() : i; - + for (int j = 0 ; j < columns_width_.count() ; ++ j) { cells_[j].insert(index, row[j]); } @@ -1166,7 +1168,7 @@ TitleBlockCell *TitleBlockTemplate::cell(int row, int col) const { if (row >= rows_heights_.count()) return(nullptr); if (col >= columns_width_.count()) return(nullptr); - + return(cells_[col][row]); } @@ -1198,7 +1200,7 @@ QSet TitleBlockTemplate::spannedCells( ? given_cell -> col_span : given_cell -> applied_col_span; if (!final_row_span && !final_col_span) return(set); - + for (int i = given_cell -> num_col ; i <= given_cell -> num_col + final_col_span ; ++ i) { @@ -1269,7 +1271,7 @@ bool TitleBlockTemplate::addLogo(const QString &logo_name, // we are replacing the logo removeLogo(logo_name); } - + // we can now create our image object from the byte array if (logo_type == "svg") { // SVG format is handled by the QSvgRenderer class @@ -1278,7 +1280,7 @@ bool TitleBlockTemplate::addLogo(const QString &logo_name, return(false); } vector_logos_.insert(logo_name, svg); - + // we also memorize the way to store them in the final XML output QString final_logo_storage = logo_storage; if (logo_storage != "xml" && logo_storage != "base64") { @@ -1286,7 +1288,7 @@ bool TitleBlockTemplate::addLogo(const QString &logo_name, } storage_logos_.insert(logo_name, logo_storage); } else { - + // bitmap formats are handled by the QPixmap class QPixmap logo_pixmap; logo_pixmap.loadFromData(*logo_data); @@ -1294,15 +1296,15 @@ bool TitleBlockTemplate::addLogo(const QString &logo_name, return(false); } bitmap_logos_.insert(logo_name, logo_pixmap); - + // bitmap logos can only be stored using a base64 encoding storage_logos_.insert(logo_name, "base64"); } - + // we systematically store the raw data data_logos_.insert(logo_name, *logo_data); type_logos_.insert(logo_name, logo_type); - + return(true); } @@ -1320,15 +1322,15 @@ bool TitleBlockTemplate::addLogoFromFile(const QString &filepath, QFileInfo filepath_info(filepath); QString filename = name.isEmpty() ? filepath_info.fileName() : name; QString filetype = filepath_info.suffix(); - + // we read the provided logo QFile logo_file(filepath); if (!logo_file.open(QIODevice::ReadOnly)) return(false); QByteArray file_content = logo_file.readAll(); - + // first, we try to add it as an SVG image if (addLogo(filename, &file_content, "svg", "xml")) return(true); - + // we then try to add it as a bitmap image return addLogo(filename, &file_content, @@ -1349,12 +1351,12 @@ bool TitleBlockTemplate::saveLogoToFile(const QString &logo_name, if (!data_logos_.contains(logo_name)) { return(false); } - + QFile target_file(filepath); if (!target_file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { return(false); } - + target_file.write(data_logos_[logo_name]); target_file.close(); return(true); @@ -1395,7 +1397,7 @@ bool TitleBlockTemplate::renameLogo(const QString &logo_name, || data_logos_.contains(new_name)) { return(false); } - + /// TODO check existing cells using this logo. if (vector_logos_.contains(logo_name)) { vector_logos_.insert(new_name, vector_logos_.take(logo_name)); @@ -1493,16 +1495,16 @@ void TitleBlockTemplate::render(QPainter &painter, { QList widths = columnsWidth(titleblock_width); int titleblock_height = height(); - + painter.save(); //Setup the QPainter QPen pen(Qt::black); pen.setCosmetic(true); painter.setPen(pen); - + // draw the titleblock border painter.drawRect(QRect(0, 0, titleblock_width, titleblock_height)); - + // run through each individual cell for (int j = 0 ; j < rows_heights_.count() ; ++ j) { for (int i = 0 ; i < columns_width_.count() ; ++ i) { @@ -1510,13 +1512,13 @@ void TitleBlockTemplate::render(QPainter &painter, || cells_[i][j] -> cell_type == TitleBlockCell::EmptyCell) continue; - + // calculate the border rect of the current cell int x = lengthRange(0, cells_[i][j] -> num_col, widths); int y = lengthRange(0, cells_[i][j] -> num_row, rows_heights_); - + int row_span = 0, col_span = 0; if (cells_[i][j] -> span_state != TitleBlockCell::Disabled) { @@ -1530,7 +1532,7 @@ void TitleBlockTemplate::render(QPainter &painter, cells_[i][j] -> num_row + 1 + row_span, rows_heights_); QRect cell_rect(x, y, w, h); - + renderCell(painter, *cells_[i][j], diagram_context, cell_rect); @@ -1647,7 +1649,7 @@ void TitleBlockTemplate::renderCell(QPainter &painter, pen.setColor(Qt::black); painter.setPen(pen); painter.drawRect(cell_rect); - + painter.save(); // render the inner content of the current cell if (cell.type() == TitleBlockCell::LogoCell) { @@ -1672,7 +1674,7 @@ void TitleBlockTemplate::renderCell(QPainter &painter, renderTextCell(painter, final_text, cell, cell_rect); } painter.restore(); - + // draw again the border rect of the current cell, without the brush this time painter.setBrush(Qt::NoBrush); painter.drawRect(cell_rect); @@ -1695,9 +1697,9 @@ QString TitleBlockTemplate::finalTextForCell( { QString cell_text = cell.value.name(); QString cell_label = cell.label.name(); - + cell_text = interpreteVariables(cell_text, diagram_context); - + if (cell.display_label && !cell.label.isEmpty()) { cell_label = interpreteVariables(cell_label, diagram_context); cell_text = QString(tr(" %1 : %2", "titleblock content - please let the blank space at the beginning")).arg(cell_label).arg(cell_text); @@ -1749,7 +1751,7 @@ QStringList TitleBlockTemplate::listOfVariables() #pragma message("@TODO not works on all cases...") // TODO: not works on all cases... list << cells_[i][j] -> value.name().replace("%",""); - } + } } qDebug() << list; return list; @@ -1778,25 +1780,25 @@ void TitleBlockTemplate::renderTextCell(QPainter &painter, if (text.isEmpty()) return; QFont text_font = TitleBlockTemplate::fontForCell(cell); painter.setFont(text_font); - + if (cell.hadjust) { QFontMetricsF font_metrics(text_font); QRectF font_rect = font_metrics.boundingRect( QRect(-10000, -10000, 10000, 10000), cell.alignment, text); - + if (font_rect.width() > cell_rect.width()) { qreal ratio = qreal(cell_rect.width()) / qreal(font_rect.width()); painter.save(); - + painter.translate(cell_rect.topLeft()); qreal vertical_adjustment = cell_rect.height() * (1 - ratio) / 2.0; painter.translate(0.0, vertical_adjustment); painter.scale(ratio, ratio); - + QRectF new_world_cell_rect(cell_rect); new_world_cell_rect.moveTo(0, 0.0); new_world_cell_rect.setWidth(new_world_cell_rect.width() @@ -1804,12 +1806,12 @@ void TitleBlockTemplate::renderTextCell(QPainter &painter, painter.drawText(new_world_cell_rect, cell.alignment, text); - + painter.restore(); return; } } - + // Still here? Let's draw the text normally painter.drawText(cell_rect, cell.alignment, text); } @@ -1825,14 +1827,15 @@ void TitleBlockTemplate::renderTextCell(QPainter &painter, @param h @param color */ -void TitleBlockTemplate::renderTextCellDxf(QString &file_path, - const QString &text, - const TitleBlockCell &cell, - qreal x, - qreal y, - qreal w, - qreal h, - int color) const +void TitleBlockTemplate::renderTextCellDxf( + QString &file_path, + const QString &text, + const TitleBlockCell &cell, + qreal x, + qreal y, + qreal w, + qreal h, + int color) const { if (text.isEmpty()) return; QFont text_font = TitleBlockTemplate::fontForCell(cell); @@ -1841,61 +1844,73 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path, textHeight = text_font.pixelSize(); qreal x2 = x + w; - qreal y1 = y; + qreal y1 = y; int vAlign = 0; int hAlign = 0; - x2 = x; // default + x2 = x; // default - if ( cell.alignment & Qt::AlignTop ) { - vAlign = 3; - y1 = y + h - (textHeight*Createdxf::yScale / 8); - } else if ( cell.alignment & Qt::AlignVCenter ) { - vAlign = 2; - y1 = y + h/2; - } else if ( cell.alignment & Qt::AlignBottom ) { - y1 = y + (textHeight*Createdxf::yScale / 8); - } + if ( cell.alignment & Qt::AlignTop ) + { + vAlign = 3; + y1 = y + h - (textHeight*Createdxf::yScale / 8); + } + else if ( cell.alignment & Qt::AlignVCenter ) + { + vAlign = 2; + y1 = y + h/2; + } + else if ( cell.alignment & Qt::AlignBottom ) + { + y1 = y + (textHeight*Createdxf::yScale / 8); + } - if ( cell.alignment & Qt::AlignRight ) { + if ( cell.alignment & Qt::AlignRight ) + { hAlign = 2; - x2 = x + w; - } else if ( cell.alignment & Qt::AlignHCenter ) { + x2 = x + w; + } + else if ( cell.alignment & Qt::AlignHCenter ) + { hAlign = 1; x2 = x + w/2; - } else if (cell.alignment & Qt::AlignJustify ) { + } + else if (cell.alignment & Qt::AlignJustify ) + { hAlign = 5; - vAlign = 0; - x2 = x + w; - y1 = y + textHeight*Createdxf::yScale / 8; + vAlign = 0; + x2 = x + w; + y1 = y + textHeight*Createdxf::yScale / 8; } //painter.setFont(text_font); - qreal ratio = 1.0; + qreal ratio = 1.0; - if (cell.hadjust) { - // Scale font width to fit string in cell width w - // As DXF font aspect ratio is implementation dependent we add a fudge-factor based on tests with AutoCAD - int len = text.length() * textHeight * Createdxf::xScale * 1.2; + if (cell.hadjust) + { + // Scale font width to fit string in cell width w + // As DXF font aspect ratio is implementation dependent we add a fudge-factor based on tests with AutoCAD + int len = text.length() * textHeight * Createdxf::xScale * 1.2; - if(len > w) - ratio = (w/len); + if(len > w) + ratio = (w/len); } - // x offset value below currently set heuristically based on appearance... - Createdxf::drawTextAligned(file_path, - text, - x - 2*Createdxf::xScale, - y1, - textHeight*Createdxf::yScale, - 0, - 0, - hAlign, - vAlign, - x2, - ratio, - color); + // x offset value below currently set heuristically based on appearance... + Createdxf::drawTextAligned( + file_path, + text, + x - 2*Createdxf::xScale, + y1, + textHeight*Createdxf::yScale, + 0, + 0, + hAlign, + vAlign, + x2, + ratio, + color); } /** @@ -1965,11 +1980,11 @@ void TitleBlockTemplate::applyCellSpans() */ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) { if (!cell) return(false); - + cell -> span_state = TitleBlockCell::Enabled; cell -> applied_row_span = cell -> row_span; cell -> applied_col_span = cell -> col_span; - + // ensure the cell can span as far as required if (cell -> num_col + cell -> col_span >= columnsCount()) { cell -> applied_col_span = columnsCount() - 1 - cell -> num_col; @@ -1979,7 +1994,7 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) { cell -> applied_row_span = rowsCount() - 1 - cell -> num_row; cell -> span_state = TitleBlockCell::Restricted; } - + // ensure cells that will be spanned are either empty or free for (int i = cell -> num_col ; i <= cell -> num_col + cell -> applied_col_span ; @@ -2006,7 +2021,7 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) { } } } - + return(true); } @@ -2019,10 +2034,11 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) { @param cell : Potentially spanning cell */ -void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell) { +void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell) +{ if (!cell || (!cell -> row_span && !cell -> col_span)) return; if (cell -> span_state == TitleBlockCell::Disabled) return; - + // goes through every spanned cell for (int i = cell -> num_col ; i <= cell -> num_col + cell -> applied_col_span ; @@ -2093,7 +2109,7 @@ int TitleBlockTemplate::lengthRange( #endif return(0); } - + int length = 0; for (int i = start ; i < end ; ++i) { length += lengths_list[i]; From 24d48850930148ad6b120d0aa6c78817e00ad1e7 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Sat, 19 Sep 2020 01:01:29 +0200 Subject: [PATCH 22/34] Fix deprecated QRegExp Use QRegularExpression instead. https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users This function was introduced in Qt 5 --- sources/titleblocktemplate.cpp | 35 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 3d72dd3db..acc44604b 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -388,7 +388,9 @@ bool TitleBlockTemplate::loadGrid(const QDomElement &xml_element) { void TitleBlockTemplate::parseRows(const QString &rows_string) { rows_heights_.clear(); // parse the rows attribute: we expect a serie of absolute heights - QRegExp row_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive); + QRegularExpression row_size_format + ("^([0-9]+)(?:px)?$", + QRegularExpression::CaseInsensitiveOption); bool conv_ok; #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove @@ -400,10 +402,11 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) { rows_string.split(QChar(';'), Qt::SkipEmptyParts); #endif foreach (QString rows_description, rows_descriptions) { - if (row_size_format.exactMatch(rows_description)) { + QRegularExpressionMatch match; + match = row_size_format.match(rows_description); + if (match.hasMatch()) { int row_size = - row_size_format.capturedTexts().at(1).toInt( - &conv_ok); + match.captured(1).toInt(&conv_ok); if (conv_ok) rows_heights_ << row_size; } @@ -422,8 +425,12 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) { void TitleBlockTemplate::parseColumns(const QString &cols_string) { columns_width_.clear(); // parse the cols attribute: we expect a serie of absolute or relative widths - QRegExp abs_col_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive); - QRegExp rel_col_size_format("^([rt])([0-9]+)%$", Qt::CaseInsensitive); + QRegularExpression abs_col_size_format,rel_col_size_format; + abs_col_size_format.setPattern("^([0-9]+)(?:px)?$"); + abs_col_size_format.setPatternOptions(QRegularExpression::CaseInsensitiveOption); + //QRegExp rel_col_size_format("^([rt])([0-9]+)%$", Qt::CaseInsensitive); + rel_col_size_format.setPattern("^([rt])([0-9]+)%$"); + rel_col_size_format.setPatternOptions(QRegularExpression::CaseInsensitiveOption); bool conv_ok; #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove @@ -435,18 +442,18 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) { cols_string.split(QChar(';'), Qt::SkipEmptyParts); #endif foreach (QString cols_description, cols_descriptions) { - if (abs_col_size_format.exactMatch(cols_description)) { - int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok); + QRegularExpressionMatch match_abc,match_rel; + match_abc = abs_col_size_format.match(cols_description); + match_rel = rel_col_size_format.match(cols_description); + if (match_abc.hasMatch()) { + int col_size = match_abc.captured(1).toInt(&conv_ok); if (conv_ok) columns_width_ << TitleBlockDimension( col_size, QET::Absolute); - } else if (rel_col_size_format.exactMatch(cols_description)) { - int col_size = - rel_col_size_format.capturedTexts().at(2).toInt( - &conv_ok); - QET::TitleBlockColumnLength col_type = - rel_col_size_format.capturedTexts().at(1) + } else if (match_rel.hasMatch()) { + int col_size = match_rel.captured(2).toInt(&conv_ok); + QET::TitleBlockColumnLength col_type = match_rel.captured(1) == "t" ? QET::RelativeToTotalLength : QET::RelativeToRemainingLength; From 89f9f47174859dfbf868bbba0f75641bd4210824 Mon Sep 17 00:00:00 2001 From: Claveau Joshua Date: Sun, 20 Sep 2020 11:40:18 +0200 Subject: [PATCH 23/34] Remove unused code --- .../qetgraphicshandlerutility.h | 1 - sources/editor/graphicspart/partline.cpp | 77 ------------------- sources/editor/graphicspart/partline.h | 2 - 3 files changed, 80 deletions(-) diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.h b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.h index 59527ca2b..6e226fda3 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.h +++ b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.h @@ -20,7 +20,6 @@ #include #include -#include #include class QPainter; diff --git a/sources/editor/graphicspart/partline.cpp b/sources/editor/graphicspart/partline.cpp index d499e31b7..6e6a799c1 100644 --- a/sources/editor/graphicspart/partline.cpp +++ b/sources/editor/graphicspart/partline.cpp @@ -407,54 +407,6 @@ QPainterPath PartLine::shadowShape() const return (pps.createStroke(shape)); } -/** - @brief PartLine::fourShapePoints - @return a list with the two points that delimite the line - + the four points surrounding these two points -*/ -QList PartLine::fourShapePoints() const -{ - const qreal marge = 2.0; - - QPointF a = m_line.p1(); - QPointF b = m_line.p2(); - - QList result; - - //Special case, the line is defined by one point - if (a == b) - { - result << QPointF(a.x() - marge, a.y() - marge); - result << QPointF(a.x() - marge, a.y() + marge); - result << QPointF(a.x() + marge, a.y() + marge); - result << QPointF(a.x() + marge, a.y() - marge); - } - else - { - //We calcule the vector AB : (xb-xa, yb-ya) - QPointF v_ab = b - a; - - //And the distance AB: root of the coordinates of the vector squared - qreal ab = sqrt(pow(v_ab.x(), 2) + pow(v_ab.y(), 2)); - - //Next, we define the vector u(a, b) wich is equal to the vector AB divided - //by is length and multiplied by the length of marge. - QPointF u = v_ab / ab * marge; - - //We define the vector v(-b, a) wich is perpendicular to AB - QPointF v(-u.y(), u.x()); - QPointF m = -u + v; // we have vector M = -u + v - QPointF n = -u - v; // and vector N=-u-v - QPointF h = a + m; // H = A + M - QPointF k = a + n; // K = A + N - QPointF i = b - n; // I = B - N - QPointF j = b - m; // J = B - M - - result << h << i << j << k; - } - return(result); -} - /** @brief PartLine::firstEndCircleRect @return the rectangle bordering the entirety of the first extremity @@ -491,35 +443,6 @@ QRectF PartLine::secondEndCircleRect() const return(end_rect); } -/** - @brief PartLine::debugPaint - Display several composante of the drawing - -the bounding rect - -special points at each extremity - -the quadrature of the circle at each extremity, even if itself is an other type - @param painter -*/ -void PartLine::debugPaint(QPainter *painter) -{ - painter -> save(); - painter -> setPen(Qt::gray); - painter -> drawRect(boundingRect()); - - painter -> setPen(Qt::green); - painter -> drawRect(firstEndCircleRect()); - painter -> drawRect(secondEndCircleRect()); - - painter -> setPen(Qt::red); - - foreach(QPointF pointy, fourEndPoints(m_line.p1(), m_line.p2(), first_length)) - painter -> drawEllipse(pointy, 0.1, 0.1); - - foreach(QPointF pointy, fourEndPoints(m_line.p2(), m_line.p1(), second_length)) - painter -> drawEllipse(pointy, 0.1, 0.1); - - painter -> restore(); -} - /** @brief PartLine::boundingRect @return the bounding rect of this part diff --git a/sources/editor/graphicspart/partline.h b/sources/editor/graphicspart/partline.h index 148599ed1..589335ba2 100644 --- a/sources/editor/graphicspart/partline.h +++ b/sources/editor/graphicspart/partline.h @@ -110,10 +110,8 @@ class PartLine : public CustomElementGraphicPart void removeHandler(); QPainterPath path() const; - QList fourShapePoints() const; QRectF firstEndCircleRect() const; QRectF secondEndCircleRect() const; - void debugPaint(QPainter *); /*****************/ Qet::EndType first_end; From f21cdb4040940c02b4de9d201890db55de14e6b4 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Mon, 21 Sep 2020 07:11:42 +0200 Subject: [PATCH 24/34] Update de translation, thanks Lars --- lang/qet_de.qm | Bin 244631 -> 254217 bytes lang/qet_de.ts | 415 +++++++++++++++++++++++++------------------------ 2 files changed, 211 insertions(+), 204 deletions(-) diff --git a/lang/qet_de.qm b/lang/qet_de.qm index 77a5bf4e0620cb6e4c03f5b48788d9b864dbd5af..c7ee9ec00c212c0a8f4f3764c69d5d8c74487a6e 100644 GIT binary patch delta 29461 zcmcG02YgIf*#3LYonDm$QAf9kAgmrs5=4uT=q-{-3~43_QAh86aP{6r4I5pE-aET% ziN!9vR`09)pL?&q?C$sdf8YAq=gysbPkGN%DvB@}!_s%guK3cV!N@+HKkG8uXDVp6RgKtdsrR3`&TunD9( zKaQyIO$93sQm|%U1%s|C*m{y-;pE-6bQ-y;VWm zD+NpKP_Whk1skXoY^HR?I$l&h+w&;cv$%}>#{vpoxu)Q~W-D(oDz7H;BC>>) zCn5iI%K6KDqKv8JSz;QIaFz0$*g`_DaLSj*O?2!r<-1%Nk~~U<^1_50Un5(O@g$he zQHcu{;?^Qm(%(sRw-l9Z?M1ALKb747npnbF7nQ0wn0TXP`exQ0;twxSX%|FTx*Pc# zvWUFr$;eY0k#Bq0?(h~=^;vNe78a%&Lw+ZkP>E{%f`M-+Oy9jg$K@)@$oo#9fGdrO zt!qbtSN0Om-kR#C*C(N18Z{UO>k7zD4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*{1_{!p^m6;=#M^%j*&y9xsNbw zE}r5V$ANRatx7^9TTz-hmKi1V%PJW!^Tu3slvpJ~fm|U*%0CzuVmBpRYN76%mr-Hm~zzS;aO>`Jot%_*`C03cJSF zFn=ldI)8|KjjF|ew>%KmIsSM4)50sfo#cOu`$#=+@nWolH2fC#m)76n&7@hu+#n6P z&5Pha9jXR**8$D>6U!LqVxN_h|9;6|-CKB@*Q@0B zzds^3BN?yl578+8B$nz*1#a`IlK*X9?SF)*{j1^9v8%k)e-9gHKZeZ%!_xg44{@Bn z!9N+K_{Ur&k%IOewpSXnBNGW0`l=t`_JY2Hw;2xU3 zanaF{2~y}oUfmJ+hzG0xed%GZ6IVit+zE#&J?EKfY2r%E;-a5Ra8OFr5O}Mj_mN;^M7tTZIdI*DkgGvS~^=u1V}Sn#S*FD zD^^?@Q<_<%#z%xoI#`<3mRv{T9sjxED!GPpSEDn4N`@Xo(InPHRA7}Ho&`mmkUC^z zkuljOEK(P%D55yY(>7s}UKAFKoNfqaXPj_z>?k4(&c#$g$Hij8A=oJC)e>G{KRyPeeYV6{Z)*MG|9<$WIs%uu2WJ log - + Log @@ -63,13 +63,13 @@ Les développeurs de QElectroTech about tab, developers line - + Die Entwickler von QElectroTech Contact : <a href="mailto:qet@lists.tuxfamily.org">qet@lists.tuxfamily.org</a> about tab, contact line - Kontakt : <a href="mailto:qet@lists.tuxfamily.org">qet@lists.tuxfamily.org</a> + Kontakt: <a href="mailto:qet@lists.tuxfamily.org">qet@lists.tuxfamily.org</a> @@ -103,7 +103,7 @@ Collection - Sammlung + Sammlung @@ -297,99 +297,99 @@ Ajouter un tableau - + Tabelle einfügen Affichage - Anzeige + Anzeige Ajuster la taille du tableau au folio - + Tabellegröße an Folie anpassen Ajouter de nouveau folio et tableau si nécessaire. - + Neue Folie und Tabelle hinzufügen wenn erforderlich. Nom du tableau - + Name der Tabelle Texte des en-têtes - + Tabellenkopf Gauche - Linksbündig + Linksbündig Centre - Zentriert + Zentriert Droite - Rechtsbündig + Rechtsbündig Police : - Schriftart: + Schriftart: Éditer - Bearbeiten + Bearbeiten Marges : - + Ränder: Alignement : - Ausrichtung: + Ausrichtung: Texte du tableau - + Tabelleninhalt Configuration - Einstellung + Konfiguration Contenu - + Inhalt Sélectionner la police des en tête du tableau - + Schriftart für Tabellenkopf auswählen Sélectionner la police des cellules du tableau - + Schriftart für Tabellentext auswählen @@ -580,7 +580,7 @@ Built - As-Built + wie gefertigt @@ -610,27 +610,28 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Dialog - Dialog + Dialog Mise en page - Einrichtung + Seitenlayout inclure les en-têtes - + Überschriften einschließen Formater en tant que liste de materiel - + als Stückliste + nomenclature_ - Stückliste_ + Betriebsmittelverzeichnis_ @@ -664,13 +665,13 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Position du folio - Folienreihenfolge + Position der Folie Quantité numéro d'article Special field with name : designation quantity - + Menge Artikelnummer @@ -841,7 +842,7 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Formule du texte : - Formel vom Text: + Textformel: @@ -867,7 +868,7 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Section du conducteur - + Leiterabschnitt @@ -913,7 +914,7 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Taille : - Größe: + Größe: @@ -939,7 +940,7 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Couleur du texte: - + Textfarbe: @@ -964,7 +965,7 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Taille de trait : - Größe: + Linienstärke: @@ -1017,12 +1018,12 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. GroupBox - + Configuration - Einstellung + Einstellungen @@ -1870,7 +1871,7 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Simple - Einfach + Einzelbauteil @@ -1979,14 +1980,14 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Type : %1 - Typ: %1 + Typ: %1 Sous-type : %1 - + Subtyp: %1 @@ -2039,157 +2040,157 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren. Form - + Informations disponibles - Verfügbare Informationen + Verfügbare Informationen Informations à exporter - Zu exportierende Informationen + Zu exportierende Informationen Monter la sélection - Auswahl nach oben verschieben + Auswahl nach oben verschieben Ajouter la sélection - Auswahl hinzufügen + Auswahl einfügen Supprimer la sélection - + Auswahl löschen Descendre la sélection - Auswahl nach unten verschieben + Auswahl nach unten verschieben Pas de filtre - + Kein Filter N'est pas vide - + Ist nicht leer Est vide - + Ist leer Contient - + Enthält Ne contient pas - + Enthält nicht Est égal à - + Ist gleich N'est pas égale à - + Ungleich Filtre : - + Filter: Type d'éléments - Bauteiltyp + Bauteiltypen Simples - Einfache + Einzelbauteile Tous - Alle + Alle Contacteurs et relais - Schütze und Relais + Schütze und Relais Boutons et commutateurs - Bedienelemente + Tasten und Schalter Borniers - Klemmleisten + Klemmleisten Organes de protection - Schutzeinrichtungen + Schutzeinrichtungen Configuration - Einstellung + Konfiguration Ouvrir la configuration sélectionné - Ausgewählte Konfiguration öffnen + Ausgewählte Konfiguration öffnen Sauvegarder la configuration actuelle - Aktuelle Konfiguration speichern + Aktuelle Konfiguration speichern Requête SQL personnalisée - Personalisierte SQL-Anfrage + Benutzerdefinierte SQL-Abfrage Requête SQL : - SQL-Anfrage: + SQL-Abfrage: Position - + Position Titre du folio - Folientitel + Folientitel Position du folio - Folienreihenfolge + Position der Folie Numéro du folio - + Foliennummer @@ -2561,7 +2562,7 @@ Alle Bauteile und Unterordner von diesem Ordner werden ebenso gelöscht. Ajouter un folio - Neue Folie einfügen + Neue Folie hinzufügen @@ -2586,7 +2587,7 @@ Alle Bauteile und Unterordner von diesem Ordner werden ebenso gelöscht. Remonter ce folio au debut - Folie zum Anfang verschieben + Folie an den Anfang verschieben @@ -2667,7 +2668,7 @@ Alle Bauteile und Unterordner von diesem Ordner werden ebenso gelöscht. Exporter les folios du projet window title - Folien vom Projekt exportieren + Folien des Projekts exportieren @@ -3037,7 +3038,7 @@ Texte und Zahlen sind ebenso erlaubt. Utiliser les numéros de folio à la place de leur position dans le projet - Foliennummer verwenden anstelle von Reihenfolgenindex im Projekt + Foliennummer anstelle von Reihenfolgenindex im Projekt verwenden @@ -3076,7 +3077,7 @@ Hier unten kann der Standardwert dieses Textfeldes für Ihre eigenen Bauteile de Exporter les bornes dans la nomenclature - Klemmen in die Stückliste exportieren + Klemmen in Betriebsmittelverzeichnis exportieren @@ -3316,7 +3317,7 @@ Hier unten kann der Standardwert dieses Textfeldes für Ihre eigenen Bauteile de Japonais - + Japanisch @@ -3351,7 +3352,7 @@ Hier unten kann der Standardwert dieses Textfeldes für Ihre eigenen Bauteile de Norvege - + Norwegisch @@ -3381,7 +3382,7 @@ Hier unten kann der Standardwert dieses Textfeldes für Ihre eigenen Bauteile de Ceci est un projet QElectroTech, c'est-à-dire un fichier d'extension .qet regroupant plusieurs folios. Il embarque également les éléments et modèles de cartouches utilisés dans ces folios. "What's this" tip - Das ist ein QElectroTech-Projekt : eine *.qet Datei, in der Folien, eingebettete Bauteile und eingebettete Zeichnungsköpfe gespeichert sind. + Das ist ein QElectroTech-Projekt: eine *.qet Datei, in der Folien, eingebettete Bauteile und eingebettete Zeichnungsköpfe gespeichert sind. @@ -3424,185 +3425,187 @@ Hier unten kann der Standardwert dieses Textfeldes für Ihre eigenen Bauteile de Form - + Affichage - Anzeige + Darstellung Nom du tableau - + Name der Tabelle Aucun - + Keine Toutes - + Alles Lignes à afficher : - + Anzuzeigende Zeilen: Y : - y: + y: Tableau suivant - + Nächste Tabelle X : - x: + x: Tableau précédent - + Vorherige Tabelle Tableau précédent : - + Vorherige Tabelle: Géometrie et lignes - + Geometrie und Linien Appliquer la géometrie à tous les tableaux liée à celui-ci - + Geometrie auf alle hiermit verknüpften Tabellen anwenden Ajuster le tableau au folio - + Tabelle an Foliegröße anpassen TextLabel - TextLabel + TextLabel En tête - + Kopfzeile Marge - + Rand Aligement : - + Ausrichtung: Gauche - Linksbündig + Linksbündig Centré - Mittig + Zentriert Droite - Rechtsbündig + Rechtsbündig Police - Schiftart + Schriftart Tableau - + Tabelleninhalt Alignement : - Ausrichtung: + Ausrichtung: Contenu - + Inhalt Déplacer un tableau - + Tabelle verschieben Modifier le nombre de ligne affiché par un tableau - + Anzahl der angezeigten Zeilen einer Tabelle ändern Modifier les marges d'une en tête de tableau - + Ränder des Tabellenkopfs ändern Modifier les marges d'un tableau - + Ränder der Tabelle ändern Modifier l'alignement d'une en tête de tableau - + Textausrichtung eines Tabellenkopfs ändern Modifier l'alignement des textes d'un tableau - + Textausrichtung in einer Tabelle ändern Modifier la police d'une en tête de tableau - + Schriftart eines Tabellenkopfs ändern Changer la police d'un tableau - + Schriftart einer Tabelle ändern <center>ATTENTION :</center> il manque %1 lignes afin d'afficher l'intégralité des informations - + <center>ACHTUNG:</center> + %1 Zeilen fehlen, um alle Information darzustellen Appliquer la géometrie d'un tableau aux tableau liée à celui-ci - + Geometrie einer Tabelle auf alle damit verknüpften Tabellen anwenden + @@ -4018,13 +4021,13 @@ Veuillez utiliser l'éditeur avancé pour cela. Couleur du conducteur - Leiterfarbe + Leiterfarbe Section du conducteur - + Leiterabschnitt @@ -4077,12 +4080,12 @@ Veuillez utiliser l'éditeur avancé pour cela. Compilation : - Kompiliert: + Kompiliert: Compilation : - + @@ -4090,27 +4093,27 @@ Veuillez utiliser l'éditeur avancé pour cela. Editer les marges - + Ränder ändern Haut : - + Oben: Gauche : - + Links: Droit : - + Rechts: Bas : - + Unten: @@ -4751,7 +4754,8 @@ Nummer: %1 Couleur du conducteur : %1 - + +Farbe des Leiters: %1 @@ -4759,7 +4763,8 @@ Couleur du conducteur : %1 Section du conducteur : %1 - + +Querschnitt des Leiters: %1 @@ -4850,12 +4855,12 @@ Folgende Variablen sind inkompatibel: Position - + Position Position du folio - Folienreihenfolge + Position der Folie @@ -4863,17 +4868,17 @@ Folgende Variablen sind inkompatibel: Form - + Requête - + Datenauswahl ändern Recharger - Neu laden + Daten neu laden @@ -4983,22 +4988,22 @@ Voulez-vous enregistrer les modifications ? Nettoyer le projet window title - Projekt reinigen + Projekt bereinigen Ajouter un folio - Neue Folie einfügen + Neue Folie hinzufügen Revenir au debut du projet - + Aller à la fin du projet - + @@ -5032,19 +5037,19 @@ Voulez-vous enregistrer les modifications ? Chargement... Initialisation du cache des collections d'éléments splash screen caption - Lade... Initialisiere die Bauteilsammlungen + Laden... Initialisiere die Bauteilsammlungen Chargement... Éditeur de schéma splash screen caption - Lade... Schaltplaneditor + Laden... Schaltplaneditor Chargement... Ouverture des fichiers splash screen caption - Lade... Öffne Dateien + Laden... Öffne Dateien @@ -5059,12 +5064,12 @@ Voulez-vous enregistrer les modifications ? Couleur du fil - + Drahtfarbe Section du fil - + Drahtabschnitt @@ -5110,7 +5115,7 @@ Voulez-vous enregistrer les modifications ? LTR Translate this string to RTL if you are translating to a Right-to-Left language, else translate to LTR - LTR + LTR @@ -5183,29 +5188,29 @@ Voulez-vous enregistrer les modifications ? Indice de révision - Revisionsindex + Revisionsindex Date - Datum + Datum Position - + Position Cartouches QET title of the title block templates collection provided by QElectroTech - QET-Zeichnungsköpfe + QET-Zeichnungsköpfe Cartouches utilisateur title of the user's title block templates collection - Benutzer-Zeichnungsköpfe + Benutzer-Zeichnungsköpfe @@ -5540,7 +5545,7 @@ Verfügbare Optionen: Ajouter un folio - Neue Folie einfügen + Neue Folie hinzufügen @@ -5550,7 +5555,7 @@ Verfügbare Optionen: Ajouter une nomenclature - + Betriebsmittelverzeichnis einfügen @@ -5695,7 +5700,7 @@ Verfügbare Optionen: Nettoyer le projet - Projekt reinigen + Projekt bereinigen @@ -6021,7 +6026,7 @@ Verfügbare Optionen: Exporter la base de donnée interne du projet - + @@ -6044,12 +6049,12 @@ Verfügbare Optionen: SPACE - + Ctrl+SPACE - + @@ -6211,7 +6216,7 @@ Verfügbare Optionen: Place les éléments du presse-papier sur le folio status bar tip - Fügt den Inhalt der Zwischenablage auf die Folio ein + Inhalt der Zwischenablage auf Folie einfügen @@ -6415,12 +6420,12 @@ Verfügbare Optionen: un fichier - eine Datei + einer Datei un élément - ein Bauteil + einem Bauteil @@ -7255,7 +7260,7 @@ les conditions requises ne sont pas valides Adapter le folio à la page - Passt die Folie an die Blattgröße an + Folie an Blattgröße anpassen @@ -7980,7 +7985,7 @@ Que désirez vous faire ? %n tableau(s) part of a sentence listing the content of diagram - + @@ -8377,7 +8382,7 @@ Que désirez vous faire ? Position du folio - Folienreihenfolge + Position der Folie @@ -8541,7 +8546,7 @@ Möchten Sie sie ersetzen? Chercher/remplacer les propriétés de folio - Folieneigenschaften suchen/ersetzen + Folienneigenschaften suchen/ersetzen @@ -8591,7 +8596,7 @@ Möchten Sie sie ersetzen? Nombre de folio - Folienanzahl + Anzahl der Folien @@ -8651,32 +8656,32 @@ Möchten Sie sie ersetzen? To install the plugin qet_tb_generator<br>Visit :<br><a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a><br><br>Requires python 3.5 or above.<br><br><B><U> First install on Linux</B></U><br>1. check you have pip3 installed: pip3 --version<br>If not install with: sudo apt-get install python3-pip<br>2. Install the program: sudo pip3 install qet_tb_generator<br>3. Run the program: qet_tb_generator<br><br><B><U> Update on Linux</B></U><br>sudo pip3 install --upgrade qet_tb_generator<br> - + Error launching qet_tb_generator plugin - Fehler beim Ausführen vom Plugin qet_tb_generator + Fehler beim Ausführen vom Plugin qet_tb_generator To install the plugin qet_tb_generator<br>Visit :<br><a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a><br><B><U> First install on macOSX</B></U><br>1. Install, if required, python 3.8 bundle only, because program use hardcoded PATH for localise qet-tb-generator plugin <br> Visit :<br><a href='https://qelectrotech.org/forum/viewtopic.php?pid=5674#p5674'>howto</a><br>2. pip3 install qet_tb_generator<br><B><U> Update on macOSX</B></U><br> pip3 install --upgrade qet_tb_generator<br> - + So installieren Sie das Plugin qet_tb_generator <br> Besuchen Sie: <br> <a href='https://pypi.python.org/pypi/qet-tb-generator'> qet-tb-generator </a> <br> < B> <U> Zuerst unter macOSX </ B> </ U> <br> 1 installieren. Installieren Sie bei Bedarf nur das Python 3.8-Bundle, da das Programm den fest codierten PATH zum Lokalisieren des qet-tb-generator-Plugins verwendet. <br> Besuchen Sie: <br> <a href = 'https: //qelectrotech.org/forum/viewtopic.php? pid = 5674 # p5674 '> Howto </a> <br> 2. pip3 install qet_tb_generator <br> <B> <U> Update unter macOSX </ B> </ U> <br> pip3 install - Upgrade qet_tb_generator <br> Ajouter une nomenclature - + Betriebsmittelverzeichnis einfügen Ajouter un sommaire - Inhaltsverzeichnis einfügen + Inhaltsverzeichnis einfügen Coller - + Einfügen @@ -8700,23 +8705,25 @@ Möchten Sie sie ersetzen? Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par les tableaux. Veuillez ajouter un nouveau tableau ou regler les tableaux existant afin d'afficher l'integralité des informations. - + Die anzuzeigenden Informationen sind größer als die maximale Menge, die von den Tabellen angezeigt werden kann. +Bitte fügen Sie eine neue Tabelle hinzu oder passen Sie die vorhandenen Tabellen an, um alle Informationen anzuzeigen. Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par le tableau. Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'afficher l'integralité des informations. - + Die anzuzeigenden Informationen sind größer als die maximale Menge, die von der Tabelle angezeigt werden kann. +Bitte fügen Sie eine neue Tabelle hinzu oder passen Sie die vorhandene Tabelle an, um alle Informationen anzuzeigen. Limitation de tableau - + Tabellenbeschränkung Modifier la géometrie d'un tableau - + Tabellengeometrie ändern @@ -8896,7 +8903,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Texte sur conducteur horizontal : - Text auf waagerechtem Leiter + Text auf waagerechtem Leiter: @@ -8919,7 +8926,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Formule du texte : - Formel vom Text: + Textformel: @@ -8935,7 +8942,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Texte sur conducteur vertical : - Text auf senkrechtem Leiter + Text auf senkrechtem Leiter: @@ -8960,7 +8967,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Couleur du conducteur - Leiterfarbe + Farbe des Leiters @@ -8971,7 +8978,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Section du conducteur - + Leiterabschnitt @@ -9128,7 +9135,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Fichier : - Datei + Datei: @@ -9155,17 +9162,17 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Auteur : - Bearbeiter + Bearbeiter: Date : - Datum + Datum: Installation : - Anlage + Anlage: @@ -9180,7 +9187,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Folio : - Folie + Folie: @@ -9195,7 +9202,7 @@ Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'af Date fixe : - Festes Datum: + Festes Datum: @@ -9216,9 +9223,9 @@ Les variables suivantes sont utilisables : - %autonum : Folio Auto Numeration Für Zeichnungskopf-Vorlagen als %folio verfügbar. Folgende Variablen stehen im Feld Folie zur Verfügung: -%id: aktuelle Foliennummer -%total: gesamte Folienanzahl -%autonum: aktuelle Foliennummer (generiert durch Nummerierungsregel) +%id: Blattnummer der aktuellen Folie im Projekt +%total: Anzahl aller Folien im Projekt +%autonum: Folie lt. Folien-Auto-Nummerierung @@ -9228,7 +9235,7 @@ Folgende Variablen stehen im Feld Folie zur Verfügung: Titre : - Titel + Titel: @@ -9278,7 +9285,7 @@ Créer votre propre texte en vous aidant des variables suivantes : %c : le numéro de colonne Sie können eigene Querverweistexte definieren. Folgende Variablen sind verfügbar: -%f: Reihenfolge der Folie im Projekt +%f: Position der Folie im Projekt %F: Foliennummer %M: Anlage %LM: Ort @@ -9431,7 +9438,7 @@ Folgende Variablen sind verfügbar: Eléments simple - Einfache Bauteile + Einzelbauteile @@ -9620,10 +9627,10 @@ Vorangestellte Nullen werden hinzugefügt falls der Startwert vom Feld "Wer - Der Typ "Text" steht für einen fixen Text. In diesem Fall wird das Feld "Inkrementierung" ignoriert. -- Der Typ "Foliennummer" steht für die Position der Folie im Projekt (Reihenfolge). +- Der Typ "Foliennummer" steht für die Pos-Nr. der Folie im Projekt (Reihenfolge). Andere Felder werden nicht verwendet. -- Der Typ "Folie" steht für die Folienummer. +- Der Typ "Folie" steht für die Nummernangabe in der jeweiligen Folie. Andere Felder werden nicht verwendet. @@ -9932,7 +9939,7 @@ Andere Felder werden nicht verwendet. Pink : MediumVioletRed element part color - + Rosa: Mediumvioletred @@ -11774,7 +11781,7 @@ Andere Felder werden nicht verwendet. Épaisseur : - + Stärke: @@ -11817,27 +11824,27 @@ Andere Felder werden nicht verwendet. Informations disponibles - Verfügbare Informationen + Verfügbare Informationen Information à afficher - + Anzuzeigende Informationen Configuration - Einstellung + Konfiguration Requête SQL : - SQL-Anfrage: + SQL-Abfrage: Position - + Position @@ -12117,9 +12124,9 @@ Les variables suivantes sont utilisables : - %autonum : Folio Auto Numeration Für Zeichnungskopf-Vorlagen als %folio verfügbar. Folgende Variablen stehen im Feld Folie zur Verfügung: -%id: aktuelle Foliennummer -%total: gesamte Folienanzahl -%autonum: aktuelle Foliennummer (generiert durch Nummerierungsregel) +%id: Blattnummer im Projekt +%total: Anzahl aller Blätter im Projekt +%autonum: Folien-Auto-Nummerierung @@ -12154,7 +12161,7 @@ Folgende Variablen stehen im Feld Folie zur Verfügung: Page Num: - Nummerierung: + Auto-Nummerierung: @@ -12337,7 +12344,7 @@ die Variable "volta" kombiniert mit dem Wert "1745" lässt i Par défaut, les variables suivantes sont disponibles :<ul><li>%{author} : auteur du folio</li><li>%{date} : date du folio</li><li>%{title} : titre du folio</li><li>%{filename} : nom de fichier du projet</li><li>%{plant} : nom de l'installation (=) dans laquelle se trouve le folio</li><li>%{locmach} : nom de la localisation (+) dans laquelle se trouve le folio</li><li>%{indexrev} : indice de révision du folio</li><li>%{version} : version du logiciel</li><li>%{folio} : numéro du folio</li><li>%{folio-id} : position du folio dans le projet</li><li>%{folio-total} : nombre total de folios dans le projet</li><li>%{previous-folio-num} : numéro du folio précédent</li><li>%{next-folio-num} : numéro du folio suivant</li><li>%{projecttitle} : titre du projet</li><li>%{projectpath} : chemin du projet</li><li>%{projectfilename} : nom du fichier</li><li>%{saveddate} : date d'enregistrement du fichier</li><li>%{savedtime} : heure d'enregistrement du fichier</li><li>%{savedfilename} : nom du fichier enregistré</li><li>%{savedfilepath} : chemin du fichier enregistré</li></ul> - Standardmäßig sind folgende Variablen verfügbar:<ul><li>%{author}: Bearbeiter</li><li>%{date}: Datum</li><li>%{title}: Folientitel</li><li>%{filename}: Dateiname vom Projekt</li><li>%{plant}: Anlage (=), bezogen auf Folie</li><li>%{locmach}: Ort (+), bezogen auf Folie</li><li>%{indexrev}: Revisionsindex</li><li>%{version}: Softwareversion</li><li>%{folio}: Foliennummer</li><li>%{folio-id}: Position der Folie im Projekt</li><li>%{folio-total}: gesamte Folienanzahl im Projekt</li><li>%{previous-folio-num}: vorherige Foliennummer</li><li>%{next-folio-num}: nächste Foliennummer</li><li>%{projecttitle}: Projekttitel</li><li>%{projectpath}: Pfad zur Projektdatei</li><li>%{projectfilename}: Dateiname</li><li>%{saveddate}: letztes Datum vom Abspeichern des Projekts</li><li>%{savedtime}: letzte Uhrzeit vom Abspeichern des Projekts</li><li>%{savedfilename}: abgespeicherte Dateiname</li><li>%{savedfilepath}: abgespeicherter Pfad zur Datei</li></ul> + Standardmäßig sind folgende Variablen verfügbar:<ul><li>%{author}: Bearbeiter</li><li>%{date}: Datum</li><li>%{title}: Folientitel</li><li>%{filename}: Dateiname vom Projekt</li><li>%{plant}: Anlage (=), bezogen auf Folie</li><li>%{locmach}: Ort (+), bezogen auf Folie</li><li>%{indexrev}: Revisionsindex</li><li>%{version}: Softwareversion</li><li>%{folio}: Foliennummer</li><li>%{folio-id}: Position der Folie im Projekt</li><li>%{folio-total}: Anzahl der Folien im Projekt</li><li>%{previous-folio-num}: vorherige Foliennummer</li><li>%{next-folio-num}: nächste Foliennummer</li><li>%{projecttitle}: Projekttitel</li><li>%{projectpath}: Pfad zur Projektdatei</li><li>%{projectfilename}: Dateiname</li><li>%{saveddate}: letztes Datum vom Abspeichern des Projekts</li><li>%{savedtime}: letzte Uhrzeit vom Abspeichern des Projekts</li><li>%{savedfilename}: abgespeicherte Dateiname</li><li>%{savedfilepath}: abgespeicherter Pfad zur Datei</li></ul> @@ -12899,13 +12906,13 @@ Maximale Länge: %2px Unstable file format! - + <p><b>ATTENTION: This application version is UNSTABLE!</b></p><p>Everything you do with this application can break your workspace, libraries or projects! Saved files will not be readable with stable releases of QElectroTech. It's highly recommended to create a backup before proceeding. If you are unsure, please download an official stable release instead.</p><p>Are you really sure to continue with the risk of breaking your files?!</p> this text is not finished yet, expect changes! - + <p> <b> ACHTUNG: Diese Anwendungsversion ist NICHT STABIL! </ b> </ p> <p> Alles, was Sie mit dieser Anwendung tun, kann Ihren Arbeitsbereich, Ihre Bibliotheken oder Projekte beschädigen! Gespeicherte Dateien können mit stabilen Versionen von QElectroTech nicht gelesen werden. Es wird dringend empfohlen, ein Backup zu erstellen, bevor Sie fortfahren. Wenn Sie sich nicht sicher sind, laden Sie stattdessen eine offizielle stabile Version herunter. </ P> <p> Sind Sie wirklich sicher, dass Sie mit dem Risiko Ihre Dateien zu beschädigen fortfahren wollen?! </ P> @@ -12913,12 +12920,12 @@ Maximale Länge: %2px Exporter la base de données interne du projet - + Interne Projekt-Datenbank exportieren sans_nom - + unbenannt From c7ffae791829735da3fdb15da4f2a7fc4234b7c1 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Mon, 21 Sep 2020 20:23:20 +0200 Subject: [PATCH 25/34] Fix Qt 6 deprecated Qt::SystemLocaleShortDate The format options Qt::SystemLocaleDate, Qt::SystemLocaleShortDate and Qt::SystemLocaleLongDate shall be removed in Qt 6. Their use should be replaced with QLocale::system().toString(date, QLocale::ShortFormat) or QLocale::system().toString(date, QLocale::LongFormat). --- sources/bordertitleblock.cpp | 9 +- sources/dataBase/projectdatabase.cpp | 13 ++- sources/qetproject.cpp | 124 ++++++++++++++------------- 3 files changed, 82 insertions(+), 64 deletions(-) diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index b9f1a4f32..026bab62f 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -17,6 +17,8 @@ */ #include #include +#include + #include "titleblocktemplate.h" #include "titleblocktemplaterenderer.h" #include "bordertitleblock.h" @@ -934,9 +936,12 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock( } // ... overridden by the historical and/or dynamically generated fields + QLocale var; + var.dateFormat(QLocale::ShortFormat); context.addValue("author", btb_author_); - context.addValue("date", btb_date_.toString( - Qt::SystemLocaleShortDate)); + context.addValue( + "date", + QLocale::system().toString(btb_date_, QLocale::ShortFormat)); context.addValue("title", btb_title_); context.addValue("filename", btb_filename_); context.addValue("plant", btb_plant_); diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index ed5d4eebe..290b5684c 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -24,6 +24,7 @@ #include "diagramposition.h" #include +#include #if defined(Q_OS_LINUX) || defined(Q_OS_WINDOWS) #include @@ -161,7 +162,11 @@ void projectDataBase::addDiagram(Diagram *diagram) for (auto key : QETApp::diagramInfoKeys()) { if (key == "date") { - m_insert_diagram_info_query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate)); + m_insert_diagram_info_query.bindValue( + ":date", + QLocale::system().toString( + infos.value("date").toDate(), + QLocale::ShortFormat)); } else { auto value = infos.value(key); auto bind = key.prepend(":"); @@ -419,7 +424,11 @@ void projectDataBase::populateDiagramInfoTable() for (auto key : QETApp::diagramInfoKeys()) { if (key == "date") { - m_insert_diagram_info_query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate)); + m_insert_diagram_info_query.bindValue( + ":date", + QLocale::system().toString( + infos.value("date").toDate(), + QLocale::ShortFormat)); } else { auto value = infos.value(key); auto bind = key.prepend(":"); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index f1599b864..d38a17857 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -279,7 +279,7 @@ void QETProject::setFilePath(const QString &filepath) m_backup_file.setManagedFile(QUrl::fromLocalFile(filepath)); m_file_path = filepath; - + QFileInfo fi(m_file_path); if (fi.isWritable()) { setReadOnly(false); @@ -290,9 +290,9 @@ void QETProject::setFilePath(const QString &filepath) m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm")); m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName()); m_project_properties.addValue("savedfilepath", filePath()); - - - + + + emit(projectFilePathChanged(this, m_file_path)); emit(projectInformationsChanged(this)); updateDiagramsFolioData(); @@ -315,7 +315,7 @@ QString QETProject::currentDir() const } /** - + @return une chaine de caractere du type "Projet titre du projet". Si le projet n'a pas de titre, le nom du fichier est utilise. Si le projet n'est pas associe a un fichier, cette methode retourne "Projet @@ -326,7 +326,7 @@ QString QETProject::currentDir() const QString QETProject::pathNameTitle() const { QString final_title; - + if (!project_title_.isEmpty()) { final_title = QString( tr( @@ -349,7 +349,7 @@ QString QETProject::pathNameTitle() const ) ); } - + if (isReadOnly()) { final_title = QString( tr( @@ -366,7 +366,7 @@ QString QETProject::pathNameTitle() const ) ).arg(final_title); } - + return(final_title); } @@ -394,10 +394,10 @@ qreal QETProject::declaredQElectroTechVersion() void QETProject::setTitle(const QString &title) { // ne fait rien si le projet est en lecture seule if (isReadOnly()) return; - + // ne fait rien si le titre du projet n'est pas change par l'appel de cette methode if (project_title_ == title) return; - + project_title_ = title; emit(projectTitleChanged(this, project_title_)); emit(projectInformationsChanged(this)); @@ -487,7 +487,7 @@ void QETProject::setDefaultReportProperties(const QString &properties) { QString old = m_default_report_properties; m_default_report_properties = properties; - + emit reportPropertiesChanged(old, properties); } @@ -856,7 +856,7 @@ QDomDocument QETProject::toXml() project_root.setAttribute("version", QET::version); project_root.setAttribute("title", project_title_); xml_doc.appendChild(project_root); - + // titleblock templates, if any if (m_titleblocks_collection.templates().count()) { QDomElement titleblocktemplates_elmt = xml_doc.createElement("titleblocktemplates"); @@ -866,19 +866,19 @@ QDomDocument QETProject::toXml() } project_root.appendChild(titleblocktemplates_elmt); } - + // project-wide properties QDomElement project_properties = xml_doc.createElement("properties"); writeProjectPropertiesXml(project_properties); project_root.appendChild(project_properties); - + // Properties for news diagrams QDomElement new_diagrams_properties = xml_doc.createElement("newdiagrams"); writeDefaultPropertiesXml(new_diagrams_properties); project_root.appendChild(new_diagrams_properties); - + // schemas - + qDebug() << "Export XML de" << m_diagrams_list.count() << "schemas"; int order_num = 1; const QList diagrams_list = m_diagrams_list; @@ -895,10 +895,10 @@ QDomDocument QETProject::toXml() QDomNode appended_diagram = project_root.appendChild(xml_node); appended_diagram.toElement().setAttribute("order", order_num ++); } - + // Write the elements collection. project_root.appendChild(m_elements_collection->root().cloneNode(true)); - + return(xml_doc); } @@ -932,16 +932,20 @@ QETResult QETProject::write() QString error_message; if (!QET::writeXmlFile(xml_project, m_file_path, &error_message)) return(error_message); - + //title block variables should be updated after file save dialog is confirmed, before file is saved. - m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate)); + m_project_properties.addValue( + "saveddate", + QDate::currentDate().toString( + QLocale::system().toString( + QLocale::ShortFormat))); m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm")); m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName()); m_project_properties.addValue("savedfilepath", filePath()); - - emit(projectInformationsChanged(this)); - updateDiagramsFolioData(); - + + emit(projectInformationsChanged(this)); + updateDiagramsFolioData(); + setModified(false); return(QETResult()); } @@ -981,15 +985,15 @@ bool QETProject::isEmpty() const { // si le projet a un titre, on considere qu'il n'est pas vide if (!project_title_.isEmpty()) return(false); - + //@TODO check if the embedded element collection is empty - + // compte le nombre de schemas non vides int pertinent_diagrams = 0; foreach(Diagram *diagram, m_diagrams_list) { if (!diagram -> isEmpty()) ++ pertinent_diagrams; } - + return(pertinent_diagrams > 0); } @@ -1089,13 +1093,13 @@ ElementsLocation QETProject::importElement(ElementsLocation &location) Integrate a title block template into this project. @param src_tbt The location of the title block template to be integrated into this project - @param handler + @param handler @return the name of the template after integration, or an empty QString if a problem occurred. */ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation &src_tbt, MoveTitleBlockTemplatesHandler *handler) { TitleBlockTemplateLocation dst_tbt(src_tbt.name(), &m_titleblocks_collection); - + // check whether a TBT having the same name already exists within this project QString target_name = dst_tbt.name(); while (m_titleblocks_collection.templates().contains(target_name)) @@ -1113,7 +1117,7 @@ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation return(target_name); } } - + if (!m_titleblocks_collection.setTemplateXmlDescription(target_name, src_tbt.getTemplateXmlDescription())) { handler -> errorWithATemplate(src_tbt, tr("Une erreur s'est produite durant l'intégration du modèle.", "error message")); @@ -1164,7 +1168,7 @@ QList QETProject::unusedElements() const bool QETProject::usesTitleBlockTemplate(const TitleBlockTemplateLocation &location) { // a diagram can only use a title block template embedded wihtin its parent project if (location.parentProject() != this) return(false); - + foreach (Diagram *diagram, diagrams()) { if (diagram -> usesTitleBlockTemplate(location.name())) { return(true); @@ -1184,9 +1188,9 @@ Diagram *QETProject::addNewDiagram(int pos) if (isReadOnly()) { return(nullptr); } - + Diagram *diagram = new Diagram(this); - + diagram->border_and_titleblock.importBorder(defaultBorderProperties()); diagram->border_and_titleblock.importTitleBlock(defaultTitleBlockProperties()); diagram->defaultConductorProperties = defaultConductorProperties(); @@ -1214,7 +1218,7 @@ void QETProject::removeDiagram(Diagram *diagram) emit(diagramRemoved(this, diagram)); diagram->deleteLater(); } - + updateDiagramsFolioData(); } @@ -1228,10 +1232,10 @@ void QETProject::removeDiagram(Diagram *diagram) */ void QETProject::diagramOrderChanged(int old_index, int new_index) { if (old_index < 0 || new_index < 0) return; - + int diagram_max_index = m_diagrams_list.size() - 1; if (old_index > diagram_max_index || new_index > diagram_max_index) return; - + m_diagrams_list.move(old_index, new_index); updateDiagramsFolioData(); setModified(true); @@ -1258,7 +1262,7 @@ void QETProject::readProjectXml(QDomDocument &xml_project) { QDomElement root_elmt = xml_project.documentElement(); m_state = ProjectParsingRunning; - + //The roots of the xml document must be a "project" element if (root_elmt.tagName() == "project") { @@ -1282,7 +1286,7 @@ void QETProject::readProjectXml(QDomDocument &xml_project) "message box content"), QMessageBox::Open | QMessageBox::Cancel ); - + if (ret == QMessageBox::Cancel) { m_state = FileOpenDiscard; @@ -1296,7 +1300,7 @@ void QETProject::readProjectXml(QDomDocument &xml_project) { m_state = ProjectParsingFailed; } - + m_data_base.blockSignals(true); //Load the project-wide properties readProjectPropertiesXml(xml_project); @@ -1310,7 +1314,7 @@ void QETProject::readProjectXml(QDomDocument &xml_project) readDiagramsXml(xml_project); m_data_base.blockSignals(false); m_data_base.updateDB(); - + m_state = Ok; } @@ -1336,18 +1340,18 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project) "Création des folios" "

")); } - + //Search the diagrams in the project QDomNodeList diagram_nodes = xml_project.elementsByTagName("diagram"); - + if(dlgWaiting) dlgWaiting->setProgressBarRange(0, diagram_nodes.length()*3); - + for (int i = 0 ; i < diagram_nodes.length() ; ++ i) { if(dlgWaiting) dlgWaiting->setProgressBar(i+1); - + if (diagram_nodes.at(i).isElement()) { QDomElement diagram_xml_element = diagram_nodes @@ -1543,17 +1547,17 @@ void QETProject::writeProjectPropertiesXml(QDomElement &xml_element) { void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) { QDomDocument xml_document = xml_element.ownerDocument(); - + // export size of border QDomElement border_elmt = xml_document.createElement("border"); default_border_properties_.toXml(border_elmt); xml_element.appendChild(border_elmt); - + // export content of titleblock QDomElement titleblock_elmt = xml_document.createElement("inset"); default_titleblock_properties_.toXml(titleblock_elmt); xml_element.appendChild(titleblock_elmt); - + // exporte default conductor QDomElement conductor_elmt = xml_document.createElement("conductors"); default_conductor_properties_.toXml(conductor_elmt); @@ -1728,7 +1732,7 @@ bool QETProject::projectWasModified() !m_undo_stack -> isClean() || m_titleblocks_collection.templates().count() ) return(true); - + else return(false); } @@ -1740,19 +1744,19 @@ bool QETProject::projectWasModified() void QETProject::updateDiagramsFolioData() { int total_folio = m_diagrams_list.count(); - + DiagramContext project_wide_properties = m_project_properties; project_wide_properties.addValue("projecttitle", title()); project_wide_properties.addValue("projectpath", filePath()); project_wide_properties.addValue("projectfilename", QFileInfo(filePath()).baseName()); - + for (int i = 0 ; i < total_folio ; ++ i) { QString autopagenum = m_diagrams_list[i]->border_and_titleblock.autoPageNum(); NumerotationContext nC = folioAutoNum(autopagenum); NumerotationContextCommands nCC = NumerotationContextCommands(nC); - - if ((m_diagrams_list[i]->border_and_titleblock.folio().contains("%autonum")) && + + if ((m_diagrams_list[i]->border_and_titleblock.folio().contains("%autonum")) && (!autopagenum.isNull())) { m_diagrams_list[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties); @@ -1761,12 +1765,12 @@ void QETProject::updateDiagramsFolioData() else { m_diagrams_list[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nullptr, project_wide_properties); } - + if (i > 0) { m_diagrams_list.at(i)->border_and_titleblock.setPreviousFolioNum(m_diagrams_list.at(i-1)->border_and_titleblock.finalfolio()); m_diagrams_list.at(i-1)->border_and_titleblock.setNextFolioNum(m_diagrams_list.at(i)->border_and_titleblock.finalfolio()); - + if (i == total_folio-1) { m_diagrams_list.at(i)->border_and_titleblock.setNextFolioNum(QString()); } @@ -1775,7 +1779,7 @@ void QETProject::updateDiagramsFolioData() m_diagrams_list.at(i)->border_and_titleblock.setPreviousFolioNum(QString()); } } - + for (Diagram *d : m_diagrams_list) { d->update(); } @@ -1788,7 +1792,7 @@ void QETProject::updateDiagramsFolioData() */ void QETProject::updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *collection, const QString &template_name) { Q_UNUSED(collection) - + foreach (Diagram *diagram, m_diagrams_list) { diagram -> titleBlockTemplateChanged(template_name); } @@ -1801,7 +1805,7 @@ void QETProject::updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection */ void QETProject::removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *collection, const QString &template_name) { Q_UNUSED(collection) - + // warn diagrams that the given template is about to be removed foreach (Diagram *diagram, m_diagrams_list) { diagram -> titleBlockTemplateRemoved(template_name); From f671a63366b2f73881fa45778d0686418808ea6c Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Mon, 21 Sep 2020 20:37:10 +0200 Subject: [PATCH 26/34] Fix Qt 6 deprecated QVBoxLayout::setMargin Use QVBoxLayout::setContentsMargins instead. --- sources/editor/styleeditor.cpp | 16 ++++++------- sources/elementspanelwidget.cpp | 40 ++++++++++++++++----------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 3103eb46e..b4e767b72 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -200,7 +200,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, line_style -> addItem(tr("Pointillé", "element part line style"), CustomElementGraphicPart::DottedStyle); line_style -> addItem(tr("Traits et points", "element part line style"), CustomElementGraphicPart::DashdottedStyle); //normal_style -> setChecked(true); - + // epaisseur size_weight = new QComboBox(this); size_weight -> addItem(tr("Nulle", "element part weight"), CustomElementGraphicPart::NoneWeight); @@ -374,12 +374,12 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, // antialiasing antialiasing = new QCheckBox(tr("Antialiasing")); - + updateForm(); - + auto main_layout = new QVBoxLayout(); - main_layout -> setMargin(0); - + main_layout -> setContentsMargins(0,0,0,0); + main_layout -> addWidget(new QLabel("" + tr("Apparence :") + " ")); outline_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 0c97f92c7..b1e3a81db 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -48,7 +48,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { // initalise le panel d'elements elements_panel = new ElementsPanel(this); - + // initialise les actions open_directory = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this); copy_path = new QAction(QET::Icons::IC_CopyFile, tr("Copier le chemin"), this); @@ -67,13 +67,13 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this); tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this); - + prj_del_diagram -> setShortcut(QKeySequence(Qt::Key_Delete)); prj_move_diagram_up -> setShortcut(QKeySequence(Qt::Key_F3)); prj_move_diagram_down -> setShortcut(QKeySequence(Qt::Key_F4)); prj_move_diagram_top -> setShortcut(QKeySequence(Qt::Key_F5)); - - + + // initialise le champ de texte pour filtrer avec une disposition horizontale filter_textfield = new QLineEdit(this); filter_textfield -> setClearButtonEnabled(true); @@ -81,7 +81,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { context_menu = new QMenu(this); - + connect(open_directory, SIGNAL(triggered()), this, SLOT(openDirectoryForSelectedItem())); connect(copy_path, SIGNAL(triggered()), this, SLOT(copyPathForSelectedItem())); connect(prj_activate, SIGNAL(triggered()), this, SLOT(activateProject())); @@ -98,9 +98,9 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { connect(tbt_add, SIGNAL(triggered()), this, SLOT(addTitleBlockTemplate())); connect(tbt_edit, SIGNAL(triggered()), this, SLOT(editTitleBlockTemplate())); connect(tbt_remove, SIGNAL(triggered()), this, SLOT(removeTitleBlockTemplate())); - + connect(filter_textfield, SIGNAL(textChanged(const QString &)), this, SLOT(filterEdited(const QString &))); - + connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons())); connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &))); connect(elements_panel, SIGNAL(requestForDiagram(Diagram*)), this, SIGNAL(requestForDiagram(Diagram*))); @@ -110,10 +110,10 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { QETApp::instance(), SLOT(openTitleBlockTemplate(const TitleBlockTemplateLocation &)) ); - + // disposition verticale QVBoxLayout *vlayout = new QVBoxLayout(this); - vlayout -> setMargin(0); + vlayout -> setContentsMargins(0,0,0,0); vlayout -> setSpacing(0); vlayout -> addWidget(filter_textfield); vlayout -> addWidget(elements_panel); @@ -290,7 +290,7 @@ void ElementsPanelWidget::addTitleBlockTemplate() { QTreeWidgetItem *current_item = elements_panel -> currentItem(); if (!current_item) return; - + if (current_item -> type() == QET::TitleBlockTemplatesCollection) { QETApp::instance() -> openTitleBlockTemplate( elements_panel -> templateLocationForItem(current_item) @@ -332,18 +332,18 @@ void ElementsPanelWidget::updateButtons() { QTreeWidgetItem *current_item = elements_panel -> currentItem(); int current_type = elements_panel -> currentItemType(); - + if (current_type == QET::Project) { bool is_writable = !(elements_panel -> selectedProject() -> isReadOnly()); prj_add_diagram -> setEnabled(is_writable); } else if (current_type == QET::Diagram) { Diagram *selected_diagram = elements_panel -> selectedDiagram(); QETProject *selected_diagram_project = selected_diagram -> project(); - + bool is_writable = !(selected_diagram_project -> isReadOnly()); int project_diagrams_count = selected_diagram_project -> diagrams().count(); int diagram_position = selected_diagram_project -> diagrams().indexOf(selected_diagram); - + prj_del_diagram -> setEnabled(is_writable); prj_move_diagram_up -> setEnabled(is_writable && diagram_position > 0); prj_move_diagram_down -> setEnabled(is_writable && diagram_position < project_diagrams_count - 1); @@ -373,17 +373,17 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) { // recupere l'item concerne par l'evenement ainsi que son chemin QTreeWidgetItem *item = elements_panel -> itemAt(pos); if (!item) return; - + updateButtons(); context_menu -> clear(); - + QString dir_path = elements_panel -> dirPathForItem(item); if (!dir_path.isEmpty()) { context_menu -> addAction(open_directory); context_menu -> addAction(copy_path); context_menu -> addSeparator(); } - + switch(item -> type()) { case QET::Project: context_menu -> addAction(prj_activate); @@ -408,7 +408,7 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) { context_menu -> addAction(tbt_remove); break; } - + // affiche le menu if (!context_menu -> isEmpty()) { context_menu -> popup(mapToGlobal(elements_panel -> mapTo(this, pos + QPoint(2, 2)))); From a917399950d9f48579c27979b8126ff9dccebe2d Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Mon, 21 Sep 2020 20:42:40 +0200 Subject: [PATCH 27/34] Fix Qt 6 deprecated QComboBox::AdjustToMinimumContentsLength Use - QComboBox::AdjustToContents - QComboBox::AdjustToContentsOnFirstShow instead. --- sources/editor/styleeditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index b4e767b72..121cbfba1 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -382,8 +382,8 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, main_layout -> addWidget(new QLabel("" + tr("Apparence :") + " ")); - outline_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); - filling_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + outline_color->setSizeAdjustPolicy(QComboBox::AdjustToContents); + filling_color->setSizeAdjustPolicy(QComboBox::AdjustToContents); auto grid_layout = new QGridLayout(this); grid_layout->addWidget(new QLabel(tr("Contour :")), 0,0, Qt::AlignRight); grid_layout->addWidget(outline_color, 0, 1); From c958d54d01a7967d84e61876be5e4cdfdb3c194c Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Mon, 21 Sep 2020 21:16:05 +0200 Subject: [PATCH 28/34] Fix Qt 6 deprecated QDockWidget::AllDockWidgetFeatures (Deprecated) The dock widget can be closed, moved, and floated. Since new features might be added in future releases, the look and behavior of dock widgets might change if you use this flag. Please specify individual flags instead. --- sources/editor/qetelementeditor.cpp | 37 +++-- sources/qetdiagrameditor.cpp | 190 ++++++++++++----------- sources/titleblock/qettemplateeditor.cpp | 126 ++++++++------- 3 files changed, 190 insertions(+), 163 deletions(-) diff --git a/sources/editor/qetelementeditor.cpp b/sources/editor/qetelementeditor.cpp index 58ca30be7..846123c09 100644 --- a/sources/editor/qetelementeditor.cpp +++ b/sources/editor/qetelementeditor.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -83,7 +83,7 @@ QETElementEditor::QETElementEditor(QWidget *parent) : // la fenetre est maximisee par defaut setMinimumSize(QSize(500, 350)); setWindowState(Qt::WindowMaximized); - + // lecture des parametres readSettings(); slot_updateMenus(); @@ -165,7 +165,7 @@ void QETElementEditor::setupActions() open_dxf -> setStatusTip(tr("To install the plugin DXFtoQET\nVisit https://download.tuxfamily.org/qet/builds/dxf_to_elmt/\n" "\n" ">> Install on Windows\n" - "Put DXFtoQET.exe binary on C:\\Users\\user_name\\AppData\\Roaming\\qet\\ directory \n" + "Put DXFtoQET.exe binary on C:\\Users\\user_name\\AppData\\Roaming\\qet\\ directory \n" )); #elif defined(Q_OS_MAC) open_dxf -> setStatusTip(tr("To install the plugin DXFtoQET\nVisit https://download.tuxfamily.org/qet/builds/dxf_to_elmt/\n" @@ -188,7 +188,7 @@ void QETElementEditor::setupActions() "Put DXFtoQET binary on your /home/user_name/.qet/ directory\n" "make it executable : chmod +x ./DXFtoQET\n" ">> Install on Windows\n" - "Put DXFtoQET.exe binary on C:\\Users\\user_name\\AppData\\Roaming\\qet\\ directory \n" + "Put DXFtoQET.exe binary on C:\\Users\\user_name\\AppData\\Roaming\\qet\\ directory \n" "\n" ">> Install on macOSX\n" "Put DXFtoQET.app binary on /Users/user_name/.qet/ directory \n" @@ -491,7 +491,7 @@ void QETElementEditor::slot_updateMenus() // actions dependant du contenu du presse-papiers paste -> setEnabled(clipboard_elmt); paste_in_area -> setEnabled(clipboard_elmt); - + // actions dependant de l'etat de la pile d'annulation save -> setEnabled(!read_only && !m_elmt_scene -> undoStack().isClean()); undo -> setEnabled(!read_only && m_elmt_scene -> undoStack().canUndo()); @@ -534,7 +534,7 @@ void QETElementEditor::setupInterface() // m_tools_dock_scroll_area = new QScrollArea(); // m_tools_dock_scroll_area -> setFrameStyle(QFrame::NoFrame); // m_tools_dock_scroll_area -> setAlignment(Qt::AlignHCenter|Qt::AlignTop); - + // Pile de widgets pour accueillir les deux widgets precedents m_tools_dock_stack = new QStackedWidget(); m_tools_dock_stack -> insertWidget(0, m_default_informations); @@ -555,7 +555,10 @@ void QETElementEditor::setupInterface() m_tools_dock = new QDockWidget(tr("Informations", "dock title"), this); m_tools_dock -> setObjectName("informations"); m_tools_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - m_tools_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures); + m_tools_dock -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); //m_tools_dock -> setMinimumWidth(380); addDockWidget(Qt::RightDockWidgetArea, m_tools_dock); m_tools_dock -> setWidget(m_tools_dock_stack); @@ -564,7 +567,10 @@ void QETElementEditor::setupInterface() m_undo_dock = new QDockWidget(tr("Annulations", "dock title"), this); m_undo_dock -> setObjectName("undo"); m_undo_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - m_undo_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures); + m_undo_dock -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); m_undo_dock -> setMinimumWidth(290); addDockWidget(Qt::RightDockWidgetArea, m_undo_dock); QUndoView* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this); @@ -582,7 +588,10 @@ void QETElementEditor::setupInterface() m_parts_dock = new QDockWidget(tr("Parties", "dock title"), this); m_parts_dock -> setObjectName("parts_list"); m_parts_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - m_parts_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures); + m_parts_dock -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); m_parts_dock -> setMinimumWidth(290); tabifyDockWidget(m_undo_dock, m_parts_dock); m_parts_dock -> setWidget(m_parts_list); @@ -1126,10 +1135,10 @@ void QETElementEditor::slot_openFile() { // repertoire a afficher initialement dans le dialogue QString open_dir = filename_.isEmpty() ? QETApp::customElementsDir() : QDir(filename_).absolutePath(); - + // demande un nom de fichier a ouvrir a l'utilisateur QString user_filename = QETElementEditor::getOpenElementFileName(this, open_dir); - + // ouvre l'element openElement(user_filename); } @@ -1445,7 +1454,7 @@ void QETElementEditor::slot_createPartsList() m_parts_list -> blockSignals(true); m_parts_list -> clear(); QList qgis = m_elmt_scene -> zItems(); - + // on ne construit plus la liste a partir de 200 primitives // c'est ingerable : la maj de la liste prend trop de temps et le resultat // est inexploitable diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 7e0c0ccf6..f844e0fb2 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -60,7 +60,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : open_dialog_dir (QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) { activeSubWindowIndex = 0; - + QSplitter *splitter_ = new QSplitter(this); splitter_->setChildrenCollapsible(false); splitter_->setOrientation(Qt::Vertical); @@ -77,19 +77,19 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : anim->setObjectName("search and replace animator"); m_search_and_replace_widget.setHidden(true); anim->setLastShowSize(m_search_and_replace_widget.minimumSizeHint().height()); - + //Set object name to be retrieved by the stylesheets m_workspace.setBackground(QBrush(Qt::NoBrush)); m_workspace.setObjectName("mdiarea"); m_workspace.setTabsClosable(true); - + //Set the signal mapper connect(&windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(activateWidget(QWidget *))); - - setWindowTitle(tr("QElectroTech", "window title")); + + setWindowTitle(tr("QElectroTech", "window title")); setWindowIcon(QET::Icons::QETLogo); statusBar() -> showMessage(tr("QElectroTech", "status bar message")); - + setUpElementsPanel(); setUpElementsCollectionWidget(); setUpUndoStack(); @@ -101,11 +101,11 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : setUpMenu(); tabifyDockWidget(qdw_undo, qdw_pa); - + //By default the windows is maximised setMinimumSize(QSize(500, 350)); setWindowState(Qt::WindowMaximized); - + connect (&m_workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, @@ -117,7 +117,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : readSettings(); show(); - + //If valid file path is given as arguments uint opened_projects = 0; if (files.count()) @@ -149,7 +149,10 @@ void QETDiagramEditor::setUpElementsPanel() qdw_pa -> setObjectName ("projects panel"); qdw_pa -> setAllowedAreas (Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - qdw_pa -> setFeatures (QDockWidget::AllDockWidgetFeatures); + qdw_pa -> setFeatures ( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); qdw_pa -> setMinimumWidth (160); qdw_pa -> setWidget (pa = new ElementsPanelWidget(qdw_pa)); @@ -179,7 +182,10 @@ void QETDiagramEditor::setUpElementsCollectionWidget() m_qdw_elmt_collection = new QDockWidget(tr("Collections"), this); m_qdw_elmt_collection->setObjectName("elements_collection_widget"); m_qdw_elmt_collection->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - m_qdw_elmt_collection->setFeatures(QDockWidget::AllDockWidgetFeatures); + m_qdw_elmt_collection->setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); m_element_collection_widget = new ElementsCollectionWidget(m_qdw_elmt_collection); m_qdw_elmt_collection->setWidget(m_element_collection_widget); @@ -205,7 +211,10 @@ void QETDiagramEditor::setUpUndoStack() qdw_undo -> setObjectName("diagram_undo"); qdw_undo -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - qdw_undo -> setFeatures(QDockWidget::AllDockWidgetFeatures); + qdw_undo -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); qdw_undo -> setMinimumWidth(160); qdw_undo -> setWidget(undo_view); @@ -231,7 +240,10 @@ void QETDiagramEditor::setUpAutonumberingWidget() { m_autonumbering_dock = new AutoNumberingDockWidget(this); m_autonumbering_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - m_autonumbering_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures); + m_autonumbering_dock -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); addDockWidget(Qt::RightDockWidgetArea, m_autonumbering_dock); } @@ -251,7 +263,7 @@ void QETDiagramEditor::setUpActions() current_project -> exportProject(); } }); - + //Print m_print = new QAction(QET::Icons::DocumentPrint, tr("Imprimer"), this); m_print->setShortcut(QKeySequence(QKeySequence::Print)); @@ -262,7 +274,7 @@ void QETDiagramEditor::setUpActions() current_project -> printProject(); } }); - + //Quit editor m_quit_editor = new QAction(QET::Icons::ApplicationExit, tr("&Quitter"), this); m_quit_editor->setShortcut(QKeySequence(tr("Ctrl+Q"))); @@ -314,7 +326,7 @@ void QETDiagramEditor::setUpActions() if (DiagramView *dv = currentDiagramView()) dv->resetConductors(); }); - + //AutoConductor m_auto_conductor = new QAction (QET::Icons::Autoconnect, tr("Création automatique de conducteur(s)","Tool tip of auto conductor"), this); m_auto_conductor->setStatusTip (tr("Utiliser la création automatique de conducteur(s) quand cela est possible", "Status tip of auto conductor")); @@ -358,13 +370,13 @@ void QETDiagramEditor::setUpActions() project_view->editCurrentDiagramProperties(); } }); - + //Edit current project properties m_project_edit_properties = new QAction(QET::Icons::ProjectProperties, tr("Propriétés du projet"), this); connect(m_project_edit_properties, &QAction::triggered, [this]() { editProjectProperties(currentProjectView()); }); - + //Add new folio to current project m_project_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this); m_project_add_diagram->setShortcut(QKeySequence(tr("Ctrl+T"))); @@ -373,11 +385,11 @@ void QETDiagramEditor::setUpActions() current_project->project()->addNewDiagram(); } }); - + //Remove current folio from current project m_remove_diagram_from_project = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le folio"), this); connect(m_remove_diagram_from_project, &QAction::triggered, this, &QETDiagramEditor::removeDiagramFromProject); - + //Clean the current project m_clean_project = new QAction(QET::Icons::EditClear, tr("Nettoyer le projet"), this); connect(m_clean_project, &QAction::triggered, [this]() { @@ -394,7 +406,7 @@ void QETDiagramEditor::setUpActions() BOMExportDialog bom(currentProjectView()->project(), this); bom.exec(); }); - + //Add a nomenclature item m_add_nomenclature = new QAction(QET::Icons::TableOfContent, tr("Ajouter une nomenclature"), this); connect(m_add_nomenclature, &QAction::triggered, [this]() { @@ -430,27 +442,27 @@ void QETDiagramEditor::setUpActions() connect(m_export_project_db, &QAction::triggered, [this]() { projectDataBase::exportDb(this->currentProject()->dataBase(), this); }); - + //MDI view style m_tabbed_view_mode = new QAction(tr("en utilisant des onglets"), this); m_tabbed_view_mode->setStatusTip(tr("Présente les différents projets ouverts des onglets", "status bar tip")); m_tabbed_view_mode->setCheckable(true); connect(m_tabbed_view_mode, &QAction::triggered, this, &QETDiagramEditor::setTabbedMode); - + m_windowed_view_mode = new QAction(tr("en utilisant des fenêtres"), this); m_windowed_view_mode->setStatusTip(tr("Présente les différents projets ouverts dans des sous-fenêtres", "status bar tip")); m_windowed_view_mode->setCheckable(true); connect(m_windowed_view_mode, &QAction::triggered, this, &QETDiagramEditor::setWindowedMode); - + m_group_view_mode = new QActionGroup(this); m_group_view_mode -> addAction(m_windowed_view_mode); m_group_view_mode -> addAction(m_tabbed_view_mode); m_group_view_mode -> setExclusive(true); - + m_tile_window = new QAction(tr("&Mosaïque"), this); m_tile_window->setStatusTip(tr("Dispose les fenêtres en mosaïque", "status bar tip")); connect(m_tile_window, &QAction::triggered, &m_workspace, &QMdiArea::tileSubWindows); - + m_cascade_window = new QAction(tr("&Cascade"), this); m_cascade_window->setStatusTip(tr("Dispose les fenêtres en cascade", "status bar tip")); connect(m_cascade_window, &QAction::triggered, &m_workspace, &QMdiArea::cascadeSubWindows); @@ -467,7 +479,7 @@ void QETDiagramEditor::setUpActions() } } }); - + m_mode_visualise = new QAction(QET::Icons::ViewMove, tr("Mode Visualisation"), this); m_mode_visualise->setStatusTip(tr("Permet de visualiser le folio sans pouvoir le modifier", "status bar tip")); m_mode_visualise->setCheckable(true); @@ -489,7 +501,7 @@ void QETDiagramEditor::setUpActions() m_next_window->setShortcut(QKeySequence::NextChild); m_next_window->setStatusTip(tr("Active le projet suivant", "status bar tip")); connect(m_next_window, &QAction::triggered, &m_workspace, &QMdiArea::activateNextSubWindow); - + m_previous_window = new QAction(tr("Projet précédent"), this); m_previous_window->setShortcut(QKeySequence::PreviousChild); m_previous_window->setStatusTip(tr("Active le projet précédent", "status bar tip")); @@ -645,11 +657,11 @@ void QETDiagramEditor::setUpActions() //Depth action m_depth_action_group = QET::depthActionGroup(this); m_depth_action_group->setDisabled(true); - + connect(m_depth_action_group, &QActionGroup::triggered, [this](QAction *action) { this->currentDiagramView()->diagram()->changeZValue(action->data().value()); }); - + m_find = new QAction(tr("Chercher/remplacer"), this); m_find->setShortcut(QKeySequence::Find); connect(m_find, &QAction::triggered, [this]() @@ -705,7 +717,7 @@ void QETDiagramEditor::setUpToolBar() m_add_item_tool_bar = new QToolBar(tr("Ajouter"), this); m_add_item_tool_bar->setObjectName("adding"); m_add_item_tool_bar->addActions(m_add_item_actions_group.actions()); - + m_depth_tool_bar = new QToolBar(tr("Profondeur", "toolbar title")); m_depth_tool_bar->setObjectName("diagram_depth_toolbar"); m_depth_tool_bar->addActions(m_depth_action_group->actions()); @@ -792,7 +804,7 @@ void QETDiagramEditor::setUpMenu() diagram_tool_bar -> toggleViewAction() -> setStatusTip(tr("Affiche ou non la barre d'outils Schéma")); qdw_pa -> toggleViewAction() -> setStatusTip(tr("Affiche ou non le panel d'appareils")); qdw_undo -> toggleViewAction() -> setStatusTip(tr("Affiche ou non la liste des modifications")); - + // menu Affichage QMenu *projects_view_mode = menu_affichage -> addMenu(QET::Icons::ConfigureToolbars, tr("Afficher les projets")); @@ -848,7 +860,7 @@ void QETDiagramEditor::closeEvent(QCloseEvent *qce) Reimplemented to : -Load elements collection when WindowActivate. @param e - @return + @return */ bool QETDiagramEditor::event(QEvent *e) { @@ -916,10 +928,10 @@ void QETDiagramEditor::saveAs() bool QETDiagramEditor::newProject() { auto new_project = new QETProject(this); - + // add new diagram new_project -> addNewDiagram(); - + return addProject(new_project); } @@ -952,10 +964,10 @@ bool QETDiagramEditor::openProject() tr("Projets QElectroTech (*.qet);;Fichiers XML (*.xml);;Tous les fichiers (*)") ); if (filepath.isEmpty()) return(false); - + // retient le dossier contenant le dernier projet ouvert open_dialog_dir = QDir(filepath); - + // ouvre le fichier return(openAndAddProject(filepath)); } @@ -1002,7 +1014,7 @@ bool QETDiagramEditor::openAndAddProject( bool interactive) { if (filepath.isEmpty()) return(false); - + QFileInfo filepath_info(filepath); //Check if project is not open in another editor @@ -1024,7 +1036,7 @@ bool QETDiagramEditor::openAndAddProject( return(diagram_editor -> openAndAddProject(filepath)); } } - + // check the file exists if (!filepath_info.exists()) { @@ -1056,7 +1068,7 @@ bool QETDiagramEditor::openAndAddProject( } return(false); } - + //Check if file is read only if (!filepath_info.isWritable()) { @@ -1070,10 +1082,10 @@ bool QETDiagramEditor::openAndAddProject( ); } } - + //Create the project DialogWaiting::instance(this); - + QETProject *project = new QETProject(filepath); if (project -> state() != QETProject::Ok) { @@ -1120,14 +1132,14 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) undo_group.addStack(project -> undoStack()); m_element_collection_widget->addProject(project); - + // met a jour le panel d'elements if (update_panel) { pa -> elementsPanel().projectWasOpened(project); if (currentDiagramView() != nullptr) m_autonumbering_dock->setProject(project, project_view); } - + return(true); } @@ -1154,10 +1166,10 @@ ProjectView *QETDiagramEditor::currentProjectView() const { QMdiSubWindow *current_window = m_workspace.activeSubWindow(); if (!current_window) return(nullptr); - + QWidget *current_widget = current_window -> widget(); if (!current_widget) return(nullptr); - + if (ProjectView *project_view = qobject_cast(current_widget)) { return(project_view); } @@ -1203,11 +1215,11 @@ Element *QETDiagramEditor::currentElement() const DiagramView *dv = currentDiagramView(); if (!dv) return(nullptr); - + QList selected_elements = DiagramContent(dv->diagram()).m_elements; if (selected_elements.count() != 1) return(nullptr); - + return(selected_elements.first()); } @@ -1426,7 +1438,7 @@ void QETDiagramEditor::selectionGroupTriggered(QAction *action) QList deti_list = dc.m_element_texts.values(); if(deti_list.size() <= 1) return; - + diagram->undoStack().push(new AddTextsGroupCommand(deti_list.first()->parentElement(), tr("Groupe"), deti_list)); } } @@ -1441,7 +1453,7 @@ void QETDiagramEditor::rowColumnGroupTriggered(QAction *action) Diagram *d = dv->diagram(); BorderProperties old_bp = d->border_and_titleblock.exportBorder(); BorderProperties new_bp = d->border_and_titleblock.exportBorder(); - + if (value == "add_column") new_bp.columns_count += 1; else if (value == "remove_column") @@ -1450,7 +1462,7 @@ void QETDiagramEditor::rowColumnGroupTriggered(QAction *action) new_bp.rows_count += 1; else if (value == "remove_row") new_bp.rows_count -= 1; - + d->undoStack().push(new ChangeBorderCommand(d, old_bp, new_bp)); } @@ -1542,23 +1554,23 @@ void QETDiagramEditor::slot_updateComplexActions() << m_group_selected_texts; for(QAction *action : action_list) action->setEnabled(false); - + return; } - + Diagram *diagram_ = dv->diagram(); DiagramContent dc(diagram_); bool ro = diagram_->isReadOnly(); - + //Number of selected conductors int selected_conductors_count = diagram_->selectedConductors().count(); m_conductor_reset->setEnabled(!ro && selected_conductors_count); - + // number of selected elements 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 bool copiable_items = dc.hasCopiableItems(); bool deletable_items = dc.hasDeletableItems(); @@ -1584,7 +1596,7 @@ void QETDiagramEditor::slot_updateComplexActions() selected_dynamic_elmt_text++; } m_rotate_texts->setEnabled(!ro && (selected_texts || groups.size())); - + //Action that need only element text selected QList deti_list = dc.m_element_texts.values(); if(deti_list.size() > 1 && dc.count() == deti_list.count()) @@ -1653,7 +1665,7 @@ void QETDiagramEditor::slot_updateComplexActions() m_edit_selection -> setIcon(QET::Icons::ElementEdit); m_edit_selection -> setEnabled(false); } - + //Actions for edit Z value QList list = dc.items( DiagramContent::SelectedOnly @@ -1670,7 +1682,7 @@ void QETDiagramEditor::slot_updateComplexActions() void QETDiagramEditor::slot_updateModeActions() { DiagramView *dv = currentDiagramView(); - + if (!dv) grp_visu_sel -> setEnabled(false); else @@ -1708,7 +1720,7 @@ void QETDiagramEditor::slot_updatePasteAction() { DiagramView *dv = currentDiagramView(); bool editable_diagram = (dv && !dv -> diagram() -> isReadOnly()); - + // pour coller, il faut un schema ouvert et un schema dans le presse-papier m_paste -> setEnabled(editable_diagram && Diagram::clipboardMayContainDiagram()); } @@ -1725,7 +1737,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) foreach(DiagramView *dv, project_view -> diagram_views()) diagramWasAdded(dv); - + //Manage the close event of project connect(project_view, SIGNAL(projectClosed(ProjectView*)), this, SLOT(projectWasClosed(ProjectView *))); @@ -1736,13 +1748,13 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) if (QETProject *project = project_view -> project()) connect(project, SIGNAL(readOnlyChanged(QETProject *, bool)), this, SLOT(slot_updateActions())); - + //Manage request for edit or find element and titleblock connect (project_view, &ProjectView::findElementRequired, this, &QETDiagramEditor::findElementInPanel); connect (project_view, &ProjectView::editElementRequired, this, &QETDiagramEditor::editElementInEditor); - + // display error messages sent by the project view connect(project_view, SIGNAL(errorEncountered(QString)), this, SLOT(showError(const QString &))); @@ -1757,7 +1769,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) QMdiSubWindow *sub_window = m_workspace.addSubWindow(project_view); sub_window -> setWindowIcon(project_view -> windowIcon()); sub_window -> systemMenu() -> clear(); - + //By defaut QMdiSubWindow have a QAction "close" with shortcut QKeySequence::Close //But the QAction m_close_file of this class have the same shortcut too. //We remove the shortcut of the QAction of QMdiSubWindow for avoid conflic @@ -1796,7 +1808,7 @@ QList QETDiagramEditor::editedFiles() const ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const { if (filepath.isEmpty()) return(nullptr); - + QString searched_can_file_path = QFileInfo(filepath).canonicalFilePath(); if (searched_can_file_path.isEmpty()) { // QFileInfo returns an empty path for non-existent files @@ -1858,29 +1870,29 @@ void QETDiagramEditor::slot_updateWindowsMenu() { // nettoyage du menu foreach(QAction *a, windows_menu -> actions()) windows_menu -> removeAction(a); - + // actions de fermeture windows_menu -> addAction(m_close_file); //windows_menu -> addAction(closeAllAct); - + // actions de reorganisation des fenetres windows_menu -> addSeparator(); windows_menu -> addAction(m_tile_window); windows_menu -> addAction(m_cascade_window); - + // actions de deplacement entre les fenetres windows_menu -> addSeparator(); windows_menu -> addAction(m_next_window); windows_menu -> addAction(m_previous_window); - + // liste des fenetres QList windows = openedProjects(); - + m_tile_window -> setEnabled(!windows.isEmpty() && m_workspace.viewMode() == QMdiArea::SubWindowView); m_cascade_window -> setEnabled(!windows.isEmpty() && m_workspace.viewMode() == QMdiArea::SubWindowView); m_next_window -> setEnabled(windows.count() > 1); m_previous_window -> setEnabled(windows.count() > 1); - + if (!windows.isEmpty()) windows_menu -> addSeparator(); QActionGroup *windows_actions = new QActionGroup(this); foreach(ProjectView *project_view, windows) { @@ -1946,15 +1958,15 @@ void QETDiagramEditor::setTabbedMode() void QETDiagramEditor::readSettings() { QSettings settings; - + // dimensions et position de la fenetre QVariant geometry = settings.value("diagrameditor/geometry"); if (geometry.isValid()) restoreGeometry(geometry.toByteArray()); - + // etat de la fenetre (barres d'outils, docks...) QVariant state = settings.value("diagrameditor/state"); if (state.isValid()) restoreState(state.toByteArray()); - + // gestion des projets (onglets ou fenetres) bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed"; if (tabbed) { @@ -2018,7 +2030,7 @@ void QETDiagramEditor::activateProject(ProjectView *project_view) void QETDiagramEditor::projectWasClosed(ProjectView *project_view) { QETProject *project = project_view -> project(); - if (project) + if (project) { pa -> elementsPanel().projectWasClosed(project); m_element_collection_widget->removeProject(project); @@ -2064,7 +2076,7 @@ void QETDiagramEditor::addDiagramToProject(QETProject *project) if (!project) { return; } - + if (ProjectView *project_view = findProject(project)) { activateProject(project); @@ -2079,15 +2091,15 @@ void QETDiagramEditor::addDiagramToProject(QETProject *project) void QETDiagramEditor::removeDiagram(Diagram *diagram) { if (!diagram) return; - + // recupere le projet contenant le schema if (QETProject *diagram_project = diagram -> project()) { // recupere la vue sur ce projet if (ProjectView *project_view = findProject(diagram_project)) { - + // affiche le schema en question project_view -> showDiagram(diagram); - + // supprime le schema project_view -> removeDiagram(diagram); } @@ -2102,11 +2114,11 @@ void QETDiagramEditor::removeDiagram(Diagram *diagram) void QETDiagramEditor::moveDiagramUp(Diagram *diagram) { if (!diagram) return; - + // recupere le projet contenant le schema if (QETProject *diagram_project = diagram -> project()) { if (diagram_project -> isReadOnly()) return; - + // recupere la vue sur ce projet if (ProjectView *project_view = findProject(diagram_project)) { project_view -> moveDiagramUp(diagram); @@ -2122,11 +2134,11 @@ void QETDiagramEditor::moveDiagramUp(Diagram *diagram) void QETDiagramEditor::moveDiagramDown(Diagram *diagram) { if (!diagram) return; - + // recupere le projet contenant le schema if (QETProject *diagram_project = diagram -> project()) { if (diagram_project -> isReadOnly()) return; - + // recupere la vue sur ce projet if (ProjectView *project_view = findProject(diagram_project)) { project_view -> moveDiagramDown(diagram); @@ -2313,7 +2325,7 @@ void QETDiagramEditor::generateTerminalBlock() { bool success; QProcess *process = new QProcess(qApp); - + // If launched under control: //connect(process, SIGNAL(errorOcurred(int error)), this, SLOT(slot_generateTerminalBlock_error())); //process->start("qet_tb_generator"); @@ -2351,7 +2363,7 @@ void QETDiagramEditor::generateTerminalBlock() else { success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator.app", {("")}); } - + #else if (openedProjects().count()){ success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); @@ -2365,7 +2377,7 @@ void QETDiagramEditor::generateTerminalBlock() else { success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator", {("")}); } - + #endif #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) QString message=QObject::tr( diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index f6cb218cd..2a3d48146 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -40,7 +40,7 @@ QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor(QWidget *parent) : { setWindowIcon(QET::Icons::QETLogo); setAttribute(Qt::WA_DeleteOnClose); - + initWidgets(); initActions(); initMenus(); @@ -74,7 +74,7 @@ bool QETTitleBlockTemplateEditor::isEditing(const QString &filepath) } else { current_filepath = QETApp::realPath(location_.toString()); } - + return( QET::compareCanonicalFilePaths( current_filepath, @@ -166,7 +166,7 @@ void QETTitleBlockTemplateEditor::duplicateCurrentLocation() { // this method does not work for templates edited from the filesystem if (opened_from_file_) return; - + QString proposed_name; if (location_.name().isEmpty()) { proposed_name = tr("nouveau_modele", @@ -174,7 +174,7 @@ void QETTitleBlockTemplateEditor::duplicateCurrentLocation() } else { proposed_name = QString("%1_copy").arg(location_.name()); } - + bool accepted = false; QString new_template_name = QInputDialog::getText( this, @@ -212,7 +212,7 @@ bool QETTitleBlockTemplateEditor::edit( /// TODO The TBT does not exist, manage error return(false); } - + opened_from_file_ = false; location_ = location; setReadOnly(location.isReadOnly()); @@ -231,7 +231,7 @@ bool QETTitleBlockTemplateEditor::edit( { // we require a project we will rattach templates to if (!project) return(false); - + // the template name may be empty to create a new one const TitleBlockTemplate *tb_template_orig; if (template_name.isEmpty()) @@ -244,12 +244,12 @@ bool QETTitleBlockTemplateEditor::edit( { tb_template_orig = project->embeddedTitleBlockTemplatesCollection()->getTemplate(template_name); } - + if (!tb_template_orig) { /// TODO The TBT does not exist, manage error return(false); } - + opened_from_file_ = false; location_.setParentCollection(project -> embeddedTitleBlockTemplatesCollection()); location_.setName(template_name); @@ -270,13 +270,13 @@ bool QETTitleBlockTemplateEditor::edit(const QString &file_path) /// TODO the file opening failed, warn the user? return(false); } - + bool editing = edit(tbt); if (!editing) { /// TODO the file editing failed, warn the user? return(false); } - + QFileInfo file_path_info(file_path); filepath_ = file_path; opened_from_file_ = true; @@ -318,20 +318,20 @@ void QETTitleBlockTemplateEditor::editLogos() if (!logo_manager_) { initLogoManager(); } - + logo_manager_ -> layout() -> setContentsMargins(0, 0, 0, 0); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close); - + QVBoxLayout *vlayout0 = new QVBoxLayout(); vlayout0 -> addWidget(logo_manager_); vlayout0 -> addWidget(buttons); - + QDialog d(this); d.setWindowTitle(logo_manager_ -> windowTitle()); d.setLayout(vlayout0); connect(buttons, SIGNAL(rejected()), &d, SLOT(reject())); d.exec(); - + // prevent the logo manager from being deleted along with the dialog logo_manager_ -> setParent(this); } @@ -374,10 +374,10 @@ void QETTitleBlockTemplateEditor::initActions() add_col_ = new QAction(QET::Icons::EditTableInsertColumnRight, tr("Ajouter une &colonne", "menu entry"), this); merge_cells_ = new QAction(QET::Icons::EditTableCellMerge, tr("&Fusionner les cellules", "menu entry"), this); split_cell_ = new QAction(QET::Icons::EditTableCellSplit, tr("&Séparer les cellules", "menu entry"), this); - + undo_ -> setIcon(QET::Icons::EditUndo); redo_ -> setIcon(QET::Icons::EditRedo); - + new_ -> setShortcut(QKeySequence::New); open_ -> setShortcut(QKeySequence::Open); open_from_file_ -> setShortcut(tr("Ctrl+Shift+O", "shortcut to open a template from a file")); @@ -397,7 +397,7 @@ void QETTitleBlockTemplateEditor::initActions() zoom_out_ -> setShortcut(QKeySequence::ZoomOut); zoom_fit_ -> setShortcut(QKeySequence(tr("Ctrl+9", "shortcut to enable fit zoom"))); zoom_reset_ -> setShortcut(QKeySequence(tr("Ctrl+0", "shortcut to reset zoom"))); - + connect(new_, SIGNAL(triggered()), this, SLOT(newTemplate())); connect(open_, SIGNAL(triggered()), this, SLOT(open())); connect(open_from_file_, SIGNAL(triggered()), this, SLOT(openFromFile())); @@ -428,7 +428,7 @@ void QETTitleBlockTemplateEditor::initMenus() file_menu_ = new QMenu(tr("&Fichier", "menu title"), this); edit_menu_ = new QMenu(tr("&Édition", "menu title"), this); display_menu_ = new QMenu(tr("Afficha&ge", "menu title"), this); - + file_menu_ -> addAction(new_); file_menu_ -> addAction(open_); file_menu_ -> addAction(open_from_file_); @@ -437,7 +437,7 @@ void QETTitleBlockTemplateEditor::initMenus() file_menu_ -> addAction(save_as_file_); file_menu_ -> addSeparator(); file_menu_ -> addAction(quit_); - + edit_menu_ -> addAction(undo_); edit_menu_ -> addAction(redo_); edit_menu_ -> addSeparator(); @@ -456,7 +456,7 @@ void QETTitleBlockTemplateEditor::initMenus() display_menu_ -> addAction(zoom_out_); display_menu_ -> addAction(zoom_fit_); display_menu_ -> addAction(zoom_reset_); - + insertMenu(settings_menu_, file_menu_); insertMenu(settings_menu_, edit_menu_); insertMenu(settings_menu_, display_menu_); @@ -474,7 +474,7 @@ void QETTitleBlockTemplateEditor::initToolbars() main_toolbar -> addAction(save_); main_toolbar -> addAction(save_as_); addToolBar(Qt::TopToolBarArea, main_toolbar); - + QToolBar *edit_toolbar = new QToolBar(tr("Édition", "toolbar title"), this); edit_toolbar -> setObjectName("tbt_edit_toolbar"); edit_toolbar -> addAction(undo_); @@ -483,7 +483,7 @@ void QETTitleBlockTemplateEditor::initToolbars() edit_toolbar -> addAction(merge_cells_); edit_toolbar -> addAction(split_cell_); addToolBar(Qt::TopToolBarArea, edit_toolbar); - + QToolBar *display_toolbar = new QToolBar(tr("Affichage", "toolbar title"), this); display_toolbar -> setObjectName("tbt_display_toolbar"); display_toolbar -> addAction(zoom_in_); @@ -499,19 +499,22 @@ void QETTitleBlockTemplateEditor::initToolbars() void QETTitleBlockTemplateEditor::initWidgets() { QSettings settings; - + // undo list on the right undo_stack_ = new QUndoStack(this); undo_view_ = new QUndoView(undo_stack_); undo_view_ -> setEmptyLabel(tr("Aucune modification", "label displayed in the undo list when empty")); - + undo_dock_widget_ = new QDockWidget(tr("Annulations", "dock title")); undo_dock_widget_ -> setObjectName("tbt_undo_dock"); - undo_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures); + undo_dock_widget_ -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); undo_dock_widget_ -> setWidget(undo_view_); undo_dock_widget_ -> setMinimumWidth(290); addDockWidget(Qt::RightDockWidgetArea, undo_dock_widget_); - + // WYSIWYG editor as central widget template_edition_area_scene_ = new QGraphicsScene(this); template_edition_area_view_ = new TitleBlockTemplateView(template_edition_area_scene_); @@ -521,18 +524,21 @@ void QETTitleBlockTemplateEditor::initWidgets() template_edition_area_view_ -> setPreviewWidth(conf_preview_width); } setCentralWidget(template_edition_area_view_); - + // cell edition widget at the bottom template_cell_editor_widget_ = new TitleBlockTemplateCellWidget(tb_template_); template_cell_editor_dock_widget_ = new QDockWidget(tr("Propriétés de la cellule", "dock title"), this); template_cell_editor_dock_widget_ -> setObjectName("tbt_celleditor_dock"); - template_cell_editor_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures); + template_cell_editor_dock_widget_ -> setFeatures( + QDockWidget::DockWidgetClosable + |QDockWidget::DockWidgetMovable + |QDockWidget::DockWidgetFloatable); template_cell_editor_dock_widget_ -> setWidget(template_cell_editor_widget_); template_cell_editor_dock_widget_ -> setMinimumWidth(180); template_cell_editor_dock_widget_ -> setMinimumHeight(250); addDockWidget(Qt::BottomDockWidgetArea, template_cell_editor_dock_widget_); template_cell_editor_widget_ -> setVisible(false); - + connect( template_edition_area_view_, SIGNAL(selectedCellsChanged(QList)), @@ -592,7 +598,7 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const } else { titleblock_title = location_.name(); } - + // if a (file)name has been added, also add a "[Changed]" tag if needed if (!titleblock_title.isEmpty()) { QString tag; @@ -609,7 +615,7 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const ) ).arg(titleblock_title).arg(tag); } - + return(titleblock_title); } @@ -620,11 +626,11 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const void QETTitleBlockTemplateEditor::readSettings() { QSettings settings; - + // window size and position QVariant geometry = settings.value("titleblocktemplateeditor/geometry"); if (geometry.isValid()) restoreGeometry(geometry.toByteArray()); - + // window state (toolbars, docks...) QVariant state = settings.value("titleblocktemplateeditor/state"); if (state.isValid()) restoreState(state.toByteArray()); @@ -698,10 +704,10 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() "titleblock template editor: base window title" ) ); - + // get the currently edited template (file)name QString titleblock_title = currentlyEditedTitle(); - + // generate the final window title QString title; if (titleblock_title.isEmpty()) { @@ -724,7 +730,7 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() void QETTitleBlockTemplateEditor::updateActions() { save_ -> setEnabled(!read_only_); - + bool can_merge = true; bool can_split = true; int count = 0; @@ -748,15 +754,15 @@ void QETTitleBlockTemplateEditor::updateActions() bool QETTitleBlockTemplateEditor::saveAs(const TitleBlockTemplateLocation &location) { TitleBlockTemplatesCollection *collection = location.parentCollection(); if (!collection) return(false); - + QDomDocument doc; QDomElement elmt = doc.createElement("root"); tb_template_ -> saveToXmlElement(elmt); elmt.setAttribute("name", location.name()); doc.appendChild(elmt); - + collection -> setTemplateXmlDescription(location.name(), elmt); - + opened_from_file_ = false; location_ = location; undo_stack_ -> setClean(); @@ -772,7 +778,7 @@ bool QETTitleBlockTemplateEditor::saveAs(const TitleBlockTemplateLocation &locat bool QETTitleBlockTemplateEditor::saveAs(const QString &filepath) { bool saving = tb_template_ -> saveToXmlFile(filepath); if (!saving) return(false); - + opened_from_file_ = true; filepath_ = filepath; undo_stack_ -> setClean(); @@ -805,7 +811,7 @@ void QETTitleBlockTemplateEditor::openFromFile() QString initial_dir = filepath_.isEmpty() ? QETApp::customTitleBlockTemplatesDir() : QDir(filepath_).absolutePath(); - + // ask the user to choose a filepath QString user_filepath = QFileDialog::getOpenFileName( this, @@ -819,8 +825,8 @@ void QETTitleBlockTemplateEditor::openFromFile() " - %1 is the .titleblock extension" ).arg(QString(TITLEBLOCKS_FILE_EXTENSION)) ); - - + + if (!user_filepath.isEmpty()) QETApp::instance() -> openTitleBlockTemplate(user_filepath); } @@ -871,7 +877,7 @@ bool QETTitleBlockTemplateEditor::saveAsFile() QString initial_dir = filepath_.isEmpty() ? QETApp::customTitleBlockTemplatesDir() : QDir(filepath_).absolutePath(); - + // ask the user to choose a target file QString filepath = QFileDialog::getSaveFileName( this, @@ -882,16 +888,16 @@ bool QETTitleBlockTemplateEditor::saveAsFile() "filetypes allowed when saving a title block template file - %1 is the .titleblock extension" ).arg(QString(TITLEBLOCKS_FILE_EXTENSION)) ); - + // if no name was entered, return false if (filepath.isEmpty()) return(false); - + // if the name does not end with ".titleblock", add it if (!filepath.endsWith(".titleblock", Qt::CaseInsensitive)) filepath += ".titleblock"; - + // attempts to save the file bool saving = saveAs(filepath); - + // retourne un booleen representatif de la reussite de l'enregistrement return(saving); } @@ -932,18 +938,18 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc } QDialogButtonBox *buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - + QVBoxLayout *dialog_layout = new QVBoxLayout(); dialog_layout -> addWidget(widget); dialog_layout -> addWidget(buttons); - + QDialog dialog; dialog.setWindowTitle(title); dialog.setLayout(dialog_layout); - + connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject())); - + if (dialog.exec() == QDialog::Accepted) { return(widget -> location()); } @@ -978,7 +984,7 @@ void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings( void QETTitleBlockTemplateEditor::editTemplateInformation() { if (!tb_template_) return; - + QDialog dialog_author(this); dialog_author.setModal(true); #ifdef Q_OS_MACOS @@ -987,20 +993,20 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() dialog_author.setMinimumSize(400, 260); dialog_author.setWindowTitle(tr("Éditer les informations complémentaires", "window title")); QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_author); - + // explanation label QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs du cartouche, sa licence, ou tout autre renseignement que vous jugerez utile.")); information_label -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter); information_label -> setWordWrap(true); dialog_layout -> addWidget(information_label); - + // add a QTextEdit to the dialog QTextEdit *text_field = new QTextEdit(); text_field -> setAcceptRichText(false); text_field -> setPlainText(tb_template_ -> information()); text_field -> setReadOnly(read_only_); dialog_layout -> addWidget(text_field); - + // add two buttons to the dialog QDialogButtonBox *dialog_buttons = new QDialogButtonBox( read_only_ @@ -1012,7 +1018,7 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() &dialog_author, SLOT(accept())); connect(dialog_buttons, SIGNAL(rejected()), &dialog_author, SLOT(reject())); - + // run the dialog if (dialog_author.exec() == QDialog::Accepted && !read_only_) { QString new_info = text_field -> toPlainText().remove(QChar(13)); // CR-less text From 2a69e540d6fe4545ca13117bdbf96825193a68e1 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Mon, 21 Sep 2020 21:19:50 +0200 Subject: [PATCH 29/34] =?UTF-8?q?Fix=20Qt=206=20definition=20of=20macro=20?= =?UTF-8?q?=E2=80=98Q=5FDECLARE=5FMOVABLE=5FCONTAINER=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adding #include + code fail to compile if it uses deprecated APIs. => see .pro file --- qelectrotech.pro | 1 + .../elementscollectionmodel.h | 1 + sources/NameList/ui/namelistwidget.h | 22 +++++---- sources/configpages.cpp | 33 +++++++------ sources/dataBase/ui/elementquerywidget.h | 1 + sources/elementtextsmover.h | 7 +-- sources/properties/xrefproperties.cpp | 8 +-- sources/properties/xrefproperties.h | 4 +- sources/qetgraphicsitem/element.h | 39 ++++++++------- sources/qetinformation.cpp | 11 +++-- sources/qetinformation.h | 7 +-- sources/qetproject.cpp | 12 +++-- sources/qetproject.h | 25 +++++----- sources/ui/dynamicelementtextmodel.h | 26 +++++----- sources/ui/linksingleelementwidget.h | 16 +++--- sources/ui/masterpropertieswidget.h | 1 + sources/ui/multipastedialog.cpp | 49 ++++++++++--------- sources/ui/potentialselectordialog.cpp | 31 ++++++------ .../ui/shapegraphicsitempropertieswidget.cpp | 3 ++ sources/ui/xrefpropertieswidget.cpp | 6 ++- sources/ui/xrefpropertieswidget.h | 2 + sources/undocommand/addelementtextcommand.h | 31 ++++++------ .../undocommand/deleteqgraphicsitemcommand.h | 14 +++--- sources/undocommand/rotateselectioncommand.h | 15 +++--- sources/undocommand/rotatetextscommand.h | 7 +-- 25 files changed, 207 insertions(+), 165 deletions(-) diff --git a/qelectrotech.pro b/qelectrotech.pro index b28366496..1972e200a 100644 --- a/qelectrotech.pro +++ b/qelectrotech.pro @@ -76,6 +76,7 @@ include(sources/QWidgetAnimation/QWidgetAnimation.pri) DEFINES += QAPPLICATION_CLASS=QApplication DEFINES += QT_MESSAGELOGCONTEXT DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\"" +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 TEMPLATE = app DEPENDPATH += . diff --git a/sources/ElementsCollection/elementscollectionmodel.h b/sources/ElementsCollection/elementscollectionmodel.h index ba3541084..beb86ab9a 100644 --- a/sources/ElementsCollection/elementscollectionmodel.h +++ b/sources/ElementsCollection/elementscollectionmodel.h @@ -19,6 +19,7 @@ #define ELEMENTSCOLLECTIONMODEL2_H #include +#include #include "elementslocation.h" class XmlProjectElementCollectionItem; diff --git a/sources/NameList/ui/namelistwidget.h b/sources/NameList/ui/namelistwidget.h index 2bd30f531..45074c980 100644 --- a/sources/NameList/ui/namelistwidget.h +++ b/sources/NameList/ui/namelistwidget.h @@ -1,25 +1,27 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #ifndef NAMELISTWIDGET_H #define NAMELISTWIDGET_H -#include "nameslist.h" #include +#include + +#include "nameslist.h" namespace Ui { class NameListWidget; @@ -32,27 +34,27 @@ namespace Ui { class NameListWidget : public QWidget { Q_OBJECT - + public: explicit NameListWidget(QWidget *parent = nullptr); ~NameListWidget(); - + void addLine(); void setNames (const NamesList &name_list); NamesList names() const; void setReadOnly(bool ro); bool isEmpty() const; void setClipboardValue (QHash value); - + private slots: void on_m_clipboard_cb_activated(int index); - + private: void clean(); - + private: Ui::NameListWidget *ui; - bool m_read_only = false; + bool m_read_only = false; }; #endif // NAMELISTWIDGET_H diff --git a/sources/configpages.cpp b/sources/configpages.cpp index 573c9c94d..caa5101e6 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -1,20 +1,26 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include +#include +#include + #include "configpages.h" #include "borderpropertieswidget.h" #include "conductorpropertieswidget.h" @@ -27,10 +33,7 @@ #include "qetproject.h" #include "reportproperties.h" #include "qetapp.h" -#include -#include -#include -#include +#include "nameslist.h" /** @brief NewDiagramPage::NewDiagramPage @@ -249,13 +252,13 @@ void NewDiagramPage::loadSavedTbp() ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) { // epw contient les options d'export epw = new ExportPropertiesWidget(ExportProperties::defaultExportProperties()); - + // layout vertical contenant le titre, une ligne horizontale et epw QVBoxLayout *vlayout1 = new QVBoxLayout(); - + QLabel *title = new QLabel(this -> title()); vlayout1 -> addWidget(title); - + QFrame *horiz_line = new QFrame(); horiz_line -> setFrameShape(QFrame::HLine); vlayout1 -> addWidget(horiz_line); @@ -300,13 +303,13 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) { // epw contient les options d'export epw = new ExportPropertiesWidget(ExportProperties::defaultPrintProperties()); epw -> setPrintingMode(true); - + // layout vertical contenant le titre, une ligne horizontale et epw QVBoxLayout *vlayout1 = new QVBoxLayout(); - + QLabel *title = new QLabel(this -> title()); vlayout1 -> addWidget(title); - + QFrame *horiz_line = new QFrame(); horiz_line -> setFrameShape(QFrame::HLine); vlayout1 -> addWidget(horiz_line); @@ -329,10 +332,10 @@ PrintConfigPage::~PrintConfigPage() void PrintConfigPage::applyConf() { QString prefix = "print/default"; - + QSettings settings; epw -> exportProperties().toSettings(settings, prefix); - + // annule l'enregistrement de certaines proprietes non pertinentes settings.remove(prefix + "path"); settings.remove(prefix + "format"); diff --git a/sources/dataBase/ui/elementquerywidget.h b/sources/dataBase/ui/elementquerywidget.h index 8cf806058..0196b8d60 100644 --- a/sources/dataBase/ui/elementquerywidget.h +++ b/sources/dataBase/ui/elementquerywidget.h @@ -20,6 +20,7 @@ #include #include +#include class QListWidgetItem; diff --git a/sources/elementtextsmover.h b/sources/elementtextsmover.h index 9428b35fa..e53facd91 100644 --- a/sources/elementtextsmover.h +++ b/sources/elementtextsmover.h @@ -20,6 +20,7 @@ #include #include +#include class QGraphicsItem; class DiagramTextItem; @@ -37,16 +38,16 @@ class ElementTextsMover ElementTextsMover(); private: ElementTextsMover(const ElementTextsMover &); - + public: bool isReady() const; int beginMovement(Diagram *diagram, QGraphicsItem *driver_item = nullptr); void continueMovement(QGraphicsSceneMouseEvent *event); void endMovement(); - + private: QString undoText() const; - + private: bool m_movement_running = false; Diagram *m_diagram = nullptr; diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index c89077ec8..dd864f5b0 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -15,9 +15,11 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ +#include +#include + #include "xrefproperties.h" #include "qetapp.h" -#include /** @brief XRefProperties::XRefProperties @@ -56,7 +58,7 @@ void XRefProperties::toSettings(QSettings &settings, QString slave_label = m_slave_label; settings.setValue(prefix + "slave_label", slave_label); - + QMetaEnum var = QMetaEnum::fromType(); settings.setValue(prefix + "xrefpos", var.valueToKey(m_xref_pos)); @@ -110,7 +112,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const xml_element.setAttribute("snapto", snap); QString xrefpos; - + QMetaEnum var = QMetaEnum::fromType(); xml_element.setAttribute("xrefpos", var.valueToKey(m_xref_pos)); diff --git a/sources/properties/xrefproperties.h b/sources/properties/xrefproperties.h index 39cf977af..446060f52 100644 --- a/sources/properties/xrefproperties.h +++ b/sources/properties/xrefproperties.h @@ -18,8 +18,10 @@ #ifndef XREFPROPERTIES_H #define XREFPROPERTIES_H -#include "propertiesinterface.h" #include +#include + +#include "propertiesinterface.h" /** @brief The XRefProperties class diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index 9de7db721..9e7ce75e2 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -1,23 +1,27 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #ifndef ELEMENT_H #define ELEMENT_H +#include +#include +#include + #include "qet.h" #include "qetgraphicsitem.h" #include "diagramcontext.h" @@ -25,9 +29,6 @@ #include "elementslocation.h" #include "nameslist.h" -#include -#include - class QETProject; class Terminal; class Conductor; @@ -40,7 +41,7 @@ class ElementTextItemGroup; class Element : public QetGraphicsItem { friend class DiagramEventAddElement; - + Q_OBJECT public: /** @@ -64,7 +65,7 @@ class Element : public QetGraphicsItem ~Element() override; private: Element(const Element &); - + // attributes public: /** @@ -74,7 +75,7 @@ class Element : public QetGraphicsItem */ enum { Type = UserType + 1000 }; int type() const override { return Type; } - + signals: void linkedElementChanged(); //This signal is emited when the linked elements with this element change void elementInfoChange( @@ -91,12 +92,12 @@ class Element : public QetGraphicsItem DynamicElementTextItem *text, ElementTextItemGroup *group); - + public: QList terminals() const; QList conductors() const; QList> AlignedFreeTerminals() const; - + //METHODS related to information DiagramContext elementInformations()const {return m_element_informations;} @@ -118,7 +119,7 @@ class Element : public QetGraphicsItem bool isFreezeLabel() const {return m_freeze_label;} void freezeNewAddedElement(); QString actualLabel(); - + QString name() const override; ElementsLocation location() const; virtual void setHighlighted(bool); @@ -140,7 +141,7 @@ class Element : public QetGraphicsItem int> &) const; QUuid uuid() const; int orientation() const; - + //METHODS related to texts void addDynamicTextItem(DynamicElementTextItem *deti = nullptr); void removeDynamicTextItem(DynamicElementTextItem *deti); @@ -156,7 +157,7 @@ class Element : public QetGraphicsItem bool removeTextFromGroup( DynamicElementTextItem *text, ElementTextItemGroup *group); - + //METHODS related to linked element bool isFree() const; virtual void linkToElement(Element *) {} @@ -171,7 +172,7 @@ class Element : public QetGraphicsItem protected: void drawAxes(QPainter *, const QStyleOptionGraphicsItem *); void setSize(int, int); - + private: void drawSelection( QPainter *, @@ -212,25 +213,25 @@ class Element : public QetGraphicsItem // to be use in the function element::fromXml QHash m_converted_text_from_xml_description; - + //ATTRIBUTES related to linked element QList connected_elements; QList tmp_uuids_link; QUuid m_uuid; kind m_link_type = Element::Simple; - + //ATTRIBUTES related to informations DiagramContext m_element_informations, m_kind_informations; autonum::sequentialNumbers m_autoNum_seq; bool m_freeze_label = false; QString m_F_str; - + ElementsLocation m_location; NamesList m_names; QList m_terminals; const QPicture m_picture; const QPicture m_low_zoom_picture; - + private: bool m_must_highlight = false; QSize dimensions; diff --git a/sources/qetinformation.cpp b/sources/qetinformation.cpp index 7af614854..4ff4a6de9 100644 --- a/sources/qetinformation.cpp +++ b/sources/qetinformation.cpp @@ -1,25 +1,26 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ -#include "qetinformation.h" #include #include +#include "qetinformation.h" + /** @brief QETInformation::titleblockInfoKeys @return all available key for use with a titleblock @@ -47,7 +48,7 @@ QStringList QETInformation::titleblockInfoKeys() info_list << "savedtime"; info_list << "savedfilename"; info_list << "savedfilepath"; - + return info_list; } diff --git a/sources/qetinformation.h b/sources/qetinformation.h index ee8f25de0..b2dcebd12 100644 --- a/sources/qetinformation.h +++ b/sources/qetinformation.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -19,6 +19,7 @@ #define QETINFORMATION_H #include +#include namespace QETInformation { diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index d38a17857..1894d8c6d 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -15,6 +15,13 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include +#include +#include +#include + #include "qetproject.h" #include "diagram.h" #include "qetapp.h" @@ -30,11 +37,6 @@ #include "numerotationcontextcommands.h" #include "assignvariables.h" -#include -#include -#include -#include - static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min /** diff --git a/sources/qetproject.h b/sources/qetproject.h index 00e39ec58..49eb07974 100644 --- a/sources/qetproject.h +++ b/sources/qetproject.h @@ -1,23 +1,26 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ #ifndef QET_PROJECT_H #define QET_PROJECT_H +#include +#include + #include "nameslist.h" #include "elementslocation.h" #include "borderproperties.h" @@ -28,8 +31,6 @@ #include "projectdatabase.h" #include "reportproperties.h" -#include - class Diagram; class ElementsLocation; class QETResult; @@ -62,7 +63,7 @@ class QETProject : public QObject }; Q_PROPERTY(bool autoConductor READ autoConductor WRITE setAutoConductor) - + // constructors, destructor public: QETProject (QObject *parent = nullptr); @@ -72,7 +73,7 @@ class QETProject : public QObject private: QETProject(const QETProject &); - + // methods public: projectDataBase *dataBase(); @@ -166,13 +167,13 @@ class QETProject : public QObject DiagramContext projectProperties(); void setProjectProperties(const DiagramContext &); QUndoStack* undoStack() {return m_undo_stack;} - + public slots: Diagram *addNewDiagram(int pos = -1); void removeDiagram(Diagram *); void diagramOrderChanged(int, int); void setModified(bool); - + signals: void projectFilePathChanged(QETProject *, const QString &); void projectTitleChanged(QETProject *, const QString &); @@ -195,14 +196,14 @@ class QETProject : public QObject void folioAutoNumChanged(QString); void defaultTitleBlockPropertiesChanged(); void conductorAutoNumChanged(); - + private slots: void updateDiagramsFolioData(); void updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *, const QString &); void removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *, const QString &); void usedTitleBlockTemplateChanged(const QString &); void undoStackChanged (bool a) {if (!a) setModified(true);} - + private: void readProjectXml(QDomDocument &xml_project); void readDiagramsXml(QDomDocument &xml_project); @@ -217,7 +218,7 @@ class QETProject : public QObject void writeBackup(); void init(); ProjectState openFile(QFile *file); - + // attributes private: /// File path this project is saved to diff --git a/sources/ui/dynamicelementtextmodel.h b/sources/ui/dynamicelementtextmodel.h index 4684c28fd..bceb1eff7 100644 --- a/sources/ui/dynamicelementtextmodel.h +++ b/sources/ui/dynamicelementtextmodel.h @@ -19,6 +19,8 @@ #define DYNAMICELEMENTTEXTMODEL_H #include +#include + #include #include "dynamicelementtextitem.h" @@ -35,7 +37,7 @@ class Element; class DynamicElementTextModel : public QStandardItemModel { Q_OBJECT - + public: enum ValueType { textFrom =1, @@ -58,10 +60,10 @@ class DynamicElementTextModel : public QStandardItemModel grpHoldBottom, grpFrame }; - + DynamicElementTextModel(Element *element, QObject *parent = nullptr); ~DynamicElementTextModel() override; - + bool indexIsInGroup(const QModelIndex &index) const; DynamicElementTextItem *textFromIndex(const QModelIndex &index) const; DynamicElementTextItem *textFromItem(QStandardItem *item) const; @@ -72,13 +74,13 @@ class DynamicElementTextModel : public QStandardItemModel QUndoCommand *undoForEditedGroup( ElementTextItemGroup *group, QUndoCommand *parent_undo = nullptr) const; - + ElementTextItemGroup *groupFromIndex(const QModelIndex &index) const; ElementTextItemGroup *groupFromItem(QStandardItem *item) const; QModelIndex indexFromGroup(ElementTextItemGroup *group) const; bool indexIsText(const QModelIndex &index) const; bool indexIsGroup(const QModelIndex &index) const; - + bool canDropMimeData( const QMimeData *data, Qt::DropAction action, @@ -93,10 +95,10 @@ class DynamicElementTextModel : public QStandardItemModel const QModelIndex &parent) override; QMimeData *mimeData(const QModelIndexList &indexes) const override; QStringList mimeTypes() const override; - + signals: void dataChanged(); - + private: QList itemsForText(DynamicElementTextItem *deti); void addText(DynamicElementTextItem *deti); @@ -119,7 +121,7 @@ class DynamicElementTextModel : public QStandardItemModel DynamicElementTextModel::ValueType type); void updateDataFromGroup(ElementTextItemGroup *group, DynamicElementTextModel::ValueType type); - + private: QPointer m_element; QHash m_texts_list; @@ -134,10 +136,10 @@ class DynamicElementTextModel : public QStandardItemModel class DynamicTextItemDelegate : public QStyledItemDelegate { Q_OBJECT - + public: DynamicTextItemDelegate(QObject *parent = Q_NULLPTR); - + QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, @@ -146,10 +148,10 @@ class DynamicTextItemDelegate : public QStyledItemDelegate QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; - + protected: bool eventFilter(QObject *object, QEvent *event) override; - + private: QStringList availableInfo(DynamicElementTextItem *deti) const; }; diff --git a/sources/ui/linksingleelementwidget.h b/sources/ui/linksingleelementwidget.h index 19b389fb3..cd436322e 100644 --- a/sources/ui/linksingleelementwidget.h +++ b/sources/ui/linksingleelementwidget.h @@ -18,6 +18,8 @@ #ifndef LINKSINGLEELEMENTWIDGET_H #define LINKSINGLEELEMENTWIDGET_H +#include + #include "element.h" #include "abstractelementpropertieseditorwidget.h" @@ -73,30 +75,30 @@ class LinkSingleElementWidget : public AbstractElementPropertiesEditorWidget void hideButtons(); void showButtons(); void headerCustomContextMenuRequested(const QPoint &pos); - + void on_m_unlink_pb_clicked(); void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column); void on_m_tree_widget_customContextMenuRequested(const QPoint &pos); void on_m_show_linked_pb_clicked(); void on_m_show_this_pb_clicked(); - + void on_m_search_field_textEdited(const QString &arg1); - + private: Ui::LinkSingleElementWidget *ui; bool m_unlink = false; Element::kind m_filter; - + QHash m_qtwi_elmt_hash; QHash m_qtwi_strl_hash; - + QTreeWidgetItem *m_qtwi_at_context_menu = nullptr, *m_pending_qtwi = nullptr; - + Element *m_showed_element = nullptr, *m_element_to_link = nullptr; - + QMenu *m_context_menu; QAction *m_link_action, *m_show_qtwi, diff --git a/sources/ui/masterpropertieswidget.h b/sources/ui/masterpropertieswidget.h index 155019123..a75ed1311 100644 --- a/sources/ui/masterpropertieswidget.h +++ b/sources/ui/masterpropertieswidget.h @@ -20,6 +20,7 @@ #include #include + #include "abstractelementpropertieseditorwidget.h" class Element; diff --git a/sources/ui/multipastedialog.cpp b/sources/ui/multipastedialog.cpp index 9f66a0519..ea0bf2753 100644 --- a/sources/ui/multipastedialog.cpp +++ b/sources/ui/multipastedialog.cpp @@ -15,13 +15,16 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include + #include "multipastedialog.h" #include "ui_multipastedialog.h" #include "diagram.h" #include "diagramcommands.h" #include "element.h" #include "conductorautonumerotation.h" -#include MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) : QDialog(parent), @@ -29,16 +32,16 @@ MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) : m_diagram(diagram) { ui->setupUi(this); - + connect(ui->m_x_sb, static_cast(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview); connect(ui->m_y_sb, static_cast(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview); connect(ui->m_copy_count, static_cast(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview); - + QRectF br; for (QGraphicsItem *item : m_diagram->selectedItems()) br = br.united(item->mapToScene(item->boundingRect()).boundingRect()); m_origin = br.topLeft(); - + m_document = m_diagram->toXml(false); updatePreview(); } @@ -56,7 +59,7 @@ MultiPasteDialog::~MultiPasteDialog() } } } - + delete ui; } @@ -73,20 +76,20 @@ void MultiPasteDialog::updatePreview() } m_pasted_content.clear(); m_pasted_content_list.clear(); - + QPointF offset(ui->m_x_sb->value(), ui->m_y_sb->value()); QPointF pos = m_origin+offset; - + for(int i=0 ; im_copy_count->value() ; i++) - { + { DiagramContent dc; m_diagram->fromXml(m_document, pos, false, &dc); - + m_pasted_content += dc; m_pasted_content_list << dc; pos += offset; } - + if(m_pasted_content.count()) m_diagram->adjustSceneRect(); } @@ -96,7 +99,7 @@ void MultiPasteDialog::on_m_button_box_accepted() if(m_pasted_content.count()) { m_diagram->undoStack().beginMacro(tr("Multi-collage")); - + QSettings settings; bool erase_label = settings.value("diagramcommands/erase-label-on-copy", true).toBool(); //Ensure when 'auto_num' is checked, the settings 'save_label' is to true. @@ -105,18 +108,18 @@ void MultiPasteDialog::on_m_button_box_accepted() //and so the auto_num below do nothing (there is not a formula to compare) if(ui->m_auto_num_cb->isChecked()) settings.setValue("diagramcommands/erase-label-on-copy", false); - - - + + + m_diagram->clearSelection(); m_diagram->undoStack().push(new PasteDiagramCommand(m_diagram, m_pasted_content)); - + for(DiagramContent dc : m_pasted_content_list) { QList pasted_elements = dc.m_elements; //Sort the list element by there pos (top -> bottom) std::sort(pasted_elements.begin(), pasted_elements.end(), [](Element *a, Element *b){return (a->pos().y() < b->pos().y());}); - + //Auto-connection if(ui->m_auto_connection_cb->isChecked()) { @@ -125,10 +128,10 @@ void MultiPasteDialog::on_m_button_box_accepted() while (!elmt->AlignedFreeTerminals().isEmpty()) { QPair pair = elmt->AlignedFreeTerminals().takeFirst(); - + Conductor *conductor = new Conductor(pair.first, pair.second); m_diagram->undoStack().push(new AddItemCommand(conductor, m_diagram, QPointF())); - + //Autonum the new conductor, the undo command associated for this, have for parent undo_object ConductorAutoNumerotation can (conductor, m_diagram); can.numerate(); @@ -138,7 +141,7 @@ void MultiPasteDialog::on_m_button_box_accepted() } } } - + //Set up the label of element //Instead of use the current autonum of project, //we try to fetch the same formula of the pasted element, in the several autonum of the project @@ -152,7 +155,7 @@ void MultiPasteDialog::on_m_button_box_accepted() { QHash autonums = m_diagram->project()->elementAutoNum(); QHashIterator hash_iterator(autonums); - + while(hash_iterator.hasNext()) { hash_iterator.next(); @@ -167,7 +170,7 @@ void MultiPasteDialog::on_m_button_box_accepted() } //Like elements, we compare formula of pasted conductor with the autonums available in the project. if(ui->m_auto_num_cond_cb->isChecked()) - { + { //This list is to ensure we not numerate twice the same conductor QList numerated; //Start with the element at top @@ -184,7 +187,7 @@ void MultiPasteDialog::on_m_button_box_accepted() { QHash autonums = m_diagram->project()->conductorAutoNum(); QHashIterator hash_iterator(autonums); - + while (hash_iterator.hasNext()) { hash_iterator.next(); @@ -205,7 +208,7 @@ void MultiPasteDialog::on_m_button_box_accepted() } } } - + m_diagram->adjustSceneRect(); m_accept = true; settings.setValue("diagramcommands/erase-label-on-copy", erase_label); diff --git a/sources/ui/potentialselectordialog.cpp b/sources/ui/potentialselectordialog.cpp index daa49b227..bfbededa4 100644 --- a/sources/ui/potentialselectordialog.cpp +++ b/sources/ui/potentialselectordialog.cpp @@ -15,11 +15,14 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include + #include "potentialselectordialog.h" #include "ui_potentialselectordialog.h" #include "conductor.h" #include "terminal.h" -#include #include "QPropertyUndoCommand/qpropertyundocommand.h" #include "diagram.h" #include "element.h" @@ -191,14 +194,14 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList H; for (ConductorProperties cp : list) { @@ -213,7 +216,7 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QListisChecked()) { return H.value(b); } } - + return ConductorProperties(); } @@ -290,7 +293,7 @@ void PotentialSelectorDialog::buildWidget() QString text1(tr("%n conducteurs composent le potentiel suivant :", "", m_potential_selector->m_conductor_number_1)); - + ConductorProperties cp1; if(!m_potential_selector->m_properties_list_1.isEmpty()) cp1 = m_potential_selector->m_properties_list_1.first();; @@ -308,14 +311,14 @@ void PotentialSelectorDialog::buildWidget() if(!cp1.m_wire_section.isEmpty()) text1.append(tr("\nSection du conducteur : %1") .arg(cp1.m_wire_section)); - + QString text2(tr("%n conducteurs composent le potentiel suivant :", "", m_potential_selector->m_conductor_number_2)); ConductorProperties cp2; if(!m_potential_selector->m_properties_list_2.isEmpty()) cp2 = m_potential_selector->m_properties_list_2.first(); - + if(!cp2.text.isEmpty()) text2.append(tr("\nNuméro : %1").arg(cp2.text)); if(!cp2.m_function.isEmpty()) @@ -329,7 +332,7 @@ void PotentialSelectorDialog::buildWidget() if(!cp2.m_wire_section.isEmpty()) text2.append(tr("\nSection du conducteur : %1") .arg(cp2.m_wire_section)); - + QRadioButton *rb1 = new QRadioButton(text1, this); QRadioButton *rb2 = new QRadioButton(text2, this); @@ -429,7 +432,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() new_value, undo); } - + //Check if formula of the new potential // have incompatible variable with folio report QRegularExpression rx ("%sequf_|%seqtf_|%seqhf_|%id|%F|%M|%LM"); @@ -445,7 +448,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() << "%F" << "%M" << "%LM"; - + QString text(tr("La formule du nouveau potentiel contient des variables incompatibles avec les reports de folio.\n" "Veuillez saisir une formule compatible pour ce potentiel.\n" "Les variables suivantes sont incompatibles :\n" @@ -455,7 +458,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() fag.setText(text); fag.setFormula(cp.m_formula); fag.exec(); - + QString new_formula = fag.formula(); QSet c_list = m_report->conductors().first()->relatedPotentialConductors(); c_list.insert(m_report->conductors().first()); @@ -471,7 +474,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() new_value, undo); } - + break; } } diff --git a/sources/ui/shapegraphicsitempropertieswidget.cpp b/sources/ui/shapegraphicsitempropertieswidget.cpp index 6a0519f33..97c07e465 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.cpp +++ b/sources/ui/shapegraphicsitempropertieswidget.cpp @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include + #include "shapegraphicsitempropertieswidget.h" #include "ui_shapegraphicsitempropertieswidget.h" #include "qetshapeitem.h" diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index c14b75a1c..b5f9ff002 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -15,12 +15,14 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ -#include "xrefpropertieswidget.h" #include +#include +#include + +#include "xrefpropertieswidget.h" #include "ui_xrefpropertieswidget.h" #include "qdebug.h" -#include /** @brief XRefPropertiesWidget::XRefPropertiesWidget diff --git a/sources/ui/xrefpropertieswidget.h b/sources/ui/xrefpropertieswidget.h index 73d33a9e9..bd7471cd4 100644 --- a/sources/ui/xrefpropertieswidget.h +++ b/sources/ui/xrefpropertieswidget.h @@ -19,6 +19,8 @@ #define XREFPROPERTIESWIDGET_H #include +#include + #include "properties/xrefproperties.h" namespace Ui { diff --git a/sources/undocommand/addelementtextcommand.h b/sources/undocommand/addelementtextcommand.h index fc73f1d9b..5697db885 100644 --- a/sources/undocommand/addelementtextcommand.h +++ b/sources/undocommand/addelementtextcommand.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -21,6 +21,7 @@ #include #include #include +#include class Element; class DynamicElementTextItem; @@ -37,10 +38,10 @@ class AddElementTextCommand : public QUndoCommand DynamicElementTextItem *deti, QUndoCommand *parent = nullptr); ~AddElementTextCommand() override; - + void undo() override; void redo() override; - + private: Element *m_element = nullptr; DynamicElementTextItem *m_text = nullptr; @@ -64,10 +65,10 @@ class AddTextsGroupCommand : public QUndoCommand QList texts_list, QUndoCommand *parent = nullptr); ~AddTextsGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_element; QPointer m_group; @@ -88,10 +89,10 @@ class RemoveTextsGroupCommand : public QUndoCommand ElementTextItemGroup *group, QUndoCommand *parent = nullptr); ~RemoveTextsGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_element; QPointer m_group; @@ -108,10 +109,10 @@ class AddTextToGroupCommand : public QUndoCommand ElementTextItemGroup *group, QUndoCommand *parent = nullptr); ~AddTextToGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_text; QPointer m_group; @@ -128,10 +129,10 @@ class RemoveTextFromGroupCommand : public QUndoCommand ElementTextItemGroup *group, QUndoCommand *parent = nullptr); ~RemoveTextFromGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_text; QPointer m_group; @@ -148,12 +149,12 @@ class AlignmentTextsGroupCommand : public QUndoCommand Qt::Alignment new_alignment, QUndoCommand *parent = nullptr); ~AlignmentTextsGroupCommand() override; - + int id() const override{return 6;} bool mergeWith(const QUndoCommand *other) override; void undo() override; void redo() override; - + private: QPointer m_group; Qt::Alignment m_previous_alignment, diff --git a/sources/undocommand/deleteqgraphicsitemcommand.h b/sources/undocommand/deleteqgraphicsitemcommand.h index 7466e2ac3..b2c3ba400 100644 --- a/sources/undocommand/deleteqgraphicsitemcommand.h +++ b/sources/undocommand/deleteqgraphicsitemcommand.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -19,6 +19,8 @@ #define DELETEQGRAPHICSITEMCOMMAND_H #include +#include + #include "diagramcontent.h" class Diagram; @@ -32,17 +34,17 @@ class DeleteQGraphicsItemCommand : public QUndoCommand public: DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr); ~DeleteQGraphicsItemCommand() override; - + private: DeleteQGraphicsItemCommand(const DeleteQGraphicsItemCommand &); - + void setPotentialsOfRemovedElements(); Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude); public: void undo() override; void redo() override; - + // attributes private: DiagramContent m_removed_contents; diff --git a/sources/undocommand/rotateselectioncommand.h b/sources/undocommand/rotateselectioncommand.h index bdf1d1b76..921bcac63 100644 --- a/sources/undocommand/rotateselectioncommand.h +++ b/sources/undocommand/rotateselectioncommand.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -20,6 +20,7 @@ #include #include +#include class Diagram; class ConductorTextItem; @@ -35,16 +36,16 @@ class RotateSelectionCommand : public QUndoCommand RotateSelectionCommand(Diagram *diagram, qreal angle=90, QUndoCommand *parent=nullptr); void undo() override; void redo() override; - + bool isValid(); - + private: Diagram *m_diagram =nullptr; - + QList> m_cond_text; QHash m_rotate_by_user; QList m_undo; - + }; #endif // ROTATESELECTIONCOMMAND_H diff --git a/sources/undocommand/rotatetextscommand.h b/sources/undocommand/rotatetextscommand.h index 8ee37f3d3..2bbc80c24 100644 --- a/sources/undocommand/rotatetextscommand.h +++ b/sources/undocommand/rotatetextscommand.h @@ -20,6 +20,7 @@ #include #include +#include class ConductorTextItem; class Diagram; @@ -34,14 +35,14 @@ class RotateTextsCommand : public QUndoCommand { public: RotateTextsCommand(Diagram *diagram, QUndoCommand *parent=nullptr); - + void undo() override; void redo() override; - + private: void openDialog(); void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end); - + private: QPointer m_diagram; QHash m_cond_texts; From bcc5846662c5463b0b662db3b708af8d010f7144 Mon Sep 17 00:00:00 2001 From: David Varley Date: Tue, 22 Sep 2020 12:16:32 +1000 Subject: [PATCH 30/34] DXF - Cleaning up scaling --- sources/createdxf.cpp | 262 ++++++++++++++++++++++++--------------- sources/createdxf.h | 17 +++ sources/exportdialog.cpp | 93 +++++++------- 3 files changed, 226 insertions(+), 146 deletions(-) diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 7a63e19d2..29a4102da 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -33,7 +33,6 @@ Createdxf::Createdxf() { } - Createdxf::~Createdxf() { } @@ -255,26 +254,6 @@ void Createdxf::dxfEnd(const QString& fileName) } } -/** - @brief Createdxf::drawCircle - draw circle in qt format - @param fileName - @param center - @param radius - @param colour -*/ -void Createdxf::drawCircle( - const QString& fileName, - QPointF centre, - double radius, - int colour) -{ - qreal x = centre.x() * xScale; - qreal y = sheetHeight - centre.y() * yScale; - qreal r = radius * xScale; - drawCircle(fileName,r,x,y,colour); -} - /** @brief Createdxf::drawCircle draw circle in dxf format @@ -465,25 +444,6 @@ int Createdxf::dxfColor(QPen pen) { return Createdxf::dxfColor(pen.color()); } -/** - @brief Createdxf::drawLine - Convenience function to draw line - @param filepath - @param line - @param colorcode -*/ -void Createdxf::drawLine( - const QString &filepath, - const QLineF &line, - const int &colorcode) -{ - drawLine(filepath, line.p1().x() * xScale, - sheetHeight - (line.p1().y() * yScale), - line.p2().x() * xScale, - sheetHeight - (line.p2().y() * yScale), - colorcode); -} - void Createdxf::drawArcEllipse( const QString &file_path, qreal x, @@ -631,26 +591,7 @@ void Createdxf::drawArcEllipse( } } -/** - @brief Createdxf::drawEllipse - Conveniance function for draw ellipse - @param filepath - @param rect - @param colorcode -*/ -void Createdxf::drawEllipse( - const QString &filepath, - const QRectF &rect, - const int &colorcode) -{ - drawArcEllipse( - filepath, - rect.topLeft().x() * xScale, - sheetHeight - (rect.topLeft().y() * yScale), - rect.width() * xScale, - rect.height() * yScale, - 0, 360, 0, 0, 0, colorcode); -} + /** @brief Createdxf::drawRectangle @@ -675,45 +616,11 @@ void Createdxf::drawRectangle ( drawPolyline(fileName,poly,colour,true); } -static QRectF scaleRect(QRectF rect) -{ - QRectF ro(rect.bottomLeft().x() * Createdxf::xScale, - Createdxf::sheetHeight - (rect.bottomLeft().y() * Createdxf::yScale), - rect.width() * Createdxf::xScale, - rect.height() * Createdxf::yScale); - return ro; -} -/** - @brief Createdxf::drawRectangle - Convenience function for draw rectangle - @param filepath - @param rect - @param colorcode -*/ -void Createdxf::drawRectangle( - const QString &filepath, - const QRectF &rect, - const int &colorcode) { - //QPolygonF poly(scaleRect(rect)); - QPolygonF poly(rect); - drawPolyline(filepath,poly,colorcode); -} -/** - @brief Createdxf::drawPolygon - Convenience function for draw polygon - @param filepath - @param poly - @param colorcode -*/ -void Createdxf::drawPolygon( - const QString &filepath, - const QPolygonF &poly, - const int &colorcode) -{ - drawPolyline(filepath,poly,colorcode); -} + + + /** @brief Createdxf::drawArc draw arc in dx format @@ -788,7 +695,7 @@ void Createdxf::drawText( double height, double rotation, int colour, - double xScale) + double xScaleW) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -800,7 +707,7 @@ void Createdxf::drawText( errorFileOpen.exec(); } else { QTextStream To_Dxf(&file); - // Draw the circle + // Draw the text To_Dxf << 0 << "\r\n"; To_Dxf << "TEXT" << "\r\n"; To_Dxf << 8 << "\r\n"; @@ -816,7 +723,7 @@ void Createdxf::drawText( To_Dxf << 40 << "\r\n"; To_Dxf << height << "\r\n"; // Text Height To_Dxf << 41 << "\r\n"; - To_Dxf << xScale << "\r\n"; // X Scale + To_Dxf << xScaleW << "\r\n"; // X Scale To_Dxf << 1 << "\r\n"; To_Dxf << text << "\r\n"; // Text Value To_Dxf << 50 << "\r\n"; @@ -840,7 +747,7 @@ void Createdxf::drawTextAligned( int hAlign, int vAlign, double xAlign, - double xScale, + double xScaleW, int colour) { if (!fileName.isEmpty()) { @@ -869,7 +776,7 @@ void Createdxf::drawTextAligned( To_Dxf << 40 << "\r\n"; To_Dxf << height << "\r\n"; // Text Height To_Dxf << 41 << "\r\n"; - To_Dxf << xScale << "\r\n"; // X Scale + To_Dxf << xScaleW << "\r\n"; // X Scale To_Dxf << 1 << "\r\n"; To_Dxf << text << "\r\n"; // Text Value To_Dxf << 50 << "\r\n"; @@ -982,3 +889,154 @@ void Createdxf::drawPolyline(const QString &filepath, } } } + +/* ================================================ + * Majority of calls above here are must be passed + * parameters pre=scaled to DXF units + * Calls below use Qt scaling, and re-scale them to DXF + * ================================================ + */ +/** + @brief Createdxf::drawCircle + draw circle in qt format + @param fileName + @param center + @param radius + @param colour +*/ +void Createdxf::drawCircle( + const QString& fileName, + QPointF centre, + double radius, + int colour) +{ + qreal x = centre.x() * xScale; + qreal y = sheetHeight - centre.y() * yScale; + qreal r = radius * xScale; + drawCircle(fileName,r,x,y,colour); +} + +/** + @brief Createdxf::drawLine + Convenience function to draw line + @param filepath + @param line + @param colorcode +*/ +void Createdxf::drawLine( + const QString &filepath, + const QLineF &line, + const int &colorcode) +{ + drawLine(filepath, line.p1().x() * xScale, + sheetHeight - (line.p1().y() * yScale), + line.p2().x() * xScale, + sheetHeight - (line.p2().y() * yScale), + colorcode); +} + +/** + @brief Createdxf::drawEllipse + Conveniance function for draw ellipse + @param filepath + @param rect + @param colorcode +*/ +void Createdxf::drawEllipse( + const QString &filepath, + const QRectF &rect, + const int &colorcode) +{ + drawArcEllipse( + filepath, + rect.topLeft().x() * xScale, + sheetHeight - (rect.topLeft().y() * yScale), + rect.width() * xScale, + rect.height() * yScale, + 0, 360, 0, 0, 0, colorcode); +} + +/** + @brief Createdxf::drawRectangle + Convenience function for draw rectangle + @param filepath + @param rect + @param colorcode +*/ +void Createdxf::drawRectangle( + const QString &filepath, + const QRectF &rect, + const int &colorcode) { + //QPolygonF poly(scaleRect(rect)); + QPolygonF poly(rect); + drawPolyline(filepath,poly,colorcode); +} + +/** + @brief Createdxf::drawPolygon + Convenience function for draw polygon + @param filepath + @param poly + @param colorcode +*/ +void Createdxf::drawPolygon( + const QString &filepath, + const QPolygonF &poly, + const int &colorcode) +{ + drawPolyline(filepath,poly,colorcode); +} + +/** + @brief Createdxf::drawText + draw simple text in dxf format without any alignment specified + @param fileName + @param text + @param point + @param height + @param rotation + @param colour + @param xScaleW=1 +*/ +void Createdxf::drawText( + const QString& fileName, + const QString& text, + QPointF point, + double height, + double rotation, + int colour, + double xScaleW) +{ + qreal x = point.x() * xScale; + qreal y = sheetHeight - (point.y() * yScale); + drawText(fileName,text,x,y,height * yScale,rotation,colour,xScaleW); +} +void Createdxf::drawArcEllipse( + const QString &file_path, + QRectF rect, + qreal startAngle, + qreal spanAngle, + QPointF hotspot, + qreal rotation_angle, + const int &colorcode) +{ + qreal x = rect.x() * xScale; + qreal y = sheetHeight - rect.y() * yScale; + qreal w = rect.width() * xScale; + qreal h = rect.height() * yScale; + qreal hotspot_x = hotspot.x() * xScale; + qreal hotspot_y = sheetHeight - hotspot.y() * yScale; + drawArcEllipse(file_path,x,y,w,h,startAngle,spanAngle,hotspot_x,hotspot_y,rotation_angle,colorcode); +} + +/* + * Utility functions + */ +static QRectF scaleRect(QRectF rect) +{ + QRectF ro(rect.bottomLeft().x() * Createdxf::xScale, + Createdxf::sheetHeight - (rect.bottomLeft().y() * Createdxf::yScale), + rect.width() * Createdxf::xScale, + rect.height() * Createdxf::yScale); + return ro; +} diff --git a/sources/createdxf.h b/sources/createdxf.h index 14b64807f..3d071b8f7 100644 --- a/sources/createdxf.h +++ b/sources/createdxf.h @@ -69,6 +69,15 @@ class Createdxf qreal rotation_angle, const int &colorcode); + static void drawArcEllipse( + const QString &file_path, + QRectF rect, + qreal startAngle, + qreal spanAngle, + QPointF hotspot, + qreal rotation_angle, + const int &colorcode); + static void drawEllipse (const QString &filepath, const QRectF &rect, const int &colorcode); @@ -110,6 +119,14 @@ class Createdxf double, int, double xScale=1.0); + static void drawText( + const QString&, + const QString&, + QPointF, + double, + double, + int, + double xScale=1.0); static void drawTextAligned( const QString& fileName, const QString& text, diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 1393aa87d..e7f4a128d 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -495,9 +495,6 @@ void ExportDialog::generateDxf( qreal elem_pos_x = elmt -> pos().x(); qreal elem_pos_y = elmt -> pos().y();// - (diagram -> margin / 2); - qreal hotspot_x = (elem_pos_x) * Createdxf::xScale; - qreal hotspot_y = Createdxf::sheetHeight - (elem_pos_y) * Createdxf::yScale; - ElementPictureFactory::primitives primitives = ElementPictureFactory::instance()->getPrimitives(elmt->location()); for(QGraphicsSimpleTextItem *text : primitives.m_texts) @@ -506,29 +503,26 @@ void ExportDialog::generateDxf( if (fontSize < 0) fontSize = text->font().pixelSize(); - fontSize *= Createdxf::yScale; qreal x = elem_pos_x + text->pos().x(); qreal y = elem_pos_y + text->pos().y(); - x *= Createdxf::xScale; - y = Createdxf::sheetHeight - (y * Createdxf::yScale); qreal angle = text -> rotation() + rotation_angle; qreal angler = angle * M_PI/180; int xdir = -sin(angler); int ydir = -cos(angler); - QPointF transformed_point = rotation_transformed(x, y, hotspot_x, hotspot_y, rotation_angle); + QPointF transformed_point = rotation_transformed(x, y, elem_pos_x, elem_pos_y, -rotation_angle); x = transformed_point.x() - ydir * fontSize * 0.5; - y = transformed_point.y() + xdir * fontSize * 0.5; + y = transformed_point.y() - xdir * fontSize * 0.5; QStringList lines = text->text().split('\n'); qreal offset = fontSize * 1.6; for (QString line : lines) { if (line.size() > 0 && line != "_" ) { - Createdxf::drawText(file_path, line, x, y, fontSize, 360 - angle, 0, 0.72); + Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360 - angle, 0, 0.72); } x += offset * xdir; - y += offset * ydir; + y -= offset * ydir; } } @@ -565,15 +559,17 @@ void ExportDialog::generateDxf( // Draw arcs and ellipses for (QVector arc : primitives.m_arcs) { - if (arc.size() == 0) - continue; - qreal x = (elem_pos_x + arc.at(0)) * Createdxf::xScale; - qreal y = Createdxf::sheetHeight - (elem_pos_y + arc.at(1)) * Createdxf::yScale; - qreal w = arc.at(2) * Createdxf::xScale; - qreal h = arc.at(3) * Createdxf::yScale; - qreal startAngle = arc.at(4); - qreal spanAngle = arc .at(5); - Createdxf::drawArcEllipse(file_path, x, y, w, h, startAngle, spanAngle, hotspot_x, hotspot_y, rotation_angle, 0); + if (arc.size() == 0) + continue; + qreal x = (elem_pos_x + arc.at(0)); + qreal y = (elem_pos_y + arc.at(1)); + qreal w = arc.at(2); + qreal h = arc.at(3); + qreal startAngle = arc.at(4); + qreal spanAngle = arc .at(5); + QRectF r(x,y,w,h); + QPointF hotspot(elem_pos_x,elem_pos_y); + Createdxf::drawArcEllipse(file_path, r, startAngle, spanAngle, hotspot, rotation_angle, 0); } if (epw -> exportProperties().draw_terminals) { // Draw terminals @@ -602,31 +598,32 @@ void ExportDialog::generateDxf( Createdxf::drawPolyline(file_path,poly,0); //Draw conductor text item ConductorTextItem *textItem = cond -> textItem(); - if (textItem) { - qreal fontSize = textItem -> font().pointSizeF(); - if (fontSize < 0) - fontSize = textItem -> font().pixelSize(); - fontSize *= Createdxf::yScale; + + if (textItem) { + qreal fontSize = textItem -> font().pointSizeF(); + if (fontSize < 0) + fontSize = textItem -> font().pixelSize(); qreal angle = textItem -> rotation(); qreal angler = angle * M_PI/180; int xdir = -sin(angler); int ydir = -cos(angler); - qreal x = (cond->pos().x() + textItem -> pos().x()) * Createdxf::xScale + qreal x = (cond->pos().x() + textItem -> pos().x()) + xdir * fontSize * 1.8 - ydir * fontSize; - qreal y = Createdxf::sheetHeight - ((cond->pos().y() + textItem -> pos().y()) * Createdxf::yScale) - + ydir * fontSize * 1.8 - + xdir * fontSize * 0.9; + qreal y = (cond->pos().y() + textItem -> pos().y()) + - ydir * fontSize * 1.8 + - xdir * fontSize * 0.9; QStringList lines = textItem->toPlainText().split('\n'); qreal offset = fontSize * 1.6; foreach (QString line, lines) { if (line.size() > 0 && line != "_" ) - Createdxf::drawText(file_path, line, x, y, fontSize, 360-angle, 0, 0.72 ); + Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, 0, 0.72 ); x += offset * xdir; - y += offset * ydir; + y -= offset * ydir; } - } + } + // Draw the junctions QList junctions_list = cond->junctions(); if (!junctions_list.isEmpty()) { @@ -637,30 +634,38 @@ void ExportDialog::generateDxf( } //Draw text items - foreach(DiagramTextItem *dti, list_texts) { - qreal fontSize = dti -> font().pointSizeF(); - if (fontSize < 0) - fontSize = dti -> font().pixelSize(); - fontSize *= Createdxf::yScale; + foreach(DiagramTextItem *dti, list_texts) { + qreal fontSize = dti -> font().pointSizeF(); + if (fontSize < 0) + fontSize = dti -> font().pixelSize(); + qreal angle = dti -> rotation(); + + QGraphicsItem *parent = dti->parentItem(); + while (parent) { + angle += parent->rotation(); + parent = parent->parentItem(); + } + qreal angler = angle * M_PI/180; int xdir = -sin(angler); int ydir = -cos(angler); - qreal x = (dti->scenePos().x()) * Createdxf::xScale + qreal x = (dti->scenePos().x()) + xdir * fontSize * 1.8 - ydir * fontSize; - qreal y = Createdxf::sheetHeight - (dti->scenePos().y() * Createdxf::yScale) - + ydir * fontSize * 1.8 - + xdir * fontSize * 0.9; - QStringList lines = dti -> toPlainText().split('\n'); + qreal y = dti->scenePos().y() + - ydir * fontSize * 1.8 + - xdir * fontSize * 0.9; + QStringList lines = dti -> toPlainText().split('\n'); qreal offset = fontSize * 1.6; foreach (QString line, lines) { if (line.size() > 0 && line != "_" ) - Createdxf::drawText(file_path, line, x, y, fontSize, 360-angle, 0, 0.72 ); + Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, 0, 0.72 ); x += offset * xdir; - y += offset * ydir; + y -= offset * ydir; } - } + } + Createdxf::dxfEnd(file_path); saveReloadDiagramParameters(diagram, false); From 2d6bef71ae227865c55e7d6564130391014b7c9d Mon Sep 17 00:00:00 2001 From: David Varley Date: Tue, 22 Sep 2020 19:41:47 +1000 Subject: [PATCH 31/34] DXF - Add some color --- sources/createdxf.cpp | 10 +++++- sources/exportdialog.cpp | 2 +- sources/qetgraphicsitem/qetshapeitem.cpp | 42 +++++++++++------------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 29a4102da..445ff9b26 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -437,9 +437,11 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue) } return minndx; } + int Createdxf::dxfColor(QColor color) { return Createdxf::getcolorCode(color.red(), color.green(), color.blue()); } + int Createdxf::dxfColor(QPen pen) { return Createdxf::dxfColor(pen.color()); } @@ -984,7 +986,13 @@ void Createdxf::drawPolygon( const QPolygonF &poly, const int &colorcode) { - drawPolyline(filepath,poly,colorcode); + qDebug() << "PolygonIsClosed: " << poly.isClosed(); + QPolygonF pg = poly; + if(!poly.isClosed()) { + pg << poly.at(0); + } + qDebug() << "PolygonIsClosed: " << poly.isClosed(); + drawPolyline(filepath,pg,colorcode); } /** diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index e7f4a128d..f79f6bdc5 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -660,7 +660,7 @@ void ExportDialog::generateDxf( qreal offset = fontSize * 1.6; foreach (QString line, lines) { if (line.size() > 0 && line != "_" ) - Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, 0, 0.72 ); + Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, Createdxf::dxfColor(dti->color()), 0.72 ); x += offset * xdir; y -= offset * ydir; } diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index 89f99b90e..adac49f45 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -965,30 +965,28 @@ bool QetShapeItem::toDXF(const QString &filepath,const QPen &pen) switch (m_shapeType) { case Line: - Createdxf::drawLine(filepath, - QLineF(mapToScene(m_P1), - mapToScene(m_P2)), - Createdxf::getcolorCode(pen.color().red(), - pen.color().green(), - pen.color().blue())); - return true; + Createdxf::drawLine(filepath, + QLineF( mapToScene(m_P1), + mapToScene(m_P2)), + Createdxf::dxfColor(pen)); + return true; case Rectangle: - Createdxf::drawRectangle(filepath, - QRectF(mapToScene(m_P1), - mapToScene(m_P2)).normalized(), - Createdxf::getcolorCode(pen.color().red(), - pen.color().green(), - pen.color().blue())); - return true; + Createdxf::drawRectangle(filepath, + QRectF(mapToScene(m_P1), + mapToScene(m_P2)).normalized(), + Createdxf::dxfColor(pen)); + return true; case Ellipse: - Createdxf::drawEllipse (filepath, - QRectF(mapToScene(m_P1), - mapToScene(m_P2)).normalized(), - Createdxf::getcolorCode(pen.color().red(), - pen.color().green(), - pen.color().blue())); - return true; - default: return false; + Createdxf::drawEllipse(filepath, + QRectF(mapToScene(m_P1), + mapToScene(m_P2)).normalized(), + Createdxf::dxfColor(pen)); + return true; + case Polygon: + Createdxf::drawPolygon(filepath,m_polygon,Createdxf::dxfColor(pen)); + return true; + default: + return false; } } From 45137987ab31b928410ad34903d2db10b65c58be Mon Sep 17 00:00:00 2001 From: David Varley Date: Tue, 22 Sep 2020 19:47:02 +1000 Subject: [PATCH 32/34] DXF - remove a couple of debug messages --- sources/createdxf.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 445ff9b26..6fc210268 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -986,12 +986,10 @@ void Createdxf::drawPolygon( const QPolygonF &poly, const int &colorcode) { - qDebug() << "PolygonIsClosed: " << poly.isClosed(); QPolygonF pg = poly; if(!poly.isClosed()) { - pg << poly.at(0); + pg << poly.at(0); // Close it } - qDebug() << "PolygonIsClosed: " << poly.isClosed(); drawPolyline(filepath,pg,colorcode); } From 77321f6b709a50912e90d47da6c78948c10c8497 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Tue, 22 Sep 2020 21:10:02 +0200 Subject: [PATCH 33/34] Revert "Fix deprecated QRegExp" This reverts commit 0a46b83dca7c4f26064a9b0101b9eeeddddaf4e3. see https://qelectrotech.org/forum/viewtopic.php?pid=13378#p13378 --- .../ElementsCollection/elementslocation.cpp | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index 02822a100..1fe3d90c7 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -144,9 +144,9 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const */ QString ElementsLocation::baseName() const { - QRegularExpression regexp("^.*([^/]+)\\.elmt$"); - if (regexp==QRegularExpression(m_collection_path)) { - return(regexp.namedCaptureGroups().at(1)); + QRegExp regexp("^.*([^/]+)\\.elmt$"); + if (regexp.exactMatch(m_collection_path)) { + return(regexp.capturedTexts().at(1)); } return(QString()); } @@ -241,19 +241,17 @@ void ElementsLocation::setPath(const QString &path) //The path start with project, we get the project and the path from the string else if (tmp_path.startsWith("project")) { - QRegularExpression rx - ("^project([0-9]+)\\+(embed:\\/\\/.*)$", - QRegularExpression::CaseInsensitiveOption); - if (rx==QRegularExpression(tmp_path)) + QRegExp rx("^project([0-9]+)\\+(embed:\\/\\/.*)$", Qt::CaseInsensitive); + if (rx.exactMatch(tmp_path)) { bool conv_ok; - uint project_id = rx.namedCaptureGroups().at(1).toUInt(&conv_ok); + uint project_id = rx.capturedTexts().at(1).toUInt(&conv_ok); if (conv_ok) { QETProject *project = QETApp::project(project_id); if (project) { - m_collection_path = rx.namedCaptureGroups().at(2); + m_collection_path = rx.capturedTexts().at(2); m_project = project; } } @@ -353,11 +351,11 @@ bool ElementsLocation::addToPath(const QString &string) ElementsLocation ElementsLocation::parent() const { ElementsLocation copy(*this); - QRegularExpression re1("^([a-z]+://)(.*)/*$"); - if (re1==QRegularExpression(m_collection_path)) { - QString path_proto = re1.namedCaptureGroups().at(1); - QString path_path = re1.namedCaptureGroups().at(2); - QString parent_path = path_path.remove(QRegularExpression("/*[^/]+$")); + QRegExp re1("^([a-z]+://)(.*)/*$"); + if (re1.exactMatch(m_collection_path)) { + QString path_proto = re1.capturedTexts().at(1); + QString path_path = re1.capturedTexts().at(2); + QString parent_path = path_path.remove(QRegExp("/*[^/]+$")); copy.setPath(path_proto + parent_path); } return(copy); @@ -720,14 +718,14 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const else { QString path_ = collectionPath(false); - QRegularExpression rx ("^(.*)/(.*\\.elmt)$"); + QRegExp rx ("^(.*)/(.*\\.elmt)$"); - if (rx==QRegularExpression(path_)) { + if (rx.exactMatch(path_)) { return project() ->embeddedElementCollection() ->addElementDefinition( - rx.namedCaptureGroups().at(1), - rx.namedCaptureGroups().at(2), + rx.cap(1), + rx.cap(2), xml_document .documentElement()); } From 1cf48f62e9432d818092e1c3675e96f6e226c822 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Wed, 23 Sep 2020 11:25:46 +0200 Subject: [PATCH 34/34] Fix commit "Change the way how the database is exported to file" : produce a fail to build on OSX --- sources/dataBase/projectdatabase.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index 290b5684c..da490ecf6 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -530,7 +530,7 @@ sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db) { //sqlite 3 lib isn't availlable for the moment on macosx //need some help to add sqlite3 lib on macosx compilation -#if Q_OS_MACOS +#ifdef Q_OS_MACOS return nullptr; #else sqlite3 *handle = nullptr; @@ -562,7 +562,9 @@ void projectDataBase::exportDb(projectDataBase *db, if (caption_.isEmpty()) { caption_ = tr("Exporter la base de données interne du projet"); } - +#ifdef Q_OS_MACOS + return; +#else auto dir_ = dir; if(dir_.isEmpty()) { dir_ = db->project()->filePath(); @@ -602,4 +604,5 @@ void projectDataBase::exportDb(projectDataBase *db, file_db.close(); } QSqlDatabase::removeDatabase(connection_name); +#endif }