diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index ad9e23a9a..075ea9b82 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -778,30 +778,6 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const //Element doesn't exist, we create the element else { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - QString path_ = collectionPath(false); - QRegExp rx ("^(.*)/(.*\\.elmt)$"); - - if (rx.exactMatch(path_)) { - return project() - ->embeddedElementCollection() - ->addElementDefinition( - rx.cap(1), - rx.cap(2), - xml_document - .documentElement()); - } - else { - qDebug() << "ElementsLocation::setXml :" - " rx don't match"; - } -#else -#if TODO_LIST -#pragma message("@TODO remove code for QT 6 or later") -# pragma message("@TODO ad Core5Compat to Cmake") -#endif - qDebug() << "Help code for QT 6 or later"; - QString path_ = collectionPath(false); QRegularExpression rx("^(.*)/(.*\\.elmt)$"); QRegularExpressionMatch match = rx.match(path_); @@ -820,7 +796,6 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const qDebug() << "ElementsLocation::setXml :" " rx don't match"; } -#endif } } diff --git a/sources/TerminalStrip/ui/terminalstripmodel.h b/sources/TerminalStrip/ui/terminalstripmodel.h index b29afc303..a3b0a696d 100644 --- a/sources/TerminalStrip/ui/terminalstripmodel.h +++ b/sources/TerminalStrip/ui/terminalstripmodel.h @@ -29,15 +29,9 @@ #include "modelTerminalData.h" //Code to use QColor as key for QHash -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) inline size_t qHash(const QColor &key, size_t seed = 0) { return qHash(key.rgba(), seed); } -#else -inline uint qHash(const QColor &key, uint seed) { - return qHash(key.rgba(), seed); -} -#endif //needed to use QPointer as key of QHash inline uint qHash(const QPointer &key, uint seed) { diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index b07b03924..e16a02840 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -216,11 +216,7 @@ void DiagramView::handleElementDrop(QDropEvent *event) } QPointF drop_pos; - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - drop_pos = mapToScene(event->pos()); - #else drop_pos = mapToScene(event->position().toPoint()); - #endif if (location.path().endsWith(".qetmak")) { diagram()->setEventInterface(new DiagramEventAddMacro(location, diagram(), drop_pos)); @@ -295,13 +291,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) { iti -> setHtml (e -> mimeData() -> text()); } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - m_diagram->undoStack().push(new AddGraphicsObjectCommand( - iti, m_diagram, mapToScene(e->pos()))); -#else m_diagram->undoStack().push(new AddGraphicsObjectCommand( iti, m_diagram, mapToScene(e->position().toPoint()))); -#endif } /** @@ -611,14 +602,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 + menu->popup(e->globalPosition().toPoint()); } m_free_rubberbanding = false; @@ -1416,9 +1400,6 @@ void DiagramView::createTemplateFromSelection() QFile file(full_path); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&file); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - out.setCodec("UTF-8"); // Qt6 QTextStream defaults to UTF-8 -#endif out << macro_doc.toString(4); file.close(); qDebug() << "Template successfully saved to:" << full_path; diff --git a/sources/machine_info.cpp b/sources/machine_info.cpp index ede59389b..33652b529 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,7 +86,6 @@ 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); diff --git a/sources/main.cpp b/sources/main.cpp index b8dabc258..ffa98456d 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -109,13 +109,10 @@ int main(int argc, char **argv) //HighDPI -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#endif -qputenv("QT_ENABLE_HIGHDPI_SCALING", "1"); -QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy()); + qputenv("QT_ENABLE_HIGHDPI_SCALING", "1"); + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy()); // Headless command-line export: render a project to PDF/PNG/SVG without diff --git a/sources/print/projectprintwindow.cpp b/sources/print/projectprintwindow.cpp index f8aa0d95c..431af01b7 100644 --- a/sources/print/projectprintwindow.cpp +++ b/sources/print/projectprintwindow.cpp @@ -34,13 +34,6 @@ // Availability of Qt::GuiPrivate is verified at configure time in CMakeLists.txt. #include -#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 @@ -210,11 +203,6 @@ void ProjectPrintWindow::requestPaint() #endif // QApplication::desktop() was removed in Qt6; use QWidget::screen(). - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber()); - #else - QScreen *srn = screen(); - #endif qreal dotsPerInch = (qreal)srn->logicalDotsPerInch(); m_printer->setResolution(dotsPerInch); diff --git a/sources/qet.cpp b/sources/qet.cpp index 84982c179..bf4415e94 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -705,14 +705,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()) @@ -843,14 +836,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 09a27bdb5..d8e625d4d 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -231,14 +231,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/qetxml.cpp b/sources/qetxml.cpp index 5824bef10..6fe1307ec 100644 --- a/sources/qetxml.cpp +++ b/sources/qetxml.cpp @@ -279,14 +279,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/qgimanager.cpp b/sources/qgimanager.cpp index 7f3869499..26972ec16 100644 --- a/sources/qgimanager.cpp +++ b/sources/qgimanager.cpp @@ -74,11 +74,11 @@ void QGIManager::release(QGraphicsItem *qgi) { Demande au QGIManager de gerer plusieurs QGI @param qgis QGraphicsItems a gerer */ -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -void QGIManager::manage(const QList &qgis) { - foreach(QGraphicsItem *qgi, qgis) manage(qgi); +void QGIManager::manage(const QVector &items) { + for (const auto &qgi : items) { + manage(qgi); + } } -#endif /** Indique au QGIManager que pour chaque QGI fourni, une reference vers celui-ci @@ -87,18 +87,6 @@ void QGIManager::manage(const QList &qgis) { sur la scene de ce QGIManager, alors il sera detruit. @param qgis QGraphicsItems a ne plus gerer */ -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -void QGIManager::release(const QList &qgis) { - foreach(QGraphicsItem *qgi, qgis) release(qgi); -} -#endif - -void QGIManager::manage(const QVector &items) { - for (const auto &qgi : items) { - manage(qgi); - } -} - void QGIManager::release(const QVector &items) { for (const auto &qgi : items) { release(qgi); diff --git a/sources/qgimanager.h b/sources/qgimanager.h index 33b4361e7..f6af9c480 100644 --- a/sources/qgimanager.h +++ b/sources/qgimanager.h @@ -45,14 +45,6 @@ class QGIManager { public: void manage(QGraphicsItem *); void release(QGraphicsItem *); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // In Qt6 QVector is an alias for QList, so these overloads would collide - // with the QVector ones below (same signature). Keep them on Qt5 only. - QT_DEPRECATED_X("Use QGIManager::manage(const QVector &) instead") - void manage(const QList &); - QT_DEPRECATED_X("Use QGIManager::release(const QVector &) instead") - void release(const QList &); -#endif void manage(const QVector &items); void release(const QVector &items); void setDestroyQGIOnDelete(bool); 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/ui/imagetransparentcolordialog.cpp b/sources/ui/imagetransparentcolordialog.cpp index 180dfd54d..ed9f5362c 100644 --- a/sources/ui/imagetransparentcolordialog.cpp +++ b/sources/ui/imagetransparentcolordialog.cpp @@ -65,15 +65,7 @@ ClickableImageLabel::ClickableImageLabel(const QImage &sourceImage, QWidget *par */ void ClickableImageLabel::mousePressEvent(QMouseEvent *event) { - // QLabel::pixmap() returns a pointer in Qt5 and a value in Qt6. - // Qt 5.15 offers the by-value form behind Qt::ReturnByValue; the - // pointer overload is deprecated there, so take the by-value one - // on both and the difference reduces to the argument. -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - const QPixmap label_pixmap = pixmap(Qt::ReturnByValue); -#else const QPixmap label_pixmap = pixmap(); -#endif if (event->button() != Qt::LeftButton || label_pixmap.isNull()) return; diff --git a/sources/utils/qetutils.cpp b/sources/utils/qetutils.cpp index 6abbbc4f2..da4f43126 100644 --- a/sources/utils/qetutils.cpp +++ b/sources/utils/qetutils.cpp @@ -200,9 +200,6 @@ namespace */ QString QETUtils::fontToString(const QFont &font) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - return font.toString(); -#else const int legacy_weight = legacyFontWeight(font.weight()); const QChar comma(QLatin1Char(',')); @@ -220,7 +217,6 @@ QString QETUtils::fontToString(const QFont &font) description += QChar(',') + font.styleName(); } return description; -#endif } /** diff --git a/tests/catch/CMakeLists.txt b/tests/catch/CMakeLists.txt index aa7872bd1..a375ec37c 100644 --- a/tests/catch/CMakeLists.txt +++ b/tests/catch/CMakeLists.txt @@ -40,31 +40,13 @@ if(NOT DEFINED QET_COMPONENTS) message(".. QET_COMPONENTS is not set !!! I set them up !!!") include(../../cmake/qet_compilation_vars.cmake) endif() -if(NOT DEFINED QT_VERSION_MAJOR) - find_package( - QT - NAMES - Qt6 - Qt5 - COMPONENTS - ${QET_COMPONENTS} - REQUIRED - ) -endif() -message(".. QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR}) find_package( - Qt${QT_VERSION_MAJOR} + Qt6 COMPONENTS ${QET_COMPONENTS} REQUIRED) -# Qt6-only: the tests link ${QET_PRIVATE_LIBRARIES}, which contains -# Qt::GuiPrivate; Qt6 only creates that target when the component is -# explicitly requested (Qt5 creates it implicitly and has no such package). -if(QT_VERSION_MAJOR GREATER_EQUAL 6) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS GuiPrivate) -endif() Include(FetchContent) diff --git a/tests/googlemock/CMakeLists.txt b/tests/googlemock/CMakeLists.txt index 0e4b403c7..0a56c34d1 100644 --- a/tests/googlemock/CMakeLists.txt +++ b/tests/googlemock/CMakeLists.txt @@ -40,21 +40,9 @@ if(NOT DEFINED QET_COMPONENTS) message(".. QET_COMPONENTS is not set !!! I set them up !!!") include(../../cmake/qet_compilation_vars.cmake) endif() -if(NOT DEFINED QT_VERSION_MAJOR) - find_package( - QT - NAMES - Qt6 - Qt5 - COMPONENTS - ${QET_COMPONENTS} - REQUIRED - ) -endif() -message(".. QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR}) find_package( - Qt${QT_VERSION_MAJOR} + Qt6 COMPONENTS ${QET_COMPONENTS} REQUIRED) diff --git a/tests/googletest/CMakeLists.txt b/tests/googletest/CMakeLists.txt index 34d19ad1e..9ea13c94e 100644 --- a/tests/googletest/CMakeLists.txt +++ b/tests/googletest/CMakeLists.txt @@ -40,21 +40,9 @@ if(NOT DEFINED QET_COMPONENTS) message(".. QET_COMPONENTS is not set !!! I set them up !!!") include(../../cmake/qet_compilation_vars.cmake) endif() -if(NOT DEFINED QT_VERSION_MAJOR) - find_package( - QT - NAMES - Qt6 - Qt5 - COMPONENTS - ${QET_COMPONENTS} - REQUIRED - ) -endif() -message(".. QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR}) find_package( - Qt${QT_VERSION_MAJOR} + Qt6 COMPONENTS ${QET_COMPONENTS} REQUIRED) diff --git a/tests/ipc-regression/run.sh b/tests/ipc-regression/run.sh index fec2ee98d..e62ef6451 100755 --- a/tests/ipc-regression/run.sh +++ b/tests/ipc-regression/run.sh @@ -83,21 +83,6 @@ for tool in Xvfb openbox xdotool; do command -v "$tool" >/dev/null || { echo "missing required tool: $tool" >&2; exit 2; } done -# Qt 5 cannot prove anything here. An unfixed Qt 5 build of master survives -# this scenario every time -- measured, not assumed -- so a Qt 5 run reports -# PASS whether or not the bug is present. Refusing is the only honest answer: -# a green that cannot go red is worse than no test. -# -# Reproduced on Qt 6.10.2, which is also the version in the original report. -# Whether older Qt 6 reproduces it is UNVERIFIED -- if you run this on Qt 6.2 -# or 6.4 and it passes, confirm against a deliberately unfixed build before -# believing it. -if ldd "$BINARY" 2>/dev/null | grep -q "libQt5Core"; then - echo "INCONCLUSIVE: $BINARY links Qt 5." >&2 - echo " This crash only reproduces on Qt 6; an unfixed Qt 5 build" >&2 - echo " survives every attempt. Build against Qt 6 to use this gate." >&2 - exit 2 -fi SANDBOX="$(mktemp -d /tmp/qet-ipc-regression.XXXXXX)" LOG_DIR="$SANDBOX/logs"; mkdir -p "$LOG_DIR" diff --git a/tests/qttest/CMakeLists.txt b/tests/qttest/CMakeLists.txt index 8240bb11d..855a9acd2 100644 --- a/tests/qttest/CMakeLists.txt +++ b/tests/qttest/CMakeLists.txt @@ -40,22 +40,9 @@ if(NOT DEFINED QET_COMPONENTS) message(".. QET_COMPONENTS is not set !!! I set them up !!!") include(../../cmake/qet_compilation_vars.cmake) endif() -if(NOT DEFINED QT_VERSION_MAJOR) - find_package( - QT - NAMES - Qt6 - Qt5 - COMPONENTS - ${QET_COMPONENTS} - Test - REQUIRED - ) -endif() -message(".. QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR}) find_package( - Qt${QT_VERSION_MAJOR} + Qt6 COMPONENTS ${QET_COMPONENTS} Test