From bf10f945a96208e487c438eb742bb476239d60fa Mon Sep 17 00:00:00 2001 From: Nicolas Saillant Date: Wed, 7 Aug 2024 10:00:59 +0200 Subject: [PATCH] Remove deprecated Qt version checks and unused code --- .../CurveInputMethods.cpp | 13 ---------- GraphicsView/include/CGAL/Qt/qglviewer.h | 9 ------- GraphicsView/include/CGAL/Qt/qglviewer_impl.h | 24 ------------------- Lab/demo/Lab/CGAL_Lab.cpp | 5 ---- Lab/demo/Lab/MainWindow.cpp | 9 ------- 5 files changed, 60 deletions(-) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CurveInputMethods.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CurveInputMethods.cpp index 91a64dad22e..82e7958b2ab 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CurveInputMethods.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CurveInputMethods.cpp @@ -109,15 +109,6 @@ void CurveInputMethod::beginInput_() for (auto& item : items) this->getScene()->addItem(item); } -static inline void clearPainterPath(QPainterPath& ppath) -{ -#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)) - ppath.clear(); -#else - ppath = {}; -#endif -} - void CurveInputMethod::reset() { this->resetInput(); @@ -193,7 +184,6 @@ PolylineInputMethod::PolylineInputMethod() : void PolylineInputMethod::beginInput() { - clearPainterPath(this->painterPath); this->polylineGuide.setPath(this->painterPath); this->lastLine.setLine(0, 0, 0, 0); QPen pen = this->polylineGuide.pen(); @@ -356,8 +346,6 @@ BezierInputMethod::BezierInputMethod() : CurveInputMethod(CurveType::Bezier, -1) void BezierInputMethod::beginInput() { - clearPainterPath(this->painterOldPath); - clearPainterPath(this->painterPath); this->bezierGuide.setPath(this->painterPath); this->bezierOldGuide.setPath(this->painterOldPath); @@ -407,7 +395,6 @@ static void updateBezierPainterPath( const std::vector& controlPoints, std::vector& cache, const QTransform& worldTransform, QPainterPath& painterPath) { - clearPainterPath(painterPath); if (controlPoints.size() < 2) return; float pixel_len = approx_pixel_length(controlPoints, worldTransform); diff --git a/GraphicsView/include/CGAL/Qt/qglviewer.h b/GraphicsView/include/CGAL/Qt/qglviewer.h index 8ee3b4135f2..5c0726d5344 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer.h @@ -478,15 +478,6 @@ public: qreal bufferTextureMaxU() const { return bufferTextureMaxU_; } /*! Same as bufferTextureMaxU(), but for the v texture coordinate. */ qreal bufferTextureMaxV() const { return bufferTextureMaxV_; } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)) - // These methods are part of the QGLWidget public API. - // As of version 2.7.0, the use of QOpenGLWidget instead means that they have - // to be provided for backward compatibility. - void renderText(int x, int y, const QString &str, - const QFont &font = QFont()); - void renderText(double x, double y, double z, const QString &str, - const QFont &font = QFont()); -#endif public Q_SLOTS: void copyBufferToTexture(GLint, GLenum = GL_NONE); diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index 7387b1f4874..dc25f1d8675 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -720,30 +720,6 @@ CGAL_INLINE_FUNCTION void CGAL::QGLViewer::drawLight(GLenum, qreal ) const { } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)) -CGAL_INLINE_FUNCTION -void CGAL::QGLViewer::renderText(int x, int y, const QString &str, - const QFont &font) { - QColor fontColor = QColor(0, 0, - 0, 255); - - // Render text - QPainter painter(this); - painter.setPen(fontColor); - painter.setFont(font); - painter.drawText(x, y, str); - painter.end(); -} - -CGAL_INLINE_FUNCTION -void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &str, - const QFont &font) { - using CGAL::qglviewer::Vec; - const Vec proj = camera_->projectedCoordinatesOf(Vec(x, y, z)); - renderText(int(proj.x), int(proj.y), str, font); -} -#endif - /*! Draws \p text at position \p x, \p y (expressed in screen coordinates pixels, origin in the upper left corner of the widget). diff --git a/Lab/demo/Lab/CGAL_Lab.cpp b/Lab/demo/Lab/CGAL_Lab.cpp index 6f1504ab668..d54813edda9 100644 --- a/Lab/demo/Lab/CGAL_Lab.cpp +++ b/Lab/demo/Lab/CGAL_Lab.cpp @@ -27,11 +27,6 @@ int& code_to_call_before_creation_of_QCoreApplication(int& i) { fmt.setOption(QSurfaceFormat::DebugContext); QSurfaceFormat::setDefaultFormat(fmt); - //for windows -#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) - QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); -#endif - return i; } diff --git a/Lab/demo/Lab/MainWindow.cpp b/Lab/demo/Lab/MainWindow.cpp index 2269b4a2839..7eff95e0b3d 100644 --- a/Lab/demo/Lab/MainWindow.cpp +++ b/Lab/demo/Lab/MainWindow.cpp @@ -663,15 +663,6 @@ void MainWindow::loadPlugins() } } QString env_path = qgetenv("LAB_DEMO_PLUGINS_PATH"); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) - QChar separator = QDir::listSeparator(); -#else -#if defined(_WIN32) - QChar separator = ';'; -#else - QChar separator = ':'; -#endif -#endif if(!env_path.isEmpty()) { #if defined(_WIN32) QString path = qgetenv("PATH");