From 49c7b52a4e6087c6efe524881aad943c2528f6e7 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sun, 3 May 2020 21:05:01 +0800 Subject: [PATCH] Minor improvements. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- winnativeeventfilter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index bcdfd51..a2eee9a 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -1186,6 +1186,9 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType, const qreal dpr) -> bool { if (!objects.isEmpty()) { for (auto &&object : qAsConst(objects)) { + if (!object) { + continue; + } #ifdef QT_WIDGETS_LIB const auto widget = qobject_cast(object); if (widget) { @@ -1229,7 +1232,9 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType, m_lpScreenToClient(_hWnd, &mouse); const RECT frame = GetFrameSizeForWindow(_hWnd, true); // These values are DPI-aware. - const LONG bw = frame.left; + const LONG bw = frame.left; // identical to right + // identical to top, if the latter doesn't include the title bar + // height const LONG bh = frame.bottom; const LONG tbh = frame.top; const qreal dpr = GetDevicePixelRatioForWindow(_hWnd);