From ddef1cab43bba797e8884756c5c5981d66f05aea Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Thu, 12 Nov 2020 21:20:20 +0800 Subject: [PATCH] Minor tweaks. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- winnativeeventfilter.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index 7bac9f0..dda8897 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -1131,12 +1131,14 @@ HWND getHWNDFromQObject(QObject *object) return reinterpret_cast(wid); } -void updateQtFrame_internal(const HWND handle) +void updateQtFrame_internal(const HWND handle, const bool resetToDefault = false) { Q_ASSERT(handle); if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, handle)) { - const int tbh = WinNativeEventFilter::getSystemMetric( - handle, WinNativeEventFilter::SystemMetric::TitleBarHeight); + const int tbh = resetToDefault + ? 0 + : WinNativeEventFilter::getSystemMetric( + handle, WinNativeEventFilter::SystemMetric::TitleBarHeight); #ifdef QT_WIDGETS_LIB const QWidget *widget = QWidget::find(reinterpret_cast(handle)); if (widget && widget->isTopLevel()) { @@ -1297,6 +1299,7 @@ void WinNativeEventFilter::removeFramelessWindow(void *window) if (data) { data->framelessModeEnabled = false; } + updateQtFrame_internal(hwnd, true); UpdateFrameMarginsForWindow(hwnd, true); updateWindow(window, true, false); }