1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Fix broken build for Qt6 with options: WITH_QT=ON and WITH_OPENGL=ON

- QGLWidget changed to QOpenGLWidget in window_QT.h for Qt6 using
  typedef OpenCVQtWidgetBase for handling Qt version

- Implement Qt6/OpenGL functionality in window_QT.cpp

- Swap QGLWidget:: function calls for OpenCVQtWidgetBase:: function calls

- QGLWidget::updateGL deprecated, swap to QOpenGLWidget::update for Qt6

- Add preprocessor definition to detect Qt6 -- HAVE_QT6

- Add OpenGLWidgets to qdeps list in highgui CMakeLists.txt

- find_package CMake command added for locating Qt module OpenGLWidgets

- Added check that Qt6::OpenGLWidgets component is found. Shut off Qt-openGL functionality if not found.
This commit is contained in:
Patrick Whalen
2021-12-02 11:10:30 -08:00
parent cb08c15616
commit b2005ccaef
4 changed files with 42 additions and 11 deletions
+7
View File
@@ -47,6 +47,13 @@ if(WITH_QT)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL QUIET)
if(Qt${QT_VERSION_MAJOR}OpenGL_FOUND)
set(QT_QTOPENGL_FOUND ON) # HAVE_QT_OPENGL is defined below
if(QT_VERSION_MAJOR GREATER 5) # QGL -> QOpenGL
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGLWidgets QUIET)
if(NOT Qt${QT_VERSION_MAJOR}OpenGLWidgets_FOUND)
message(STATUS "Qt OpenGLWidgets component not found: turning off Qt OpenGL functionality")
set(QT_QTOPENGL_FOUND FALSE)
endif()
endif()
endif()
endif()
endif()