Added qquickframehelper to CMake config, mapping origin point for ignore objects should stop after first window

This commit is contained in:
Zach Hannum 2021-03-04 23:17:00 -05:00
parent 8a20747ba8
commit 6c52fb0919
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,8 @@ endif()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Quick)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Quick)
set(SOURCES
framelesshelper_global.h
@ -27,6 +29,13 @@ set(SOURCES
framelesswindowsmanager.cpp
)
if(TARGET Qt${QT_VERSION_MAJOR}::Quick)
list(APPEND SOURCES
framelessquickhelper.h
framelessquickhelper.cpp
)
endif()
if(WIN32)
list(APPEND SOURCES
winnativeeventfilter.h
@ -76,6 +85,11 @@ endif()
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::GuiPrivate
)
if(TARGET Qt${QT_VERSION_MAJOR}::Quick)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Quick
)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
)

View File

@ -873,6 +873,9 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
QPointF point = {obj->property("x").toReal(), obj->property("y").toReal()};
for (QObject *parent = obj->parent(); parent; parent = parent->parent()) {
point += {parent->property("x").toReal(), parent->property("y").toReal()};
if (parent->isWindowType()) {
break;
}
}
return point;
};