USNavalResearchLaboratory / cxxplot

A simple to use C++ 2D plotting library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: 'HighQualityAntialiasing' is deprecated: Use Antialiasing instead [-Werror,-Wdeprecated-declarations]

yurivict opened this issue · comments

Thank you for reporting this. I think this shouldn't trigger, which version of Qt you are compiling against?

Hi, thanks for the great repo. I am also seeing this error on Ubuntu 22.04

>> qmake --version
QMake version 3.1
Using Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu

For what its worth, I am compiling my project w/ -Werror using g++ 11.3 and including cxxplot as shown in the README via FetchContent.

In minimal local testing, I changed the following below, which got around the error but not sure of broader impact:

>> git diff src/qcustomplot.cpp 
diff --git a/src/qcustomplot.cpp b/src/qcustomplot.cpp
index a821e27..8c842ea 100644
--- a/src/qcustomplot.cpp
+++ b/src/qcustomplot.cpp
@@ -683,7 +683,7 @@ QCPPainter *QCPPaintBufferPixmap::startPainting()
 {
   QCPPainter *result = new QCPPainter(&mBuffer);
 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-  result->setRenderHint(QPainter::HighQualityAntialiasing);
+  result->setRenderHint(QPainter::Antialiasing);
 #endif
   return result;
 }
@@ -772,7 +772,7 @@ QCPPainter *QCPPaintBufferGlPbuffer::startPainting()
   }
   
   QCPPainter *result = new QCPPainter(mGlPBuffer);
-  result->setRenderHint(QPainter::HighQualityAntialiasing);
+  result->setRenderHint(QPainter::Antialiasing);
   return result;
 }
 
@@ -885,7 +885,7 @@ QCPPainter *QCPPaintBufferGlFbo::startPainting()
   mGlFrameBuffer->bind();
   QCPPainter *result = new QCPPainter(paintDevice.data());
 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-  result->setRenderHint(QPainter::HighQualityAntialiasing);
+  result->setRenderHint(QPainter::Antialiasing);
 #endif
   return result;
 }
@@ -15489,7 +15489,7 @@ void QCustomPlot::paintEvent(QPaintEvent *event)
   if (painter.isActive())
   {
 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-  painter.setRenderHint(QPainter::HighQualityAntialiasing); // to make Antialiasing look good if using the OpenGL graphicssystem
+  painter.setRenderHint(QPainter::Antialiasing); // to make Antialiasing look good if using the OpenGL graphicssystem
 #endif
     if (mBackgroundBrush.style() != Qt::NoBrush)
       painter.fillRect(mViewport, mBackgroundBrush);

Thank you for reporting! The change you made is valid for your version. I just pushed a new commit that should take care of the issue respecting the exact version the enum value was deprecated.

I would appreciate if you could fetch content using the relevant commit:
47fbda9

Thanks for the quick fix. Compilation succeeds but installation fails. Appears to be a minor cmake issue I fixed by doing this:

---
 CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf93d05..04aa845 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -193,7 +193,7 @@ configure_package_config_file(
   )
 
 write_basic_package_version_file(
- ${CMAKE_BINARY_DIR}/cmake/cxxplotConfigVersion.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/cxxplotConfigVersion.cmake
  VERSION ${cxxplot_VERSION}
  COMPATIBILITY SameMajorVersion
 )
@@ -217,8 +217,8 @@ install(EXPORT cxxplotTargets
 
 install(
   FILES
-    ${CMAKE_BINARY_DIR}/cmake/cxxplotConfig.cmake
-    ${CMAKE_BINARY_DIR}/cmake/cxxplotConfigVersion.cmake
+    ${CMAKE_CURRENT_BINARY_DIR}/cmake/cxxplotConfig.cmake
+    ${CMAKE_CURRENT_BINARY_DIR}/cmake/cxxplotConfigVersion.cmake
   DESTINATION
     ${CMAKE_INSTALL_LIBDIR}/cmake/${CXXPLOT_DIR_WITH_VERSION}
   )
-- 
2.34.1

Note the addition of CMAKE_CURRENT_BINARY_DIR in place of CMAKE_BINARY_DIR which seems to be required when pulling cxxplot in as a FetchContent. I can open another issue to track this if preferred since its not the same as the title issue. Or I can open a PR w/ the fix. In any case, thank you for your help and let me know.

I bumped the version to v0.3.1. It should now be possible to Feth content using the particular GIT_TAG. If this doesn't work then please create a new issue and PR from the latest main commit and I will investigate.

Thank you!

I think this issue is resolved, at least on my configuration. I will open another issue / PR for the installation issue.

Antialiasing enum issue Fixed in v0.3.1.