From 162bafc682a477a2df37f6498e5abfa846ea7a89 Mon Sep 17 00:00:00 2001 From: tianduanrui Date: Fri, 30 Aug 2019 23:49:33 +0800 Subject: [PATCH] update test mouse locker. --- test/testmouselocker11/mainwindow.ui | 19 ------------------- test/testmouselocker11/qqtmouselocker_win.cpp | 14 ++++++++------ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/test/testmouselocker11/mainwindow.ui b/test/testmouselocker11/mainwindow.ui index 19156fdb..dd53ab31 100644 --- a/test/testmouselocker11/mainwindow.ui +++ b/test/testmouselocker11/mainwindow.ui @@ -85,25 +85,6 @@ - - - - 0 - 0 - 633 - 17 - - - - - - TopToolBarArea - - - false - - - diff --git a/test/testmouselocker11/qqtmouselocker_win.cpp b/test/testmouselocker11/qqtmouselocker_win.cpp index 46d95d87..8e648feb 100644 --- a/test/testmouselocker11/qqtmouselocker_win.cpp +++ b/test/testmouselocker11/qqtmouselocker_win.cpp @@ -192,13 +192,15 @@ void QQtMouseLockerImpl::mouseMoveEvent ( QMouseEvent* event, QWidget* target ) p0 = w.mapToGlobal ( p0 ); p1 = w.mapToGlobal ( p1 ); - QRect r0 = QRect ( p0, p1 ); - mainWinRect.left = ( LONG ) r0.left(); - mainWinRect.right = ( LONG ) r0.right(); - mainWinRect.top = ( LONG ) r0.top(); - mainWinRect.bottom = ( LONG ) r0.bottom(); + qreal ratio = w.devicePixelRatioF(); - qr0 = r0; + QRect r0 = QRect ( p0, p1 ); + mainWinRect.left = ( LONG ) r0.left() * ratio; + mainWinRect.right = ( LONG ) r0.right() * ratio; + mainWinRect.top = ( LONG ) r0.top() * ratio; + mainWinRect.bottom = ( LONG ) r0.bottom() * ratio; + + qr0 = QRect ( QPoint ( r0.left() * ratio, r0.top() * ratio ), QPoint ( r0.right() * ratio, r0.bottom() * ratio ) ); } #endif