From eaf2c7094b023e13575c8357c01ed6e8041f096a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Wed, 20 Dec 2023 11:21:46 +0100 Subject: [PATCH] Migrate to Qt6 --- CMakeLists.txt | 9 +++------ README | 8 ++++---- imagescrollareagl.cpp | 3 ++- mainwindow.cpp | 1 + 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2756ff3..df99912 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ if(SANITIZE_ADDRESS_LEAK) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fsanitize=leak") endif(SANITIZE_ADDRESS_LEAK) -find_package(Qt5 COMPONENTS Widgets Sql OpenGL REQUIRED) +find_package(Qt6 COMPONENTS Widgets Sql OpenGLWidgets REQUIRED) find_library(GSL_LIB gsl REQUIRED) find_library(GSLCBLAS_LIB gslcblas REQUIRED) find_library(EXIF_LIB exif REQUIRED) @@ -52,15 +52,12 @@ set(TENMON_SRC ) option(COLOR_MANAGMENT "Enable sRGB framebuffer support for gamma correct images and color profiles support" ON) -if(${Qt5Core_VERSION_STRING} VERSION_LESS "5.14") - set(COLOR_MANAGMENT OFF) -endif(${Qt5Core_VERSION_STRING} VERSION_LESS "5.14") if(COLOR_MANAGMENT) add_compile_definitions("COLOR_MANAGMENT") endif(COLOR_MANAGMENT) -qt5_add_resources(TENMON_SRC resources.qrc) +qt_add_resources(TENMON_SRC resources.qrc) if(WIN32) list(APPEND TENMON_SRC icon.rc) set(tenmon_ICON "") @@ -82,7 +79,7 @@ if(UNIX AND NOT APPLE) target_include_directories(tenmon PRIVATE ${GIO_INCLUDE_DIRS}) endif() -target_link_libraries(tenmon Qt5::Widgets Qt5::Sql ${GSL_LIB} ${GSLCBLAS_LIB} ${EXIF_LIB} ${FITS_LIB} ${RAW_LIB} ${WCS_LIB} XISF) +target_link_libraries(tenmon Qt6::Widgets Qt6::Sql Qt6::OpenGLWidgets ${GSL_LIB} ${GSLCBLAS_LIB} ${EXIF_LIB} ${FITS_LIB} ${RAW_LIB} ${WCS_LIB} XISF) if(APPLE) target_link_libraries(tenmon "-framework CoreFoundation") else() diff --git a/README b/README index 627acf1..0623efb 100644 --- a/README +++ b/README @@ -2,20 +2,20 @@ FITS/XISF image viewer with multithreaded image loading To get all dependencies install these packages - sudo apt install qtbase5-dev libraw-dev libexif-dev libcfitsio-dev libgsl-dev wcslib-dev libopencv-dev cmake + sudo apt install qt6-base-dev libqt6opengl6-dev libraw-dev libexif-dev libcfitsio-dev libgsl-dev wcslib-dev cmake on OpenSUSE - sudo zypper install opencv-devel gsl-devel exif-devel libraw-devel wcslib-devel libqt5-qtbase-devel + sudo zypper install gsl-devel exif-devel libraw-devel wcslib-devel libqt6-qtbase-devel MacOS X To compile on MacOS install XCode first. Then install homebrew in x86_64 mode with "arch -i x86_64". Building on native ARM is not supported. - homebrew install qt5 libraw cfitsio libexif libgsl wcslib opencv + homebrew install qt6 libraw cfitsio libexif libgsl wcslib -You may need to set CMAKE_PREFIX_PATH for Qt5 and OpenCV so CMake can find them. +You may need to set CMAKE_PREFIX_PATH for Qt6 so CMake can find them. Then to build run standard cmake diff --git a/imagescrollareagl.cpp b/imagescrollareagl.cpp index 575aa0e..47e952e 100644 --- a/imagescrollareagl.cpp +++ b/imagescrollareagl.cpp @@ -1,5 +1,6 @@ #include "imagescrollareagl.h" #include +#include #include #include #include @@ -400,7 +401,7 @@ void ImageWidget::initializeGL() { f = context()->functions(); f->glClearColor(0.5f, 0.5f, 0.5f, 1.0f); - f3 = context()->versionFunctions(); + f3 = QOpenGLVersionFunctionsFactory::get(context()); if(f3 == nullptr) QMessageBox::critical(this, tr("OpenGL error"), tr("Could not initialize OpenGL 3.3 context. Ensure that proper GPU driver is installed.")); diff --git a/mainwindow.cpp b/mainwindow.cpp index 9df671f..f170929 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include