Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)

Expand Down
14 changes: 11 additions & 3 deletions cmake/StaticAnalyzers.cmake
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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")
Expand All @@ -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()
7 changes: 3 additions & 4 deletions src/tools/pin/pinwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(static_cast<double>(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 +
Expand All @@ -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);
Expand Down
Loading