Merge pull request #46 from midnightprioriem/master

Add Qt Quick classes to CMake Configuration, Add fix for addIgnoreObject in child windows
This commit is contained in:
Yuhang Zhao 2021-03-05 13:02:31 +08:00 committed by GitHub
commit ac30e108a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
};