diff --git a/CMakeLists.txt b/CMakeLists.txt index 10fe034515..02fc2285db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,8 +112,6 @@ include(cmake/CompilerWarnings.cmake) include(cmake/Sanitizers.cmake) enable_sanitizers(project_options) -# allow for static analysis options include(cmake/StaticAnalyzers.cmake) - if(USE_KDSINGLEAPPLICATION) if(USE_BUNDLED_KDSINGLEAPPLICATION) set(KDSingleApplication_EXAMPLES OFF CACHE BOOL "Don't build the examples") @@ -135,6 +133,10 @@ if(USE_KDSINGLEAPPLICATION) endif() endif() +# allow for static analysis options (include after kdsingleApplication because +# of potential conflict if ENABLE_QT_DEPRECATION_CHECK is used) +include(cmake/StaticAnalyzers.cmake) + # ToDo: Check if this is used anywhere option(BUILD_STATIC_LIBS ON) diff --git a/cmake/StaticAnalyzers.cmake b/cmake/StaticAnalyzers.cmake index 43964447f0..a948370d9d 100644 --- a/cmake/StaticAnalyzers.cmake +++ b/cmake/StaticAnalyzers.cmake @@ -1,18 +1,19 @@ option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" OFF) option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF) option(ENABLE_INCLUDE_WHAT_YOU_USE "Enable static analysis with include-what-you-use" OFF) +set(ENABLE_QT_DEPRECATION_CHECK "" CACHE STRING "Define hex value (e.g. 0x061100 for Qt 6.11) for testing for deprecations. Empty = OFF") if(ENABLE_CPPCHECK) find_program(CPPCHECK cppcheck) if(CPPCHECK) + message(STATUS "CPPCHECK is enabled!") set(CMAKE_CXX_CPPCHECK ${CPPCHECK} + --library=qt --suppress=missingInclude --enable=all --inline-suppr - --inconclusive - -i - ${CMAKE_SOURCE_DIR}/imgui/lib) + --inconclusive) else() message(SEND_ERROR "cppcheck requested but executable not found") endif() @@ -21,6 +22,7 @@ endif() if(ENABLE_CLANG_TIDY) find_program(CLANGTIDY clang-tidy) if(CLANGTIDY) + message(STATUS "CLANGTIDY is enabled!") set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option) else() message(SEND_ERROR "clang-tidy requested but executable not found") @@ -30,8 +32,14 @@ endif() if(ENABLE_INCLUDE_WHAT_YOU_USE) find_program(INCLUDE_WHAT_YOU_USE include-what-you-use) if(INCLUDE_WHAT_YOU_USE) + message(STATUS "INCLUDE_WHAT_YOU_USE is enabled!") set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${INCLUDE_WHAT_YOU_USE}) else() message(SEND_ERROR "include-what-you-use requested but executable not found") endif() endif() + +if(NOT "${ENABLE_QT_DEPRECATION_CHECK}" STREQUAL "") + message(STATUS "Qt deprecations warnings enabled for: ${ENABLE_QT_DEPRECATION_CHECK}") + add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=${ENABLE_QT_DEPRECATION_CHECK}) +endif() diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index 4b7b3753ed..f7e0997bdd 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -60,17 +60,16 @@ PinWidget::PinWidget(const QPixmap& pixmap, new QShortcut(Qt::Key_Escape, this, SLOT(close())); qreal devicePixelRatio = 1; -#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen(); if (currentScreen != nullptr) { devicePixelRatio = currentScreen->devicePixelRatio(); } -#endif + const int margin = static_cast(static_cast(MARGIN) * devicePixelRatio); QRect adjusted_pos = geometry + QMargins(margin, margin, margin, margin); setGeometry(adjusted_pos); -#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) + if (currentScreen != nullptr) { QPoint topLeft = currentScreen->geometry().topLeft(); adjusted_pos.setX((adjusted_pos.x() - topLeft.x()) / devicePixelRatio + @@ -83,7 +82,7 @@ PinWidget::PinWidget(const QPixmap& pixmap, resize(0, 0); move(adjusted_pos.x(), adjusted_pos.y()); } -#endif + grabGesture(Qt::PinchGesture); this->setContextMenuPolicy(Qt::CustomContextMenu);