This commit is contained in:
朱子楚\zhuzi 2023-12-28 20:47:36 +08:00
parent 46f7299362
commit 91a692484f
2 changed files with 4 additions and 2 deletions

View File

@ -65,7 +65,6 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
endforeach() endforeach()
endif() endif()
#qml
if (FLUENTUI_BUILD_STATIC_LIB) if (FLUENTUI_BUILD_STATIC_LIB)
set(LIB_TYPE "STATIC") set(LIB_TYPE "STATIC")
else() else()

View File

@ -153,7 +153,7 @@ void FluFramelessHelper::_updateCursor(int edges){
} }
bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){ bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){
if (!window.isNull() && window->flags() & Qt::FramelessWindowHint) { if (!window.isNull() && window->flags()) {
static int edges = 0; static int edges = 0;
const int margin = 8; const int margin = 8;
@ -223,7 +223,9 @@ void FluFramelessHelper::componentComplete(){
} }
if(!window.isNull()){ if(!window.isNull()){
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3))
window->setFlags(window->flags() | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint); window->setFlags(window->flags() | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
#endif
_nativeEvent =new FramelessEventFilter(this); _nativeEvent =new FramelessEventFilter(this);
qApp->installNativeEventFilter(_nativeEvent); qApp->installNativeEventFilter(_nativeEvent);
HWND hwnd = reinterpret_cast<HWND>(window->winId()); HWND hwnd = reinterpret_cast<HWND>(window->winId());
@ -234,6 +236,7 @@ void FluFramelessHelper::componentComplete(){
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION); SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
} }
showShadow(hwnd); showShadow(hwnd);
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
#else #else
window->setFlags((window->flags() & (~Qt::WindowMinMaxButtonsHint) & (~Qt::Dialog)) | Qt::FramelessWindowHint | Qt::Window); window->setFlags((window->flags() & (~Qt::WindowMinMaxButtonsHint) & (~Qt::Dialog)) | Qt::FramelessWindowHint | Qt::Window);
#endif #endif