From ff6667dca13ac6e43bbcfe4e540ff36f38df8dac Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 10 Aug 2024 19:49:11 +0200 Subject: [PATCH 1/3] fixed #13133 - removed deprecated Qt5 support --- .github/workflows/CI-unixish-docker.yml | 2 +- .github/workflows/CI-unixish.yml | 33 ++++++--------- .github/workflows/CI-windows.yml | 15 ++----- .github/workflows/clang-tidy.yml | 2 +- .github/workflows/iwyu.yml | 4 +- .github/workflows/release-windows.yml | 2 +- .github/workflows/selfcheck.yml | 6 +-- cmake/cxx11.cmake | 2 +- cmake/findDependencies.cmake | 36 +++++++---------- cmake/options.cmake | 1 - cmake/printInfo.cmake | 10 +---- cmake/qtCompat.cmake | 53 +++++-------------------- gui/checkthread.cpp | 8 ---- gui/codeeditor.cpp | 9 ----- gui/codeeditstyledialog.cpp | 4 -- gui/codeeditstyledialog.h | 4 -- gui/cppchecklibrarydata.cpp | 4 -- gui/csvreport.cpp | 8 ---- gui/main.cpp | 6 --- gui/projectfile.cpp | 4 -- gui/projectfiledialog.cpp | 12 ------ gui/resultstree.cpp | 15 ------- gui/statsdialog.cpp | 4 -- gui/txtreport.cpp | 4 -- gui/xmlreport.cpp | 4 -- gui/xmlreportv2.cpp | 4 -- releasenotes.txt | 1 + test/cli/QML-Samples-TableView/main.cpp | 4 -- 28 files changed, 53 insertions(+), 208 deletions(-) diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 8235da64e88..e404015fbe3 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -101,7 +101,7 @@ jobs: - name: CMake build (with GUI) if: matrix.build_gui run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build cmake.output -- -j$(nproc) - name: Run CMake test diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index cd7779ec937..8af606d96da 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -22,9 +22,9 @@ jobs: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-13] include: - - use_qt6: On + - build_gui: On - os: ubuntu-20.04 - use_qt6: Off + build_gui: Off fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }} @@ -42,16 +42,15 @@ jobs: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off' + if: contains(matrix.os, 'ubuntu') run: | sudo apt-get update - sudo apt-get install libxml2-utils libtinyxml2-dev qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser + sudo apt-get install libxml2-utils libtinyxml2-dev - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On' + - name: Install missing software on ubuntu (Qt6) + if: contains(matrix.os, 'ubuntu') && matrix.build_gui run: | sudo apt-get update - sudo apt-get install libxml2-utils libtinyxml2-dev # qt6-tools-dev-tools for lprodump # qt6-l10n-tools for lupdate sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev @@ -66,13 +65,13 @@ jobs: - name: CMake build on ubuntu (with GUI / system tinyxml2) if: contains(matrix.os, 'ubuntu') run: | - cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=${{ matrix.build_gui }} -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build cmake.output.tinyxml2 -- -j$(nproc) - name: CMake build on macos (with GUI / system tinyxml2) if: contains(matrix.os, 'macos') run: | - cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 + cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 cmake --build cmake.output.tinyxml2 -- -j$(nproc) - name: Run CMake test (system tinyxml2) @@ -85,9 +84,9 @@ jobs: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-13] include: - - use_qt6: On + - build_gui: On - os: ubuntu-20.04 - use_qt6: Off + build_gui: Off fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }} @@ -104,12 +103,6 @@ jobs: with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'Off' - run: | - sudo apt-get update - sudo apt-get install libxml2-utils qtbase5-dev qttools5-dev libqt5charts5-dev qtchooser - # TODO: move latest compiler to separate step # TODO: bail out on warnings with latest GCC - name: Set up GCC @@ -125,7 +118,7 @@ jobs: echo "CXX=g++-13" >> $GITHUB_ENV - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') && matrix.use_qt6 == 'On' + if: contains(matrix.os, 'ubuntu') run: | sudo apt-get update sudo apt-get install libxml2-utils @@ -143,13 +136,13 @@ jobs: - name: CMake build on ubuntu (with GUI) if: contains(matrix.os, 'ubuntu') run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=${{ matrix.build_gui }} -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build cmake.output -- -j$(nproc) - name: CMake build on macos (with GUI) if: contains(matrix.os, 'macos') run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 cmake --build cmake.output -- -j$(nproc) - name: Run CMake test diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index bf35c83b52e..a7b8b93c555 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [windows-2019, windows-2022] - qt_ver: [5.15.2, 6.7.3] + qt_ver: [6.7.3] fail-fast: false runs-on: ${{ matrix.os }} @@ -47,20 +47,11 @@ jobs: modules: 'qtcharts' cache: true - - name: Build GUI release (Qt 5) - if: startsWith(matrix.qt_ver, '5') + - name: Build GUI release run: | ; TODO: enable rules? ; specify Release build so matchcompiler is used - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel! - cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel! - - - name: Build GUI release (Qt 6) - if: startsWith(matrix.qt_ver, '6') - run: | - ; TODO: enable rules? - ; specify Release build so matchcompiler is used - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel! + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel! cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel! - name: Deploy GUI diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index b1744dd31d4..7325d75e79f 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -55,7 +55,7 @@ jobs: - name: Prepare CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off -DWARNINGS_ARE_ERRORS=On + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off -DWARNINGS_ARE_ERRORS=On env: CC: clang-19 CXX: clang++-19 diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 305bf3498e7..8ee1df625a6 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -86,7 +86,7 @@ jobs: - name: Prepare CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On + cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On env: CC: clang CXX: clang++ @@ -160,7 +160,7 @@ jobs: - name: Prepare CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On + cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On env: CC: clang-19 CXX: clang++-19 diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index 94e0590ac6a..96091eb07fd 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -27,7 +27,7 @@ jobs: env: # see https://www.pcre.org/original/changelog.txt PCRE_VERSION: 8.45 - QT_VERSION: 5.15.2 + QT_VERSION: 6.7.3 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml index 88c4462375a..0d17a10f24a 100644 --- a/.github/workflows/selfcheck.yml +++ b/.github/workflows/selfcheck.yml @@ -60,7 +60,7 @@ jobs: # unusedFunction - start - name: CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On - name: Generate dependencies run: | @@ -87,7 +87,7 @@ jobs: # unusedFunction notest - start - name: CMake (no test) run: | - cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On + cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On - name: Generate dependencies (no test) run: | @@ -129,7 +129,7 @@ jobs: # unusedFunction notest nocli - start - name: CMake (no test / no cli) run: | - cmake -S . -B cmake.output.notest_nocli -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_CLI=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On + cmake -S . -B cmake.output.notest_nocli -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_CLI=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On - name: Generate dependencies (no test / no cli) run: | diff --git a/cmake/cxx11.cmake b/cmake/cxx11.cmake index b5cb4631218..34772e86b7c 100644 --- a/cmake/cxx11.cmake +++ b/cmake/cxx11.cmake @@ -1,6 +1,6 @@ macro(use_cxx11) # some GitHub Action Windows runners randomly fail with a complaint that Qt6 requires a C++17 compiler - if(MSVC AND USE_QT6) + if(MSVC) # CMAKE_CXX_STANDARD 17 was added in CMake 3.8 set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use") else() diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 98421a02ee4..9621c4a4587 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -6,27 +6,21 @@ if(BUILD_GUI) if(BUILD_TESTS) list(APPEND qt_components Test) endif() - if(USE_QT6) - find_package(Qt6 COMPONENTS ${qt_components} REQUIRED) - set(QT_VERSION "${Qt6Core_VERSION}") - if(NOT QT_VERSION) - # TODO: remove fallback - message(WARNING "'Qt6Core_VERSION' is not set - using 6.0.0 as fallback") - set(QT_VERSION "6.0.0") - endif() - if(MSVC) - # disable Visual Studio C++ memory leak detection since it causes compiler errors with Qt 6 - # D:\a\cppcheck\Qt\6.2.4\msvc2019_64\include\QtCore/qhash.h(179,15): warning C4003: not enough arguments for function-like macro invocation 'free' [D:\a\cppcheck\cppcheck\build\gui\cppcheck-gui.vcxproj] - # D:\a\cppcheck\Qt\6.2.4\msvc2019_64\include\QtCore/qhash.h(179,15): error C2059: syntax error: ',' [D:\a\cppcheck\cppcheck\build\gui\cppcheck-gui.vcxproj] - # this is supposed to be fixed according to the following tickets but it still happens - # https://bugreports.qt.io/browse/QTBUG-40575 - # https://bugreports.qt.io/browse/QTBUG-86395 - set(DISABLE_CRTDBG_MAP_ALLOC ON) - endif() - else() - message(WARNING "Building with Qt5 is deprecated (it went EOL in May 2023) and will be removed in a future release - please use Qt6 instead") - find_package(Qt5 COMPONENTS ${qt_components} REQUIRED) - set(QT_VERSION "${Qt5Core_VERSION_STRING}") + find_package(Qt6 COMPONENTS ${qt_components} REQUIRED) + set(QT_VERSION "${Qt6Core_VERSION}") + if(NOT QT_VERSION) + # TODO: remove fallback + message(WARNING "'Qt6Core_VERSION' is not set - using 6.0.0 as fallback") + set(QT_VERSION "6.0.0") + endif() + if(MSVC) + # disable Visual Studio C++ memory leak detection since it causes compiler errors with Qt 6 + # D:\a\cppcheck\Qt\6.2.4\msvc2019_64\include\QtCore/qhash.h(179,15): warning C4003: not enough arguments for function-like macro invocation 'free' [D:\a\cppcheck\cppcheck\build\gui\cppcheck-gui.vcxproj] + # D:\a\cppcheck\Qt\6.2.4\msvc2019_64\include\QtCore/qhash.h(179,15): error C2059: syntax error: ',' [D:\a\cppcheck\cppcheck\build\gui\cppcheck-gui.vcxproj] + # this is supposed to be fixed according to the following tickets but it still happens + # https://bugreports.qt.io/browse/QTBUG-40575 + # https://bugreports.qt.io/browse/QTBUG-86395 + set(DISABLE_CRTDBG_MAP_ALLOC ON) endif() if(BUILD_ONLINE_HELP) diff --git a/cmake/options.cmake b/cmake/options.cmake index eedc649f9bc..f37a48d5c91 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -55,7 +55,6 @@ option(BUILD_CLI "Build the cli application" option(BUILD_GUI "Build the qt application" OFF) option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF) -option(USE_QT6 "Prefer Qt6 when available" OFF) option(REGISTER_GUI_TESTS "Register GUI tests in CTest" ON) option(BUILD_ONLINE_HELP "Build online help" OFF) diff --git a/cmake/printInfo.cmake b/cmake/printInfo.cmake index 97681645035..c9f5ceccdb2 100644 --- a/cmake/printInfo.cmake +++ b/cmake/printInfo.cmake @@ -64,15 +64,9 @@ message(STATUS "BUILD_GUI = ${BUILD_GUI}") if(BUILD_GUI) message(STATUS "REGISTER_GUI_TESTS = ${REGISTER_GUI_TESTS}") message(STATUS "WITH_QCHART = ${WITH_QCHART}") - message(STATUS "USE_QT6 = ${USE_QT6}") message(STATUS "QT_VERSION = ${QT_VERSION}") - if(USE_QT6) - message(STATUS "Qt6Core_LIBRARIES = ${Qt6Core_LIBRARIES}") - message(STATUS "Qt6Core_INCLUDE_DIRS = ${Qt6Core_INCLUDE_DIRS}") - else() - message(STATUS "Qt5Core_LIBRARIES = ${Qt5Core_LIBRARIES}") - message(STATUS "Qt5Core_INCLUDE_DIRS = ${Qt5Core_INCLUDE_DIRS}") - endif() + message(STATUS "Qt6Core_LIBRARIES = ${Qt6Core_LIBRARIES}") + message(STATUS "Qt6Core_INCLUDE_DIRS = ${Qt6Core_INCLUDE_DIRS}") message(STATUS "QHELPGENERATOR = ${QHELPGENERATOR}") endif() message(STATUS) diff --git a/cmake/qtCompat.cmake b/cmake/qtCompat.cmake index 91995610a90..bc3e3851440 100644 --- a/cmake/qtCompat.cmake +++ b/cmake/qtCompat.cmake @@ -1,43 +1,10 @@ -if(QT_VERSION VERSION_LESS 5.15) - # "versionless" Qt is not supported until 5.15 so we need to use wrappers - - function(qt_wrap_ui out) - qt5_wrap_ui(_uis_hdrs ${ARGN}) - set("${out}" ${_uis_hdrs} PARENT_SCOPE) - endfunction() - - function(qt_add_resources out) - qt5_add_resources(_resources ${ARGN}) - set("${out}" ${_resources} PARENT_SCOPE) - endfunction() - - function(qt_create_translation out) - qt5_create_translation(_qms ${ARGN}) - set("${out}" ${_qms} PARENT_SCOPE) - endfunction() - - function(qt_wrap_cpp out) - qt5_wrap_cpp(_sources ${ARGN}) - set("${out}" ${_sources} PARENT_SCOPE) - endfunction() - - set(QT_CORE_LIB Qt5::Core) - set(QT_TEST_LIB Qt5::Test) - set(QT_WIDGETS_LIB Qt5::Widgets) - set(QT_GUI_LIB Qt5::Gui) - set(QT_HELP_LIB Qt5::Help) - set(QT_PRINTSUPPORT_LIB Qt5::PrintSupport) - set(QT_CHARTS_LIB Qt5::Charts) - set(QT_NETWORK_LIB Qt5::Network) -else() - # use "versionless" targets - no need for wrapper functions - - set(QT_CORE_LIB Qt::Core) - set(QT_TEST_LIB Qt::Test) - set(QT_WIDGETS_LIB Qt::Widgets) - set(QT_GUI_LIB Qt::Gui) - set(QT_HELP_LIB Qt::Help) - set(QT_PRINTSUPPORT_LIB Qt::PrintSupport) - set(QT_CHARTS_LIB Qt::Charts) - set(QT_NETWORK_LIB Qt::Network) -endif() +# use "versionless" targets - no need for wrapper functions + +set(QT_CORE_LIB Qt::Core) +set(QT_TEST_LIB Qt::Test) +set(QT_WIDGETS_LIB Qt::Widgets) +set(QT_GUI_LIB Qt::Gui) +set(QT_HELP_LIB Qt::Help) +set(QT_PRINTSUPPORT_LIB Qt::PrintSupport) +set(QT_CHARTS_LIB Qt::Charts) +set(QT_NETWORK_LIB Qt::Network) diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index d8ecca8b1c3..9764d3bcef5 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -50,10 +50,6 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -#include -#endif - static QString unquote(QString s) { if (s.startsWith("\"")) s = s.mid(1, s.size() - 2); @@ -248,11 +244,7 @@ void CheckThread::runAddonsAndTools(const FileSettings *fileSettings, const QStr process.start(clangCmd(),args2); process.waitForFinished(); const QByteArray &ba = process.readAllStandardOutput(); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) const quint16 chksum = qChecksum(QByteArrayView(ba)); -#else - const quint16 chksum = qChecksum(ba.data(), ba.length()); -#endif QFile f1(analyzerInfoFile + '.' + addon + "-E"); if (f1.open(QIODevice::ReadOnly | QIODevice::Text)) { diff --git a/gui/codeeditor.cpp b/gui/codeeditor.cpp index ecc3575bc26..37eadf5741e 100644 --- a/gui/codeeditor.cpp +++ b/gui/codeeditor.cpp @@ -284,13 +284,8 @@ CodeEditor::CodeEditor(QWidget *parent) : setObjectName("CodeEditor"); setStyleSheet(generateStyleString()); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) auto *copyText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_C),this); auto *allText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_A),this); -#else - const auto *copyText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C),this); - const auto *allText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A),this); -#endif connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); @@ -367,11 +362,7 @@ int CodeEditor::lineNumberAreaWidth() ++digits; } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) const int space = 3 + (fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits); -#else - const int space = 3 + (fontMetrics().width(QLatin1Char('9')) * digits); -#endif return space; } diff --git a/gui/codeeditstyledialog.cpp b/gui/codeeditstyledialog.cpp index b7b782ffc39..154d5c22b13 100644 --- a/gui/codeeditstyledialog.cpp +++ b/gui/codeeditstyledialog.cpp @@ -130,11 +130,7 @@ StyleEditDialog::StyleEditDialog(const CodeEditorStyle& newStyle, mSampleEditor = new CodeEditor(this); QFont sampleFont("Monospace"); QFontMetrics fm(sampleFont); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) mSampleEditor->setMinimumWidth(fm.horizontalAdvance(QString(40, 'W'))); -#else - mSampleEditor->setMinimumWidth(fm.width(QString(40, 'W'))); -#endif // designate highlight, errors, and symbols mSampleEditor->setError(mSampleDocument, mErrLineNum, mErrSymbolsList); // End Controls diff --git a/gui/codeeditstyledialog.h b/gui/codeeditstyledialog.h index bd7a70ac2a5..5b27f35e08b 100644 --- a/gui/codeeditstyledialog.h +++ b/gui/codeeditstyledialog.h @@ -33,10 +33,6 @@ class QPushButton; class QWidget; class QString; -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -class QStringList; -#endif - class StyleEditDialog : public QDialog { Q_OBJECT public: diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index 9bab4610835..4628e07f85e 100644 --- a/gui/cppchecklibrarydata.cpp +++ b/gui/cppchecklibrarydata.cpp @@ -30,10 +30,6 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -#include -#endif - const unsigned int CppcheckLibraryData::Function::Arg::ANY = ~0U; const unsigned int CppcheckLibraryData::Function::Arg::VARIADIC = ~1U; diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index 26e983009dd..f99dd5061e3 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -42,11 +42,7 @@ bool CsvReport::create() void CsvReport::writeHeader() { // Added 5 columns to the header. -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) mTxtWriter << "File, Line, Severity, Id, Summary" << Qt::endl; -#else - mTxtWriter << "File, Line, Severity, Id, Summary" << endl; -#endif } void CsvReport::writeFooter() @@ -64,9 +60,5 @@ void CsvReport::writeError(const ErrorItem &error) const QString file = QDir::toNativeSeparators(error.errorPath.back().file); QString line = QString("%1,%2,").arg(file).arg(error.errorPath.back().line); line += QString("%1,%2,%3").arg(GuiSeverity::toString(error.severity)).arg(error.errorId).arg(error.summary); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) mTxtWriter << line << Qt::endl; -#else - mTxtWriter << line << endl; -#endif } diff --git a/gui/main.cpp b/gui/main.cpp index 91bc9e7a084..22e1bc8cbd0 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -47,12 +47,6 @@ static bool CheckArgs(const QStringList &args); int main(int argc, char *argv[]) { - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#endif - QApplication app(argc, argv); QCoreApplication::setOrganizationName("Cppcheck"); diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index 64a3b0d00bf..99d83d49d5f 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -35,10 +35,6 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -#include -#endif - ProjectFile *ProjectFile::mActiveProject; ProjectFile::ProjectFile(QObject *parent) : diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index d56893c0543..f1251399819 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -518,11 +518,7 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const projectFile->setClangTidy(mUI->mToolClangTidy->isChecked()); if (mPremium) projectFile->setLicenseFile(mUI->mEditLicenseFile->text()); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) projectFile->setTags(mUI->mEditTags->text().split(";", Qt::SkipEmptyParts)); -#else - projectFile->setTags(mUI->mEditTags->text().split(";", QString::SkipEmptyParts)); -#endif } void ProjectFileDialog::ok() @@ -695,21 +691,13 @@ QStringList ProjectFileDialog::getIncludePaths() const QStringList ProjectFileDialog::getDefines() const { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) return mUI->mEditDefines->text().trimmed().split(QRegularExpression("\\s*;\\s*"), Qt::SkipEmptyParts); -#else - return mUI->mEditDefines->text().trimmed().split(QRegularExpression("\\s*;\\s*"), QString::SkipEmptyParts); -#endif } QStringList ProjectFileDialog::getUndefines() const { const QString undefine = mUI->mEditUndefines->text().trimmed(); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QStringList undefines = undefine.split(QRegularExpression("\\s*;\\s*"), Qt::SkipEmptyParts); -#else - QStringList undefines = undefine.split(QRegularExpression("\\s*;\\s*"), QString::SkipEmptyParts); -#endif undefines.removeDuplicates(); return undefines; } diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 9024c089bc7..678f62d388e 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -1026,22 +1026,7 @@ void ResultsTree::startApplication(const QStandardItem *target, int application) const QString cmdLine = QString("%1 %2").arg(program).arg(params); #endif - // this is reported as deprecated in Qt 5.15.2 but no longer in Qt 6 -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - SUPPRESS_WARNING_CLANG_PUSH("-Wdeprecated") - SUPPRESS_WARNING_GCC_PUSH("-Wdeprecated-declarations") -#endif - -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - const bool success = QProcess::startDetached(cmdLine); -#else const bool success = QProcess::startDetached(program, QProcess::splitCommand(params)); -#endif - -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - SUPPRESS_WARNING_GCC_POP - SUPPRESS_WARNING_CLANG_POP -#endif if (!success) { QString text = tr("Could not start %1\n\nPlease check the application path and parameters are correct.").arg(program); diff --git a/gui/statsdialog.cpp b/gui/statsdialog.cpp index 35fb1fef36b..24bd3d80e8f 100644 --- a/gui/statsdialog.cpp +++ b/gui/statsdialog.cpp @@ -63,10 +63,6 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -QT_CHARTS_USE_NAMESPACE -#endif - static QLineSeries *numberOfReports(const QString &fileName, const QString &severity); static QChartView *createChart(const QString &statsFile, const QString &tool); #endif diff --git a/gui/txtreport.cpp b/gui/txtreport.cpp index caa3833ef8d..ec48d83a0a6 100644 --- a/gui/txtreport.cpp +++ b/gui/txtreport.cpp @@ -77,9 +77,5 @@ void TxtReport::writeError(const ErrorItem &error) line += temp.arg(GuiSeverity::toString(error.severity)); line += error.summary; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) mTxtWriter << line << Qt::endl; -#else - mTxtWriter << line << endl; -#endif } diff --git a/gui/xmlreport.cpp b/gui/xmlreport.cpp index 3e432d62380..3ee24de7560 100644 --- a/gui/xmlreport.cpp +++ b/gui/xmlreport.cpp @@ -25,10 +25,6 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -#include -#endif - static constexpr char ResultElementName[] = "results"; static constexpr char VersionAttribute[] = "version"; diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 81445fdc308..b489af33ad7 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -33,10 +33,6 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -#include -#endif - static const QString ResultElementName = "results"; static const QString CppcheckElementName = "cppcheck"; static const QString ErrorElementName = "error"; diff --git a/releasenotes.txt b/releasenotes.txt index 99b15ff9aee..41c5c30c023 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -17,4 +17,5 @@ Deprecations: Other: - Removed deperecated support for builds via qmake. +- Removed deprecated support for builds with Qt5. - diff --git a/test/cli/QML-Samples-TableView/main.cpp b/test/cli/QML-Samples-TableView/main.cpp index 1c57799425c..21d72bf21e8 100644 --- a/test/cli/QML-Samples-TableView/main.cpp +++ b/test/cli/QML-Samples-TableView/main.cpp @@ -4,10 +4,6 @@ int main(int argc, char *argv[]) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#endif - QGuiApplication app(argc, argv); QQmlApplicationEngine engine; From 737782290a1cdd5ed2e286487611906ae8fb88b5 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 10 Aug 2024 20:04:31 +0200 Subject: [PATCH 2/3] enable --- .github/workflows/iwyu.yml | 5 +---- .github/workflows/release-windows.yml | 8 +------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 8ee1df625a6..faf1ab897de 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -2,10 +2,7 @@ # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners name: include-what-you-use -on: - schedule: - - cron: '0 0 * * 0' - workflow_dispatch: +on: [push, pull_request] permissions: contents: read diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml index 96091eb07fd..de2879fd6be 100644 --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -2,13 +2,7 @@ # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners name: release-windows -on: - push: - tags: - - '2.*' - schedule: - - cron: '0 0 * * *' - workflow_dispatch: +on: [push, pull_request] permissions: contents: read From 113de4d636518a4bb630a8509ab369f15d7e8788 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 10 Aug 2024 20:39:31 +0200 Subject: [PATCH 3/3] cleaned up GUI includes based on include-what-you-use [skip ci] --- gui/checkstatistics.cpp | 3 +++ gui/cppchecklibrarydata.cpp | 1 - gui/csvreport.cpp | 1 - .../testcppchecklibrarydata.cpp | 4 +++- gui/test/filelist/testfilelist.h | 1 - gui/test/resultstree/testresultstree.cpp | 16 ++++++++++++++-- gui/threadhandler.cpp | 3 +++ gui/translationhandler.cpp | 4 ++++ gui/xmlreportv2.cpp | 3 +++ tools/triage/mainwindow.cpp | 3 +++ 10 files changed, 33 insertions(+), 6 deletions(-) diff --git a/gui/checkstatistics.cpp b/gui/checkstatistics.cpp index 93ceb362f99..f1e7a02483b 100644 --- a/gui/checkstatistics.cpp +++ b/gui/checkstatistics.cpp @@ -21,6 +21,9 @@ #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#include +#endif CheckStatistics::CheckStatistics(QObject *parent) : QObject(parent) diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index 4628e07f85e..595f32a034d 100644 --- a/gui/cppchecklibrarydata.cpp +++ b/gui/cppchecklibrarydata.cpp @@ -28,7 +28,6 @@ #include #include #include -#include const unsigned int CppcheckLibraryData::Function::Arg::ANY = ~0U; const unsigned int CppcheckLibraryData::Function::Arg::VARIADIC = ~1U; diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index f99dd5061e3..bdbed6319ed 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -24,7 +24,6 @@ #include #include #include -#include CsvReport::CsvReport(const QString &filename) : Report(filename) diff --git a/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp b/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp index 015e8a60dec..ec467385070 100644 --- a/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp +++ b/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp @@ -23,10 +23,12 @@ #include #include #include -#include #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#include +#endif const QString TestCppcheckLibraryData::TempCfgFile = "./tmp.cfg"; diff --git a/gui/test/filelist/testfilelist.h b/gui/test/filelist/testfilelist.h index b0f1fb256c6..17a33d86e3e 100644 --- a/gui/test/filelist/testfilelist.h +++ b/gui/test/filelist/testfilelist.h @@ -17,7 +17,6 @@ */ #include -#include class TestFileList : public QObject { Q_OBJECT diff --git a/gui/test/resultstree/testresultstree.cpp b/gui/test/resultstree/testresultstree.cpp index ef673c35bfb..f6efa844a11 100644 --- a/gui/test/resultstree/testresultstree.cpp +++ b/gui/test/resultstree/testresultstree.cpp @@ -17,22 +17,34 @@ */ #include "testresultstree.h" -#include "resultstree.h" // headers that declare mocked functions/variables #include "applicationlist.h" #include "common.h" #include "threadhandler.h" #include "projectfile.h" -#include "xmlreportv2.h" +#include "application.h" #include "cppcheck.h" +#include "erroritem.h" #include "errorlogger.h" +#include "errortypes.h" #include "path.h" +#include "report.h" +#include "resultstree.h" #include "settings.h" +#include "showtypes.h" +#include "suppressions.h" +#include "xmlreport.h" +#include +#include +#include #include +#include +#include +#include #include class TestReport : public Report { diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index 1ed363eda96..86dc949f466 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -35,6 +35,9 @@ #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#include +#endif ThreadHandler::ThreadHandler(QObject *parent) : QObject(parent) diff --git a/gui/translationhandler.cpp b/gui/translationhandler.cpp index c41ccbfea96..ee523d32b25 100644 --- a/gui/translationhandler.cpp +++ b/gui/translationhandler.cpp @@ -28,7 +28,11 @@ #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#include +#else #include +#endif // Provide own translations for standard buttons. This (garbage) code is needed to enforce them to appear in .ts files even after "lupdate gui.pro" diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index b489af33ad7..5c6be59aa32 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -32,6 +32,9 @@ #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#include +#endif static const QString ResultElementName = "results"; static const QString CppcheckElementName = "cppcheck"; diff --git a/tools/triage/mainwindow.cpp b/tools/triage/mainwindow.cpp index 78706dd4737..d231515cf58 100644 --- a/tools/triage/mainwindow.cpp +++ b/tools/triage/mainwindow.cpp @@ -58,6 +58,9 @@ #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#include +#endif class QWidget;