Minor improvements.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-05-03 21:05:01 +08:00
parent 123c36c374
commit 49c7b52a4e
1 changed files with 6 additions and 1 deletions

View File

@ -1186,6 +1186,9 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
const qreal dpr) -> bool { const qreal dpr) -> bool {
if (!objects.isEmpty()) { if (!objects.isEmpty()) {
for (auto &&object : qAsConst(objects)) { for (auto &&object : qAsConst(objects)) {
if (!object) {
continue;
}
#ifdef QT_WIDGETS_LIB #ifdef QT_WIDGETS_LIB
const auto widget = qobject_cast<QWidget *>(object); const auto widget = qobject_cast<QWidget *>(object);
if (widget) { if (widget) {
@ -1229,7 +1232,9 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
m_lpScreenToClient(_hWnd, &mouse); m_lpScreenToClient(_hWnd, &mouse);
const RECT frame = GetFrameSizeForWindow(_hWnd, true); const RECT frame = GetFrameSizeForWindow(_hWnd, true);
// These values are DPI-aware. // 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 bh = frame.bottom;
const LONG tbh = frame.top; const LONG tbh = frame.top;
const qreal dpr = GetDevicePixelRatioForWindow(_hWnd); const qreal dpr = GetDevicePixelRatioForWindow(_hWnd);