diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 17378b89b..56725c280 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -55,11 +55,8 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) : 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 QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove -#else + // disable the QPicture-based cache to avoid rendering errors and crashes m_titleblock_template_renderer -> setUseCache(false); -#endif // dimensions par defaut du schema importBorder(BorderProperties()); @@ -239,7 +236,8 @@ void BorderTitleBlock::borderToXml(QDomElement &xml_elmt) { 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())); + // attribute from version 0.1 - leave for backwards-compatibility + xml_elmt.setAttribute("height", QString("%1").arg(diagramHeight())); } /** @@ -946,10 +944,10 @@ QString BorderTitleBlock::incrementLetters(const QString &string) { if (last_digit != 'Z') { // increments the last digit // incremente le dernier digit - last_digit = (char)(string[string.length()-1].unicode()) + 1; + last_digit = (char)(string[string.length()-1].unicode()) + 1; return(first_digits + QString(last_digit)); } else { - return(incrementLetters(first_digits) + "A"); + return(incrementLetters(first_digits) % "A"); } } } diff --git a/sources/conductornumexport.cpp b/sources/conductornumexport.cpp index a18bf527b..880fbb988 100644 --- a/sources/conductornumexport.cpp +++ b/sources/conductornumexport.cpp @@ -72,14 +72,7 @@ bool ConductorNumExport::toCsv() if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream(&file); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove - stream << wiresNum() << endl; -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.15 or later") -#endif stream << wiresNum() << &Qt::endl(stream); -#endif } else { return false; diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index 88571ce0c..eaa8080fe 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -376,31 +376,31 @@ void ConductorProperties::fromXml(QDomElement &e) */ void ConductorProperties::toSettings(QSettings &settings, const QString &prefix) const { - settings.setValue(prefix + "color", color.name()); - settings.setValue(prefix + "bicolor", m_bicolor); - settings.setValue(prefix + "color2", m_color_2.name()); - settings.setValue(prefix + "dash-size", m_dash_size); - settings.setValue(prefix + "style", writeStyle()); - settings.setValue(prefix + "type", typeToString(type)); - settings.setValue(prefix + "text", text); - settings.setValue(prefix + "text_color", text_color.name()); - settings.setValue(prefix + "formula", m_formula); - settings.setValue(prefix + "cable", m_cable); - settings.setValue(prefix + "bus", m_bus); - settings.setValue(prefix + "function", m_function); - settings.setValue(prefix + "tension_protocol", m_tension_protocol); - settings.setValue(prefix + "conductor_color", m_wire_color); - settings.setValue(prefix + "conductor_section", m_wire_section); - settings.setValue(prefix + "textsize", QString::number(text_size)); - settings.setValue(prefix + "size", QString::number(cond_size)); - settings.setValue(prefix + "displaytext", m_show_text); - 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)); + settings.setValue(prefix % "color", color.name()); + settings.setValue(prefix % "bicolor", m_bicolor); + settings.setValue(prefix % "color2", m_color_2.name()); + settings.setValue(prefix % "dash-size", m_dash_size); + settings.setValue(prefix % "style", writeStyle()); + settings.setValue(prefix % "type", typeToString(type)); + settings.setValue(prefix % "text", text); + settings.setValue(prefix % "text_color", text_color.name()); + settings.setValue(prefix % "formula", m_formula); + settings.setValue(prefix % "cable", m_cable); + settings.setValue(prefix % "bus", m_bus); + settings.setValue(prefix % "function", m_function); + settings.setValue(prefix % "tension_protocol", m_tension_protocol); + settings.setValue(prefix % "conductor_color", m_wire_color); + settings.setValue(prefix % "conductor_section", m_wire_section); + settings.setValue(prefix % "textsize", QString::number(text_size)); + settings.setValue(prefix % "size", QString::number(cond_size)); + settings.setValue(prefix % "displaytext", m_show_text); + 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)); + settings.setValue(prefix % "horizontal-alignment", me.valueToKey(m_horizontal_alignment)); + settings.setValue(prefix % "vertical-alignment", me.valueToKey(m_vertical_alignment)); singleLineProperties.toSettings(settings, prefix); } @@ -417,36 +417,36 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi 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(); + 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(); + QString setting_type = settings.value(prefix % "type", typeToString(Multi)).toString(); type = (setting_type == typeToString(Single)? Single : Multi); singleLineProperties.fromSettings(settings, prefix); - text = settings.value(prefix + "text", "_").toString(); - QColor settings_text_color = QColor(settings.value(prefix + "text_color").toString()); + text = settings.value(prefix % "text", "_").toString(); + QColor settings_text_color = QColor(settings.value(prefix % "text_color").toString()); text_color = (settings_text_color.isValid()? settings_text_color : QColor(Qt::black)); - m_formula = settings.value(prefix + "formula", "").toString(); - m_cable = settings.value(prefix + "cable", "").toString(); - m_bus = settings.value(prefix + "bus", "").toString(); - m_function = settings.value(prefix + "function", "").toString(); - m_tension_protocol = settings.value(prefix + "tension_protocol", "").toString(); - m_wire_color = settings.value(prefix + "conductor_color", "").toString(); - m_wire_section = settings.value(prefix + "conductor_section", "").toString(); - text_size = settings.value(prefix + "textsize", "7").toInt(); - cond_size = settings.value(prefix + "size", "1").toInt(); - m_show_text = settings.value(prefix + "displaytext", true).toBool(); - 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(); + m_formula = settings.value(prefix % "formula", "").toString(); + m_cable = settings.value(prefix % "cable", "").toString(); + m_bus = settings.value(prefix % "bus", "").toString(); + m_function = settings.value(prefix % "function", "").toString(); + m_tension_protocol = settings.value(prefix % "tension_protocol", "").toString(); + m_wire_color = settings.value(prefix % "conductor_color", "").toString(); + m_wire_section = settings.value(prefix % "conductor_section", "").toString(); + text_size = settings.value(prefix % "textsize", "7").toInt(); + cond_size = settings.value(prefix % "size", "1").toInt(); + m_show_text = settings.value(prefix % "displaytext", true).toBool(); + 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())); + 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()); + readStyle(settings.value(prefix % "style").toString()); } /** @@ -811,14 +811,7 @@ void ConductorProperties::readStyle(const QString &style_string) { 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); -#else -#if TODO_LIST -#pragma message("@TODO remove code QString::SkipEmptyParts for QT 5.14 or later") -#endif QStringList styles = style_string.split(";", Qt::SkipEmptyParts); -#endif QRegularExpression Rx("^(?[a-z-]+): (?[a-z-]+)$"); if (!Rx.isValid()) @@ -896,10 +889,10 @@ int SingleLineProperties::operator!=(const SingleLineProperties &other) const void SingleLineProperties::toSettings(QSettings &settings, const QString &prefix) const { - settings.setValue(prefix + "hasGround", hasGround); - settings.setValue(prefix + "hasNeutral", hasNeutral); - settings.setValue(prefix + "phases", phases); - settings.setValue(prefix + "pen", is_pen); + settings.setValue(prefix % "hasGround", hasGround); + settings.setValue(prefix % "hasNeutral", hasNeutral); + settings.setValue(prefix % "phases", phases); + settings.setValue(prefix % "pen", is_pen); } /** @@ -908,8 +901,8 @@ void SingleLineProperties::toSettings(QSettings &settings, */ void SingleLineProperties::fromSettings(QSettings &settings, const QString &prefix) { - hasGround = settings.value(prefix + "hasGround", true).toBool(); - hasNeutral = settings.value(prefix + "hasNeutral", true).toBool(); - phases = settings.value(prefix + "phases", 1).toInt(); - is_pen = settings.value(prefix + "pen", false).toBool(); + hasGround = settings.value(prefix % "hasGround", true).toBool(); + hasNeutral = settings.value(prefix % "hasNeutral", true).toBool(); + phases = settings.value(prefix % "phases", 1).toInt(); + is_pen = settings.value(prefix % "pen", false).toBool(); } diff --git a/sources/diagram.cpp b/sources/diagram.cpp index cf966db26..5623c6e93 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -213,8 +213,8 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) { .insideBorderRect() .intersected(r); - qreal limite_x = rect.x() + rect.width(); - qreal limite_y = rect.y() + rect.height(); + qreal limit_x = rect.x() + rect.width(); + qreal limit_y = rect.y() + rect.height(); int g_x = (int)ceil(rect.x()); while (g_x % xGrid) ++ g_x; @@ -222,8 +222,8 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) { while (g_y % yGrid) ++ g_y; QPolygon points; - for (int gx = g_x ; gx < limite_x ; gx += xGrid) { - for (int gy = g_y ; gy < limite_y ; gy += yGrid) { + for (int gx = g_x ; gx < limit_x ; gx += xGrid) { + for (int gy = g_y ; gy < limit_y ; gy += yGrid) { points << QPoint(gx, gy); } } @@ -1139,8 +1139,8 @@ Terminal* findTerminal(int conductor_index, assert(conductor_index == 1 || conductor_index == 2); auto str_index = QString::number(conductor_index); - QString element_index = QStringLiteral("element") + str_index; - QString terminal_index = QStringLiteral("terminal") + str_index; + QString element_index = QStringLiteral("element") % str_index; + QString terminal_index = QStringLiteral("terminal") % str_index; if (f.hasAttribute(element_index)) { QUuid element_uuid = QUuid(f.attribute(element_index)); @@ -1483,14 +1483,6 @@ bool Diagram::fromXml(QDomElement &document, if (content_ptr) { content_ptr -> m_elements = added_elements; content_ptr -> m_conductors_to_move = added_conductors; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - content_ptr -> m_text_fields = added_texts.toSet(); - content_ptr -> m_images = added_images.toSet(); - content_ptr -> m_shapes = added_shapes.toSet(); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif content_ptr -> m_text_fields = QSet( added_texts.begin(), added_texts.end()); @@ -1501,7 +1493,6 @@ bool Diagram::fromXml(QDomElement &document, added_shapes.begin(), added_shapes.end()); content_ptr->m_terminal_strip.swap(added_strips); -#endif content_ptr->m_tables.swap(added_tables); } @@ -1536,9 +1527,9 @@ void Diagram::folioSequentialsFromXml(const QDomElement &root, QStringList list; int i = 1; while (folioseq.hasAttribute(seq - + QString::number(i))) { + % QString::number(i))) { list << folioseq.attribute( - seq + QString::number(i)); + seq % QString::number(i)); i++; } hash->insert(title,list); diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index ffe249110..789e4bb86 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -93,7 +93,10 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*))); connect(m_diagram, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect())); - connect(&(m_diagram -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle())); + // TODO: review the following line. Old line commented out, been broken since commit + // "27dcd5ef007a282d1a5a7f2f3dcaefc62669d668". + // connect(&(m_diagram -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle())); + connect(&(m_diagram->border_and_titleblock), &BorderTitleBlock::informationChanged, this, &DiagramView::updateWindowTitle); connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation))); QShortcut *edit_conductor_color_shortcut = new QShortcut(QKeySequence(Qt::Key_F2), this); @@ -203,18 +206,9 @@ void DiagramView::handleElementDrop(QDropEvent *event) return; } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - diagram()->setEventInterface( - new DiagramEventAddElement( - location, diagram(), mapToScene(event->pos()))); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif diagram()->setEventInterface( new DiagramEventAddElement( location, diagram(), event->position())); -#endif //Set focus to the view to get event this->setFocus(); @@ -283,17 +277,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) { iti -> setHtml (e -> mimeData() -> text()); } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - - m_diagram->undoStack().push(new AddGraphicsObjectCommand( - iti, m_diagram, mapToScene(e->pos()))); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif m_diagram->undoStack().push(new AddGraphicsObjectCommand( iti, m_diagram, e->position())); -#endif } /** @@ -447,15 +432,7 @@ void DiagramView::mousePressEvent(QMouseEvent *e) if (m_event_interface && m_event_interface->mousePressEvent(e)) return; - //Start drag view when hold the middle button -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - if (e->button() == Qt::MidButton) -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif if (e->button() == Qt::MiddleButton) -#endif { m_drag_last_pos = e->pos(); viewport()->setCursor(Qt::ClosedHandCursor); @@ -505,14 +482,7 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e) if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return; // Drag the view -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - if (e->buttons() == Qt::MidButton) -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif if (e->buttons() == Qt::MiddleButton) -#endif { QScrollBar *h = horizontalScrollBar(); QScrollBar *v = verticalScrollBar(); @@ -573,14 +543,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e) if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return; // Stop drag view -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - if (e->button() == Qt::MidButton) -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif if (e->button() == Qt::MiddleButton) -#endif { viewport()->setCursor(Qt::ArrowCursor); } @@ -614,14 +577,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e) QMenu *menu = new QMenu(this); menu->addAction(act); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - menu->popup(e->globalPos()); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif menu->popup(e->pos()); -#endif } m_free_rubberbanding = false; diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 16d95b4f4..8dd782d35 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -180,7 +180,7 @@ void ElementsPanelWidget::reloadAndFilter() } /** - * Emit the requestForProject signal with te selected project + * Emit the requestForProject signal with the selected project */ void ElementsPanelWidget::activateProject() { diff --git a/sources/elementtextpattern.cpp b/sources/elementtextpattern.cpp index f76fae68b..71a2f9586 100644 --- a/sources/elementtextpattern.cpp +++ b/sources/elementtextpattern.cpp @@ -59,7 +59,7 @@ ExportElementTextPattern::ExportElementTextPattern(Element *elmt) : return; //Check if a conf with the same name already exist - if (QFileInfo::exists(dir.absoluteFilePath(m_name + ".xml"))) + if (QFileInfo::exists(dir.absoluteFilePath(m_name % ".xml"))) { bool r = QMessageBox::question(parentWidget(), QObject::tr("Configuration de textes"), @@ -71,7 +71,7 @@ ExportElementTextPattern::ExportElementTextPattern(Element *elmt) : } QDomDocument doc = xmlConf(); - QET::writeXmlFile(doc, dir.absoluteFilePath(m_name + ".xml")); + QET::writeXmlFile(doc, dir.absoluteFilePath(m_name % ".xml")); } /** @@ -202,7 +202,7 @@ void ImportElementTextPattern::apply(QString name, bool erase) const if(!name.endsWith(".xml")) name.append(".xml"); - QFile conf_file(QETApp::configDir() + "/element_texts_pattern/" + name); + QFile conf_file(QETApp::configDir() % "/element_texts_pattern/" % name); if(!conf_file.open(QIODevice::ReadOnly | QIODevice::Text)) return; diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 2e593ed75..0a58ed6a2 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -128,7 +128,9 @@ int ExportDialog::diagramsToExportCount() const /** Met en place la liste des schemas + Set up the schematics list @return Le widget representant la liste des schemas + The widget representing the list of schematics */ QWidget *ExportDialog::initDiagramsListPart() { @@ -139,17 +141,17 @@ QWidget *ExportDialog::initDiagramsListPart() reset_mapper_ = new QSignalMapper(this); clipboard_mapper_ = new QSignalMapper(this); - connect(preview_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_previewDiagram(int))); - connect(width_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctHeight(int))); - connect(height_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctWidth(int))); - connect(ratio_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_keepRatioChanged(int))); - connect(reset_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_resetSize(int))); - connect(clipboard_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_exportToClipBoard(int))); + connect(preview_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_previewDiagram(int))); + connect(width_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_correctHeight(int))); + connect(height_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_correctWidth(int))); + connect(ratio_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_keepRatioChanged(int))); + connect(reset_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_resetSize(int))); + connect(clipboard_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_exportToClipBoard(int))); diagrams_list_layout_ = new QGridLayout(); int line_count = 0; - diagrams_list_layout_ -> addWidget(new QLabel(tr("Titre du folio")), line_count, 1, Qt::AlignHCenter | Qt::AlignVCenter); + diagrams_list_layout_ -> addWidget(new QLabel(tr("Titre du folio")), line_count, 1, Qt::AlignHCenter | Qt::AlignVCenter); diagrams_list_layout_ -> addWidget(new QLabel(tr("Nom de fichier")), line_count, 2, Qt::AlignHCenter | Qt::AlignVCenter); diagrams_list_layout_ -> addWidget(new QLabel(tr("Dimensions")), line_count, 3, Qt::AlignHCenter | Qt::AlignVCenter); @@ -245,21 +247,28 @@ QSize ExportDialog::diagramSize(Diagram *diagram) Cette methode ajuste la largeur d'un des schemas a exporter en fonction de sa hauteur si et seulement si l'option "Conserver les proportions" est activee pour ce schema. - @param diagram_id numero du schema concerne + This method adjusts the width of one of the layouts to be exported + according to its height if, and only if, the ‘Keep proportions’ option + is enabled for this layout. + @param diagram_id numero du schema concerne / number of drawing concerned */ void ExportDialog::slot_correctWidth(int diagram_id) { // recupere l'ExportDiagramLine concernee + // retrieve the ExportDiagramLine concerned ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; if (!current_diagram) return; // ne fait rien si l'option "Conserver les proportions" n'est pas activee + // do nothing if the ‘Keep proportions’ option is not active if (!(current_diagram -> keep_ratio -> isChecked())) return; // recupere les proportions du schema + // retrieve the proportions of the diagram qreal diagram_ratio = diagramRatio(current_diagram -> diagram); // ajuste la largeur + // adjust the width current_diagram -> width -> blockSignals(true); current_diagram -> width -> setValue(qRound(current_diagram -> height -> value() * diagram_ratio)); current_diagram -> width -> blockSignals(false); @@ -269,21 +278,28 @@ void ExportDialog::slot_correctWidth(int diagram_id) Cette methode ajuste la hauteur d'un des schemas a exporter en fonction de sa largeur si et seulement si l'option "Conserver les proportions" est activee pour ce schema. - @param diagram_id numero du schema concerne + This method adjusts the height of one of the layouts to be exported + according to its width if, and only if, the ‘Keep proportions’ option + is enabled for this layout. + @param diagram_id numero du schema concerne / number of drawing concerned */ void ExportDialog::slot_correctHeight(int diagram_id) { // recupere l'ExportDiagramLine concernee + // retrieve the ExportDiagramLine concerned ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; if (!current_diagram) return; // ne fait rien si l'option "Conserver les proportions" n'est pas activee + // do nothing if the ‘Keep proportions’ option is not active if (!(current_diagram -> keep_ratio -> isChecked())) return; // recupere les proportions du schema + // retrieve the proportions of the diagram qreal diagram_ratio = diagramRatio(current_diagram -> diagram); // ajuste la hauteur + // adjust the height current_diagram -> height -> blockSignals(true); current_diagram -> height -> setValue(qRound(current_diagram -> width -> value() / diagram_ratio)); current_diagram -> height -> blockSignals(false); @@ -297,10 +313,12 @@ void ExportDialog::slot_correctHeight(int diagram_id) void ExportDialog::slot_keepRatioChanged(int diagram_id) { // recupere l'ExportDiagramLine concernee + // retrieve the ExportDiagramLine concerned ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; if (!current_diagram) return; // gere l'icone du bouton "Conserver les proportions" + // manages the ‘Keep proportions’ button icon if (current_diagram -> keep_ratio -> isChecked()) { current_diagram -> keep_ratio -> setIcon(QET::Icons::ObjectLocked); } else { @@ -308,9 +326,11 @@ void ExportDialog::slot_keepRatioChanged(int diagram_id) } // ne fait rien si l'option "Conserver les proportions" n'est pas activee + // do nothing if the ‘Keep proportions’ option is not active if (!(current_diagram -> keep_ratio -> isChecked())) return; // au contraire, si elle est activee, ajuste la hauteur en fonction de la largeur + // on the other hand, if it is active, adjusts the height according to the width slot_correctHeight(diagram_id); } @@ -770,7 +790,7 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) { // recupere le format a utiliser (acronyme et extension) QString format_acronym = export_properties.format; - QString format_extension = "." + format_acronym.toLower(); + QString format_extension = "." % format_acronym.toLower(); // determine le nom de fichier a utiliser QString diagram_path = diagram_line -> file_name -> text(); @@ -867,7 +887,7 @@ void ExportDialog::slot_checkDiagramsCount() void ExportDialog::slot_changeFilesExtension(bool force_extension) { // recupere le format a utiliser (acronyme et extension) QString format_acronym = epw -> exportProperties().format; - QString format_extension = "." + format_acronym.toLower(); + QString format_extension = "." % format_acronym.toLower(); // set maximum width / height according limitations in QPainter if ((format_extension == ".bmp") || @@ -897,11 +917,11 @@ void ExportDialog::slot_changeFilesExtension(bool force_extension) { // cas 2 : l'extension est absente if (diagram_filename_info.suffix().isEmpty()) { if (force_extension) { - diagram_filename = diagram_filename_info.completeBaseName() + format_extension; + diagram_filename = diagram_filename_info.completeBaseName() % format_extension; } } else { // cas 3 : l'extension est presente mais erronee - diagram_filename = diagram_filename_info.completeBaseName() + format_extension; + diagram_filename = diagram_filename_info.completeBaseName() % format_extension; } diagram_line -> file_name -> setText(diagram_filename); @@ -1014,7 +1034,7 @@ ExportDialog::ExportDiagramLine::ExportDiagramLine(Diagram *dia, QSize diagram_s if (diagram_title.isEmpty()) diagram_title = QObject::tr("Folio sans titre"); QString diagram_filename = diagram -> title(); if (diagram_filename.isEmpty()) diagram_filename = QObject::tr("schema"); - diagram_filename = QET::stringToFileName(diagram_index + "_" + diagram_filename); + diagram_filename = QET::stringToFileName(diagram_index % "_" % diagram_filename); title_label = new QLabel(diagram_title); diff --git a/sources/exportproperties.cpp b/sources/exportproperties.cpp index 250632624..191ac0c12 100644 --- a/sources/exportproperties.cpp +++ b/sources/exportproperties.cpp @@ -54,24 +54,24 @@ ExportProperties::~ExportProperties() void ExportProperties::toSettings(QSettings &settings, const QString &prefix) const { - settings.setValue(prefix + "path", + settings.setValue(prefix % "path", QDir::toNativeSeparators( destination_directory.absolutePath())); - settings.setValue(prefix + "format", + settings.setValue(prefix % "format", format); - settings.setValue(prefix + "drawgrid", + settings.setValue(prefix % "drawgrid", draw_grid); - settings.setValue(prefix + "drawborder", + settings.setValue(prefix % "drawborder", draw_border); - settings.setValue(prefix + "drawtitleblock", + settings.setValue(prefix % "drawtitleblock", draw_titleblock); - settings.setValue(prefix + "drawterminals", + settings.setValue(prefix % "drawterminals", draw_terminals); - settings.setValue(prefix + "drawbgtransparent", + settings.setValue(prefix % "drawbgtransparent", draw_bg_transparent); - settings.setValue(prefix + "drawcoloredconductors", + settings.setValue(prefix % "drawcoloredconductors", draw_colored_conductors); - settings.setValue(prefix + "area", + settings.setValue(prefix % "area", QET::diagramAreaToString(exported_area)); } @@ -85,30 +85,30 @@ void ExportProperties::fromSettings(QSettings &settings, QString export_path = QETApp::documentDir(); destination_directory.setPath( settings.value( - prefix + "path", + prefix % "path", export_path).toString()); if (!destination_directory.exists()) destination_directory.setPath(export_path); - format = settings.value(prefix + "format").toString(); + format = settings.value(prefix % "format").toString(); - draw_grid = settings.value(prefix + "drawgrid", + draw_grid = settings.value(prefix % "drawgrid", false).toBool(); - draw_border = settings.value(prefix + "drawborder", + draw_border = settings.value(prefix % "drawborder", true ).toBool(); - draw_titleblock = settings.value(prefix + "drawtitleblock", + draw_titleblock = settings.value(prefix % "drawtitleblock", true ).toBool(); - draw_terminals = settings.value(prefix + "drawterminals", + draw_terminals = settings.value(prefix % "drawterminals", false).toBool(); - draw_bg_transparent = settings.value(prefix + "drawbgtransparent", + draw_bg_transparent = settings.value(prefix % "drawbgtransparent", false).toBool(); draw_colored_conductors = settings.value( - prefix + "drawcoloredconductors", + prefix % "drawcoloredconductors", true ).toBool(); exported_area = QET::diagramAreaFromString( settings.value( - prefix + "area", + prefix % "area", "border").toString()); } diff --git a/sources/machine_info.cpp b/sources/machine_info.cpp index a7b6322eb..c53ed455e 100644 --- a/sources/machine_info.cpp +++ b/sources/machine_info.cpp @@ -55,43 +55,6 @@ void MachineInfo::send_info_to_debug() << QLibraryInfo::isDebugBuild(); qInfo()<< "Qt library version:" << QLibraryInfo::version(); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - qInfo()<< "Qt library location default prefix:" - << QLibraryInfo::location(QLibraryInfo::PrefixPath); - qInfo()<< "Qt library location documentation:" - << QLibraryInfo::location(QLibraryInfo::DocumentationPath); - qInfo()<< "Qt library location headers:" - << QLibraryInfo::location(QLibraryInfo::HeadersPath); - qInfo()<< "Qt library location libraries:" - << QLibraryInfo::location(QLibraryInfo::LibrariesPath); - qInfo()<< "Qt library location executables:" - << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath); - qInfo()<< "Qt library location Qt binaries:" - << QLibraryInfo::location(QLibraryInfo::BinariesPath); - qInfo()<< "Qt library location Qt plugins:" - << QLibraryInfo::location(QLibraryInfo::PluginsPath); - qInfo()<< "Qt library location installed QML extensions:" - << QLibraryInfo::location(QLibraryInfo::ImportsPath); - qInfo()<< "Qt library location installed QML extensions:" - << QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); - qInfo()<< "Qt library location dependent Qt data:" - << QLibraryInfo::location(QLibraryInfo::ArchDataPath); - qInfo()<< "Qt library location independent Qt data:" - << QLibraryInfo::location(QLibraryInfo::DataPath); - qInfo()<< "Qt library location translation:" - << QLibraryInfo::location(QLibraryInfo::TranslationsPath); - qInfo()<< "Qt library location examples:" - << QLibraryInfo::location(QLibraryInfo::ExamplesPath); - qInfo()<< "Qt library location Qt testcases:" - << QLibraryInfo::location(QLibraryInfo::TestsPath); -#ifndef Q_OS_WIN - qInfo()<< "Qt library location Qt settings:" - << QLibraryInfo::location(QLibraryInfo::SettingsPath); -#endif -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif qInfo()<< "Qt library path default prefix:" << QLibraryInfo::path(QLibraryInfo::PrefixPath); qInfo()<< "Qt library path documentation:" @@ -123,30 +86,29 @@ void MachineInfo::send_info_to_debug() #ifndef Q_OS_WIN qInfo()<< "Qt library path Qt settings:" << QLibraryInfo::path(QLibraryInfo::SettingsPath); -#endif #endif if (strlen(GIT_COMMIT_SHA)) { - qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA); + qInfo() << "GitRevision " % QString(GIT_COMMIT_SHA); } - qInfo()<< "QElectroTech V " + QetVersion::displayedVersion(); - qInfo()<< QObject::tr("Compilation : ") + pc.built.version; - qInfo()<< "Built with Qt " + pc.built.QT - + " - " + pc.built.arch - + " - Date : " + pc.built.date - + " : " + pc.built.time; - qInfo()<< "Run with Qt "+ QString(qVersion()) - + " using" - + QString(" %1 thread(s)").arg(pc.cpu.ThreadCount); - qInfo()<< "CPU : " + pc.cpu.info; + qInfo()<< "QElectroTech V " % QetVersion::displayedVersion(); + qInfo()<< QObject::tr("Compilation : ") % pc.built.version; + qInfo()<< "Built with Qt " % pc.built.QT + % " - " % pc.built.arch + % " - Date : " % pc.built.date + % " : " % pc.built.time; + qInfo()<< "Run with Qt " % QString(qVersion()) + % " using" + % QString(" %1 thread(s)").arg(pc.cpu.ThreadCount); + qInfo()<< "CPU : " % pc.cpu.info; qInfo()<< pc.ram.Total; qInfo()<< pc.ram.Available; - qInfo()<< "GPU : " + pc.gpu.info; - qInfo()<< "GPU RAM : " + pc.gpu.RAM; + qInfo()<< "GPU : " % pc.gpu.info; + qInfo()<< "GPU RAM : " % pc.gpu.RAM; - qInfo()<< "OS : " + pc.os.type - + " - " + pc.cpu.Architecture - + " - Version : "+pc.os.name - + " - Kernel : "+pc.os.kernel; + qInfo()<< "OS : " % pc.os.type + % " - " % pc.cpu.Architecture + % " - Version : " % pc.os.name + % " - Kernel : " % pc.os.kernel; qInfo()<< ""; qInfo()<< " OS System language:"<< QLocale::system().name(); @@ -171,8 +133,8 @@ void MachineInfo::send_info_to_debug() qInfo()<< " App Config Location:"<< QETApp::configDir(); qInfo()<< " For data-files (user-/company-collections, titleblocks, etc.):"; qInfo()<< " App Data Location:"<< QETApp::dataDir(); - qInfo()<< " Directory for project stalefiles:"; - qInfo()<< " Generic Data Location:"<< QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/stalefiles/QElectroTech/"; + qInfo()<< " Directory for project's autosave files (stalefiles):"; + qInfo()<< " Autosave:"<< QETApp::autosaveDir() % "/autosave"; // qInfo()<< " App Local DataLocation:"<< QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); // qInfo()<< " Home Location:"<< QStandardPaths::writableLocation(QStandardPaths::HomeLocation); // qInfo()<< " Runtime Location:"<< QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); @@ -452,29 +414,29 @@ int32_t MachineInfo::i_max_screen_height() { */ QString MachineInfo::compilation_info() { - QString compilation_info = "
" + QObject::tr("Compilation : "); + QString compilation_info = "
" % QObject::tr("Compilation : "); compilation_info +=pc.built.version; - compilation_info += "
Built with Qt " + pc.built.QT; - compilation_info += " - " + pc.built.arch; - compilation_info += " - Date : " + pc.built.date; - compilation_info += " : " + pc.built.time; + compilation_info += "
Built with Qt " % pc.built.QT; + compilation_info += " - " % pc.built.arch; + compilation_info += " - Date : " % pc.built.date; + compilation_info += " : " % pc.built.time; if (strlen(GIT_COMMIT_SHA)) { - compilation_info += "
Git Revision : " + QString(GIT_COMMIT_SHA); + compilation_info += "
Git Revision : " % QString(GIT_COMMIT_SHA); } - compilation_info += "
Run with Qt " + QString(qVersion()); + compilation_info += "
Run with Qt " % QString(qVersion()); compilation_info += " using" + QString(" %1 thread(s)").arg(pc.cpu.ThreadCount); - compilation_info += "
CPU : " + pc.cpu.info; - compilation_info += "
" + pc.ram.Total; - compilation_info += "
" + pc.ram.Available; - compilation_info += "
GPU : " + pc.gpu.info; - compilation_info += "
GPU RAM : " + pc.gpu.RAM; + compilation_info += "
CPU : " % pc.cpu.info; + compilation_info += "
" % pc.ram.Total; + compilation_info += "
" % pc.ram.Available; + compilation_info += "
GPU : " % pc.gpu.info; + compilation_info += "
GPU RAM : " % pc.gpu.RAM; - compilation_info += "
OS : " + pc.os.type; - compilation_info += " - " + pc.cpu.Architecture; - compilation_info += " - Version : "+pc.os.name; - compilation_info += "
- Kernel : "+pc.os.kernel; + compilation_info += "
OS : " % pc.os.type; + compilation_info += " - " % pc.cpu.Architecture; + compilation_info += " - Version : " % pc.os.name; + compilation_info += "
- Kernel : " % pc.os.kernel; compilation_info += "
*** Qt screens ***
"; for (int ii = 0; ii < pc.screen.count; ++ii) { diff --git a/sources/machine_info.h b/sources/machine_info.h index a3a7201b6..9d069792e 100644 --- a/sources/machine_info.h +++ b/sources/machine_info.h @@ -84,12 +84,12 @@ class MachineInfo QString version= #ifdef __GNUC__ #ifdef __APPLE_CC__ - "CLANG " + QString(__clang_version__); + "CLANG " % QString(__clang_version__); #else - "GCC " + QString(__VERSION__); + "GCC " % QString(__VERSION__); #endif #elif defined(Q_CC_MSVC) - "MSVC " + QString(QT_STRINGIFY(_MSC_FULL_VER)); + "MSVC " % QString(QT_STRINGIFY(_MSC_FULL_VER)); #endif QString QT=QString(QT_VERSION_STR); QString date=QString(__DATE__); diff --git a/sources/print/projectprintwindow.cpp b/sources/print/projectprintwindow.cpp index 89ef7553c..1b0073d8b 100644 --- a/sources/print/projectprintwindow.cpp +++ b/sources/print/projectprintwindow.cpp @@ -24,13 +24,6 @@ #include "ui_projectprintwindow.h" -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove -# include -#else -# if TODO_LIST -# pragma message("@TODO remove code for QT 6 or later") -# endif -#endif #include #include #include @@ -50,14 +43,7 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma auto printer_ = new QPrinter(); QPrinter printer(QPrinter::HighResolution); printer_->setDocName(ProjectPrintWindow::docName(project)); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - printer_->setOrientation(QPrinter::Landscape); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -# endif printer_->setPageOrientation(QPageLayout::Landscape); -#endif if (format == QPrinter::NativeFormat) //To physical printer { @@ -66,15 +52,7 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma print_dialog.setWindowFlags(Qt::Sheet); #endif print_dialog.setWindowTitle(tr("Options d'impression", "window title")); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - print_dialog.setEnabledOptions(QAbstractPrintDialog::PrintShowPageSize); -#else print_dialog.setOptions(QAbstractPrintDialog::PrintShowPageSize); -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif - qDebug()<<"Help code for QT 6 or later"; -#endif if (print_dialog.exec() == QDialog::Rejected) { delete printer_; return; @@ -83,7 +61,7 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma else //To pdf file { auto dir_path = project->currentDir(); - QString file_name = QDir::toNativeSeparators(QDir::cleanPath(dir_path + "/" + printer_->docName())); + QString file_name = QDir::toNativeSeparators(QDir::cleanPath(dir_path % "/" % printer_->docName())); if (!file_name.endsWith(".pdf")) { file_name.append(".pdf"); } @@ -191,23 +169,21 @@ ProjectPrintWindow::~ProjectPrintWindow() */ void ProjectPrintWindow::requestPaint() { - #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - #ifdef Q_OS_WIN - #ifdef QT_DEBUG - qDebug() << "--"; - qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution(); - qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber(); - #endif + #ifdef Q_OS_WIN + #ifdef QT_DEBUG + qDebug() << "--"; + qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution(); + qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber(); + #endif - QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber()); - qreal dotsPerInch = (qreal)srn->logicalDotsPerInch(); - m_printer->setResolution(dotsPerInch); + QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber()); + qreal dotsPerInch = (qreal)srn->logicalDotsPerInch(); + m_printer->setResolution(dotsPerInch); - #ifdef QT_DEBUG - qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch; - qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << m_printer->resolution(); - qDebug() << "--"; - #endif + #ifdef QT_DEBUG + qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch; + qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << m_printer->resolution(); + qDebug() << "--"; #endif #endif @@ -260,15 +236,8 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter diagram->render(painter, QRectF(), diagram_rect, Qt::KeepAspectRatio); } else { // Print on one or several pages -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - auto printed_rect = full_page ? printer->paperRect() : printer->pageRect(); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif - qDebug()<<"Help code for QT 6 or later"; - auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) : printer->pageRect(QPrinter::Millimeter); -#endif + auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) + : printer->pageRect(QPrinter::Millimeter); auto used_width = printed_rect.width(); auto used_height = printed_rect.height(); auto h_pages_count = horizontalPagesCount(diagram, option, full_page); @@ -277,24 +246,17 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter QVector> page_grid; //The diagram is printed on a matrix of sheet //scrolls through the rows of the matrix - auto y_offset = 0; + qreal y_offset = 0; for (auto i=0 ; i(); //scrolls through the lines of sheet - auto x_offset = 0; + qreal x_offset = 0; for (auto j=0 ; jpaperRect() : m_printer->pageRect(); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -# endif printable_area = full_page ? m_printer->pageLayout().fullRectPixels(m_printer->resolution()) : m_printer->pageLayout().paintRectPixels(m_printer->resolution()); -#endif QRect diagram_rect = diagramRect(diagram, option); int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width()))); @@ -388,17 +343,10 @@ int ProjectPrintWindow::verticalPagesCount( Diagram *diagram, const ExportProperties &option, bool full_page) const { QRect printable_area; -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - printable_area = full_page ? m_printer->paperRect() : m_printer->pageRect(); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -# endif printable_area = full_page ? m_printer->pageLayout().fullRectPixels(m_printer->resolution()) : m_printer->pageLayout().paintRectPixels(m_printer->resolution()); -#endif QRect diagram_rect = diagramRect(diagram, option); int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height()))); @@ -469,43 +417,6 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter() } settings.beginGroup(printer_section); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - if (settings.contains("orientation")) { - QString value = settings.value("orientation", "landscape").toString(); - m_printer -> setOrientation(value == "landscape" ? QPrinter::Landscape : QPrinter::Portrait); - } - if (settings.contains("papersize")) { - int value = settings.value("papersize", QPrinter::A4).toInt(); - if (value == QPrinter::Custom) { - bool w_ok, h_ok; - int w = settings.value("customwidthmm", -1).toInt(&w_ok); - int h = settings.value("customheightmm", -1).toInt(&h_ok); - if (w_ok && h_ok && w != -1 && h != -1) { - m_printer -> setPaperSize(QSizeF(w, h), QPrinter::Millimeter); - } - } else if (value < QPrinter::Custom) { - m_printer -> setPaperSize(static_cast(value)); - } - } - - qreal margins[4]; - m_printer -> getPageMargins(&margins[0], &margins[1], &margins[2], &margins[3], QPrinter::Millimeter); - QStringList margins_names(QStringList() << "left" << "top" << "right" << "bottom"); - for (int i = 0 ; i < 4 ; ++ i) { - bool conv_ok; - qreal value = settings.value("margin" + margins_names.at(i), -1.0).toReal(&conv_ok); - if (conv_ok && value != -1.0) margins[i] = value; - } - m_printer->setPageMargins( - margins[0], - margins[1], - margins[2], - margins[3], - QPrinter::Millimeter); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -# endif if (settings.contains("orientation")) { QString value = settings.value("orientation", "landscape").toString(); @@ -551,14 +462,13 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter() for (int i = 0; i < 4; ++i) { bool conv_ok; - qreal value = settings.value("margin" + margins_names.at(i), -1.0) + qreal value = settings.value("margin" % margins_names.at(i), -1.0) .toReal(&conv_ok); if (conv_ok && value != -1.0) margins[i] = value; } m_printer->setPageMargins( QMarginsF(margins[0], margins[1], margins[2], margins[3]), QPageLayout::Millimeter); -#endif m_printer->setFullPage( settings.value("fullpage", "false").toString() == "true"); @@ -575,35 +485,6 @@ void ProjectPrintWindow::savePageSetupForCurrentPrinter() settings.beginGroup("printers"); settings.beginGroup(printer_section); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove - settings.setValue("orientation", m_printer -> orientation() == QPrinter::Portrait ? "portrait" : "landscape"); - settings.setValue("papersize", int(m_printer -> paperSize())); - if (m_printer -> paperSize() == QPrinter::Custom) { - QSizeF size = m_printer -> paperSize(QPrinter::Millimeter); - settings.setValue("customwidthmm", size.width()); - settings.setValue("customheightmm", size.height()); - } else { - settings.remove("customwidthmm"); - settings.remove("customheightmm"); - } - qreal left, top, right, bottom; - m_printer - ->getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter); - settings.setValue("marginleft", left); - settings.setValue("margintop", top); - settings.setValue("marginright", right); - settings.setValue("marginbottom", bottom); - settings.setValue("fullpage", m_printer->fullPage() ? "true" : "false"); - settings.endGroup(); - settings.endGroup(); - settings.sync(); - -#else -# if TODO_LIST -# pragma message("@TODO remove code for QT 6 or later") -# endif - qDebug() << "Help code for QT 6 or later"; - settings.setValue( "orientation", m_printer->pageLayout().orientation() == QPageLayout::Portrait ? @@ -634,7 +515,6 @@ void ProjectPrintWindow::savePageSetupForCurrentPrinter() settings.endGroup(); settings.endGroup(); settings.sync(); -#endif } /** diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index 54493e481..247ce9c1e 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -217,7 +217,7 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); - connect(signal_mapper, SIGNAL(mapped(int)), rename_dialog, SLOT(done(int))); + connect(signal_mapper, SIGNAL(mappedInt(int)), rename_dialog, SLOT(done(int))); } rd_label -> setText( QString(tr( @@ -312,7 +312,7 @@ void TitleBlockTemplateLogoManager::exportLogo() QString filepath = QFileDialog::getSaveFileName( this, tr("Choisir un fichier pour exporter ce logo"), - open_dialog_dir_.absolutePath() + "/" + current_logo, + open_dialog_dir_.absolutePath() % "/" + current_logo, tr("Tous les fichiers (*);;Images vectorielles (*.svg);;Images bitmap (*.png *.jpg *.jpeg *.gif *.bmp *.xpm)") ); if (filepath.isEmpty()) return;