From 0b91318749ef912a9fa2e229e15517aa100ef01b Mon Sep 17 00:00:00 2001 From: joshua Date: Thu, 19 Mar 2026 19:54:51 +0100 Subject: [PATCH] Remove several QT_VERSION_CHECK Remove several QT_VERSION_CHECK related to Qt5 and Qt4. --- .../elementscollectionwidget.cpp | 8 +--- .../ElementsCollection/elementstreeview.cpp | 6 +-- sources/TerminalStrip/physicalterminal.cpp | 5 -- sources/TerminalStrip/terminalstripdata.cpp | 5 +- .../ui/terminalstriptreedockwidget.cpp | 8 ---- sources/bordertitleblock.cpp | 4 -- sources/conductornumexport.cpp | 7 --- sources/conductorproperties.cpp | 7 --- sources/dataBase/ui/elementquerywidget.cpp | 8 +--- sources/diagram.cpp | 9 ---- sources/diagramview.cpp | 47 +------------------ sources/editor/editorcommands.cpp | 14 ------ sources/editor/elementview.cpp | 21 --------- .../graphicspart/customelementgraphicpart.cpp | 7 --- .../ui/elementpropertieseditorwidget.cpp | 2 - sources/factory/elementpicturefactory.cpp | 7 --- sources/main.cpp | 19 +------- sources/qet.cpp | 35 +------------- sources/qetapp.cpp | 7 --- .../ui/graphicstablepropertieseditor.cpp | 12 +---- sources/qetgraphicsitem/conductor.cpp | 7 --- sources/qetxml.cpp | 7 --- sources/qtextorientationwidget.cpp | 14 ------ sources/richtext/richtexteditor.cpp | 10 ---- sources/titleblocktemplate.cpp | 18 +------ sources/ui/bomexportdialog.cpp | 7 --- .../configpage/generalconfigurationpage.cpp | 6 --- sources/utils/qetsettings.cpp | 2 - sources/utils/qetsettings.h | 2 - 29 files changed, 13 insertions(+), 298 deletions(-) diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 56d793463..9af5274a2 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -765,14 +765,8 @@ void ElementsCollectionWidget::search() } hideCollection(true); -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - const QStringList text_list = text.split("+", QString::SkipEmptyParts); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif + const QStringList text_list = text.split("+", Qt::SkipEmptyParts); -#endif QModelIndexList match_index; for (QString txt : text_list) { match_index << m_model->match(m_showed_index.isValid() diff --git a/sources/ElementsCollection/elementstreeview.cpp b/sources/ElementsCollection/elementstreeview.cpp index 13b4a793a..981450362 100644 --- a/sources/ElementsCollection/elementstreeview.cpp +++ b/sources/ElementsCollection/elementstreeview.cpp @@ -82,11 +82,7 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location) { if (! location.exist()) return; -#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0) - QDrag* drag = new QDrag(this); -#else - QScopedPointer drag(new QDrag(this)); -#endif + auto drag = new QDrag{this}; QString location_str = location.toString(); QMimeData *mime_data = new QMimeData(); diff --git a/sources/TerminalStrip/physicalterminal.cpp b/sources/TerminalStrip/physicalterminal.cpp index c2db79c2f..05163c805 100644 --- a/sources/TerminalStrip/physicalterminal.cpp +++ b/sources/TerminalStrip/physicalterminal.cpp @@ -130,12 +130,7 @@ bool PhysicalTerminal::setLevelOf(const QSharedPointer &terminal, const int i = m_real_terminal.indexOf(terminal); if (i >= 0) { -#if QT_VERSION >= QT_VERSION_CHECK(5,14,0) m_real_terminal.swapItemsAt(i, std::min(static_cast(level), m_real_terminal.size()-1)); -#else - auto j = std::min(level, m_real_terminal.size()-1); - std::swap(m_real_terminal.begin()[i], m_real_terminal.begin()[j]); -#endif return true; } return false; diff --git a/sources/TerminalStrip/terminalstripdata.cpp b/sources/TerminalStrip/terminalstripdata.cpp index bee4efbe6..04318f0a1 100644 --- a/sources/TerminalStrip/terminalstripdata.cpp +++ b/sources/TerminalStrip/terminalstripdata.cpp @@ -64,11 +64,8 @@ bool TerminalStripData::fromXml(const QDomElement &xml_element) "due to wrong tag name. Expected " << this->xmlTagName() << " used " << xml_element.tagName(); return false; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid"))); -#else - m_uuid = QUuid(xml_element.attribute(QStringLiteral("uuid"))); -#endif for (auto &xml_info : QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")), diff --git a/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp b/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp index 59150afbd..7ea3a4c0f 100644 --- a/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp +++ b/sources/TerminalStrip/ui/terminalstriptreedockwidget.cpp @@ -35,11 +35,7 @@ TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QW ui->setupUi(this); setProject(project); -#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex()); -#else - ui->m_tree_view->expandAll(); -#endif } TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget() @@ -93,11 +89,7 @@ void TerminalStripTreeDockWidget::reload() buildTree(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex()); -#else - ui->m_tree_view->expandAll(); -#endif //Reselect the tree widget item of the current edited strip auto item = m_item_strip_H.key(current_); diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 5b884d015..987f14afc 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -55,11 +55,7 @@ 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 m_titleblock_template_renderer -> setUseCache(false); -#endif // dimensions par defaut du schema importBorder(BorderProperties()); diff --git a/sources/conductornumexport.cpp b/sources/conductornumexport.cpp index d46f5ecbd..0bbbc658c 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 71e552ea4..da3f849d5 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -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()) diff --git a/sources/dataBase/ui/elementquerywidget.cpp b/sources/dataBase/ui/elementquerywidget.cpp index 7cdac3cd1..903b22fce 100644 --- a/sources/dataBase/ui/elementquerywidget.cpp +++ b/sources/dataBase/ui/elementquerywidget.cpp @@ -47,14 +47,8 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) : m_button_group.addButton(ui->m_coil_cb, 4); m_button_group.addButton(ui->m_protection_cb, 5); m_button_group.addButton(ui->m_thumbnail_cb, 6); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove - connect(&m_button_group, static_cast(&QButtonGroup::buttonClicked), [this](int id) -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.15 or later") -#endif + connect(&m_button_group, static_cast(&QButtonGroup::idClicked), [this](int id) -#endif { auto check_box = static_cast(m_button_group.button(0)); if (id == 0) diff --git a/sources/diagram.cpp b/sources/diagram.cpp index e875c30d2..ce26d3d0a 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -1514,14 +1514,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()); @@ -1532,7 +1524,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); } diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index da74601c1..85cbaeca4 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -203,18 +203,10 @@ 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 +275,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 } /** @@ -451,14 +434,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); @@ -508,14 +484,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(); @@ -576,14 +545,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); } @@ -617,14 +579,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/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index dafe10661..7646ab88d 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -276,14 +276,7 @@ void ChangeZValueCommand::applyRaise(const QList &items_list) { for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) { if (my_items_list[i] -> isSelected()) { if (!my_items_list[i +1] -> isSelected()) { -#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove - my_items_list.swap(i, i + 1); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.13 or later") -#endif my_items_list.swapItemsAt(i, i + 1); -#endif } } } @@ -301,14 +294,7 @@ void ChangeZValueCommand::applyLower(const QList &items_list) { for (int i = 1 ; i < my_items_list.count() ; ++ i) { if (my_items_list[i] -> isSelected()) { if (!my_items_list[i - 1] -> isSelected()) { -#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove - my_items_list.swap(i, i - 1); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.13 or later") -#endif my_items_list.swapItemsAt(i, i - 1); -#endif } } } diff --git a/sources/editor/elementview.cpp b/sources/editor/elementview.cpp index a2cc8af58..69b1984fb 100644 --- a/sources/editor/elementview.cpp +++ b/sources/editor/elementview.cpp @@ -372,14 +372,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) { */ void ElementView::mousePressEvent(QMouseEvent* e) { -#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 { setCursor( (Qt::ClosedHandCursor)); reference_view_ = e->pos(); @@ -394,14 +387,7 @@ void ElementView::mousePressEvent(QMouseEvent* e) */ void ElementView::mouseMoveEvent(QMouseEvent* e) { -#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(); @@ -420,14 +406,7 @@ void ElementView::mouseMoveEvent(QMouseEvent* e) */ void ElementView::mouseReleaseEvent(QMouseEvent* e) { -#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 { setCursor(Qt::ArrowCursor); adjustSceneRect(); diff --git a/sources/editor/graphicspart/customelementgraphicpart.cpp b/sources/editor/graphicspart/customelementgraphicpart.cpp index f4142943a..6a02cbf39 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.cpp +++ b/sources/editor/graphicspart/customelementgraphicpart.cpp @@ -519,14 +519,7 @@ 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); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts); -#endif //Check each pair of style QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 7ed277efb..f38d8efda 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -267,11 +267,9 @@ void ElementPropertiesEditorWidget::on_m_base_type_cb_currentIndexChanged(int in ui->m_master_gb->setVisible(master); ui->m_terminal_gb->setVisible(terminal); -#if QT_VERSION >= QT_VERSION_CHECK(5,15,0) ui->tabWidget->setTabVisible(1, (type_ == ElementData::Simple || type_ == ElementData::Master)); -#endif updateTree(); } diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index 1f8af820b..f75dd9f2c 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -567,14 +567,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa pen.setCapStyle(Qt::SquareCap); //Get the couples style/value -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts); -#endif QRegularExpression rx("^(?[a-z-]+):(?[a-zA-Z-]+)$"); if (!rx.isValid()) diff --git a/sources/main.cpp b/sources/main.cpp index 43fa9c987..b7852f216 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -174,24 +174,9 @@ int main(int argc, char **argv) QCoreApplication::setApplicationName("QElectroTech"); //Creation and execution of the application //HighDPI -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif -#endif - -#if QT_VERSION > QT_VERSION_CHECK(5, 7, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#endif - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -qputenv("QT_ENABLE_HIGHDPI_SCALING", "1"); -QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy()); -#endif + qputenv("QT_ENABLE_HIGHDPI_SCALING", "1"); + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy()); SingleApplication app(argc, argv, true); diff --git a/sources/qet.cpp b/sources/qet.cpp index 03a1e138d..5a20ff2c9 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -183,16 +183,7 @@ bool QET::orthogonalProjection( // determine le point d'intersection des deux droites = le projete orthogonal QPointF intersection_point; -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif - QLineF::IntersectType it = line. -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - intersect // ### Qt 6: remove -#else - intersects -#endif - (perpendicular_line, &intersection_point); + QLineF::IntersectType it = line.intersects(perpendicular_line, &intersection_point); // ne devrait pas arriver (mais bon...) if (it == QLineF::NoIntersection) return(false); @@ -545,16 +536,8 @@ QString QET::joinWithSpaces(const QStringList &string_list) { QStringList QET::splitWithSpaces(const QString &string) { // les chaines sont separees par des espaces non echappes // = avec un nombre nul ou pair de backslashes devant -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif QStringList escaped_strings = string.split(QRegularExpression("[^\\]?(?:\\\\)* "), -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - QString -#else - Qt -#endif - ::SkipEmptyParts); + Qt::SkipEmptyParts); QStringList returned_list; foreach(QString escaped_string, escaped_strings) { @@ -684,14 +667,7 @@ bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString * } QTextStream out(&file); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - out.setCodec("UTF-8"); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif out.setEncoding(QStringConverter::Utf8); -#endif out.setGenerateByteOrderMark(false); out << xml_doc.toString(4); if (!file.commit()) @@ -822,14 +798,7 @@ bool QET::writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message QTextStream out(file); out.seek(0); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - out.setCodec("UTF-8"); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif out.setEncoding(QStringConverter::Utf8); -#endif out.setGenerateByteOrderMark(false); out << xml_doc.toString(4); if (opened_here) { diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index f4e14ad57..183fc66aa 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -202,14 +202,7 @@ void QETApp::setLanguage(const QString &desired_language) { QString languages_path = languagesPath(); // load Qt library translations -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - QString qt_l10n_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif QString qt_l10n_path = QLibraryInfo::path(QLibraryInfo::TranslationsPath); -#endif if (!qtTranslator.load("qt_" + desired_language, qt_l10n_path)) { qWarning() << "failed to load" diff --git a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp index d0bb1a929..4f58e6741 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp +++ b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp @@ -451,16 +451,8 @@ void GraphicsTablePropertiesEditor::setUpEditConnection() m_edit_connection << connect(ui->m_table_left_margin, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply); m_edit_connection << connect(ui->m_table_right_margin, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply); m_edit_connection << connect(ui->m_table_bottom_margin, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove - m_edit_connection << connect(m_table_button_group, QOverload::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply); - m_edit_connection << connect(m_header_button_group, QOverload::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.15 or later") -#endif - m_edit_connection << connect(m_table_button_group, QOverload::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply); - m_edit_connection << connect(m_header_button_group, QOverload::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply); -#endif + m_edit_connection << connect(m_table_button_group, QOverload::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply); + m_edit_connection << connect(m_header_button_group, QOverload::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply); m_edit_connection << connect(ui->m_display_n_row_sb, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply); m_edit_connection << connect(ui->m_display_n_row_sb, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel); } diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 73d2e3ac3..00f263ceb 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1725,14 +1725,7 @@ QSet Conductor::relatedPotentialConductors(const bool all_diagram, for (Conductor *c : other_conductors_list_t) { other_conductors += c->relatedPotentialConductors(all_diagram, t_list); } -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - other_conductors += other_conductors_list_t.toSet(); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif other_conductors += QSet(other_conductors_list_t.begin(),other_conductors_list_t.end()); -#endif } } diff --git a/sources/qetxml.cpp b/sources/qetxml.cpp index 92db3f787..afa6c125d 100644 --- a/sources/qetxml.cpp +++ b/sources/qetxml.cpp @@ -276,14 +276,7 @@ bool QETXML::writeXmlFile( } QTextStream out(&file); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - out.setCodec("UTF-8"); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif out.setEncoding(QStringConverter::Utf8); -#endif out.setGenerateByteOrderMark(false); out << xml_document.toString(4); file.close(); diff --git a/sources/qtextorientationwidget.cpp b/sources/qtextorientationwidget.cpp index 307fd5e42..d104aeb6e 100644 --- a/sources/qtextorientationwidget.cpp +++ b/sources/qtextorientationwidget.cpp @@ -255,14 +255,7 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) { */ void QTextOrientationWidget::mouseMoveEvent(QMouseEvent *event) { if (read_only_) return; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - bool drawn_angle_hovered = positionIsASquare(event -> localPos(), &highlight_angle_); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif bool drawn_angle_hovered = positionIsASquare(event -> position(), &highlight_angle_); -#endif if (must_highlight_angle_ != drawn_angle_hovered) { must_highlight_angle_ = drawn_angle_hovered; @@ -278,14 +271,7 @@ void QTextOrientationWidget::mouseReleaseEvent(QMouseEvent *event) { if (read_only_) return; double clicked_angle; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - bool drawn_angle_clicked = positionIsASquare(event -> localPos(), &clicked_angle); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -#endif bool drawn_angle_clicked = positionIsASquare(event -> position(), &clicked_angle); -#endif if (drawn_angle_clicked) { setOrientation(clicked_angle); emit(orientationChanged(clicked_angle)); diff --git a/sources/richtext/richtexteditor.cpp b/sources/richtext/richtexteditor.cpp index cfc9e270d..a001fb4a3 100644 --- a/sources/richtext/richtexteditor.cpp +++ b/sources/richtext/richtexteditor.cpp @@ -77,11 +77,7 @@ #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) #include -#else -#define QStringView QStringRef -#endif QT_BEGIN_NAMESPACE @@ -745,14 +741,8 @@ QString RichTextEditor::text(Qt::TextFormat format) const return m_simplifyRichText ? simplifyRichTextFilter(toHtml()) : toHtml(); case Qt::AutoText: break; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif case Qt::MarkdownText: //This enum value was added in Qt 5.14. break; -#endif default: qInfo("(RichTextEditor::text) no valid switch: %d",format); break; diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 122705d3f..96e4e2f88 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -394,16 +394,9 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) { QRegularExpression::CaseInsensitiveOption); bool conv_ok; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - QStringList rows_descriptions = - rows_string.split(QChar(';'), QString::SkipEmptyParts); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif QStringList rows_descriptions = rows_string.split(QChar(';'), Qt::SkipEmptyParts); -#endif + foreach (QString rows_description, rows_descriptions) { QRegularExpressionMatch match; match = row_size_format.match(rows_description); @@ -436,16 +429,9 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) { bool conv_ok; qDebug() <<"is QRegularExpression ok?"; -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove - QStringList cols_descriptions = - cols_string.split(QChar(';'), QString::SkipEmptyParts); -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.14 or later") -#endif QStringList cols_descriptions = cols_string.split(QChar(';'), Qt::SkipEmptyParts); -#endif + foreach (QString cols_description, cols_descriptions) { QRegularExpressionMatch match_abc,match_rel; match_abc = abs_col_size_format.match(cols_description); diff --git a/sources/ui/bomexportdialog.cpp b/sources/ui/bomexportdialog.cpp index 81a78615b..63429ede7 100644 --- a/sources/ui/bomexportdialog.cpp +++ b/sources/ui/bomexportdialog.cpp @@ -83,14 +83,7 @@ int BOMExportDialog::exec() if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream(&file); -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove - stream << getBom() << endl; -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 5.15 or later") -#endif stream << getBom() << &Qt::endl(stream); -#endif } } } diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index 30891f5fa..df4fe12e2 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.cpp @@ -40,9 +40,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : QSettings settings; //Appearance tab -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ###Qt 6:remove - ui->m_hdpi_round_policy_widget->setDisabled(true); -#else ui->m_hdpi_round_policy_cb->addItem(tr("Arrondi supérieur pour 0.5 et plus"), QLatin1String("Round")); ui->m_hdpi_round_policy_cb->addItem(tr("Toujours arrondi supérieur"), QLatin1String("Ceil")); ui->m_hdpi_round_policy_cb->addItem(tr("Toujours arrondi inférieur"), QLatin1String("Floor")); @@ -65,7 +62,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ui->m_hdpi_round_policy_cb->setCurrentIndex(4); break; } -#endif ui->DiagramEditor_xGrid_sb->setValue(settings.value("diagrameditor/Xgrid", 10).toInt()); ui->DiagramEditor_yGrid_sb->setValue(settings.value("diagrameditor/Ygrid", 10).toInt()); ui->DiagramEditor_xKeyGrid_sb->setValue(settings.value("diagrameditor/key_Xgrid", 10).toInt()); @@ -204,10 +200,8 @@ void GeneralConfigurationPage::applyConf() settings.setValue("lang", ui->m_lang_cb->itemData(ui->m_lang_cb->currentIndex()).toString()); //hdpi -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QetSettings::setHdpiScaleFactorRoundingPolicy(ui->m_hdpi_round_policy_cb->currentData().toString()); QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy()); -#endif //ELEMENT EDITOR settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText()); diff --git a/sources/utils/qetsettings.cpp b/sources/utils/qetsettings.cpp index 7d5fb43b3..3b2e7a5ac 100644 --- a/sources/utils/qetsettings.cpp +++ b/sources/utils/qetsettings.cpp @@ -22,7 +22,6 @@ namespace QetSettings { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) /** * @brief setHdpiScaleFactorRoundingPolicy * Write the value of HdpiScaleFactorRoundingPolicy in @@ -106,5 +105,4 @@ namespace QetSettings return default_policy; } } -#endif } diff --git a/sources/utils/qetsettings.h b/sources/utils/qetsettings.h index b145df15d..857c37796 100644 --- a/sources/utils/qetsettings.h +++ b/sources/utils/qetsettings.h @@ -28,12 +28,10 @@ */ namespace QetSettings { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) void setHdpiScaleFactorRoundingPolicy(const QString &policy_str); void setHdpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy policy); Qt::HighDpiScaleFactorRoundingPolicy hdpiScaleFactorRoundingPolicy( Qt::HighDpiScaleFactorRoundingPolicy default_policy = Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); -#endif } #endif // QETSETTINGS_H