From bb6e4e6ad44aa59d8d7c0de865b41df3febea0d2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 14 Mar 2019 19:51:44 +0100 Subject: [PATCH] fix mouse selection for high DPI screens --- src/Gui/MouseSelection.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Gui/MouseSelection.cpp b/src/Gui/MouseSelection.cpp index 06c0c97f7f..e5aff0d1e8 100644 --- a/src/Gui/MouseSelection.cpp +++ b/src/Gui/MouseSelection.cpp @@ -390,7 +390,16 @@ int PolyPickerSelection::locationEvent(const SoLocation2Event* const, const QPoi if (polyline.isWorking()) { // check the position +#if QT_VERSION >= 0x050000 + qreal dpr = _pcView3D->getGLWidget()->devicePixelRatioF(); +#else + qreal dpr = 1.0; +#endif QRect r = _pcView3D->getGLWidget()->rect(); + if (dpr != 1.0) { + r.setHeight(r.height()*dpr); + r.setWidth(r.width()*dpr); + } if (!r.contains(clPoint)) { if (clPoint.x() < r.left()) @@ -599,7 +608,16 @@ int FreehandSelection::locationEvent(const SoLocation2Event* const e, const QPoi if (polyline.isWorking()) { // check the position +#if QT_VERSION >= 0x050000 + qreal dpr = _pcView3D->getGLWidget()->devicePixelRatioF(); +#else + qreal dpr = 1.0; +#endif QRect r = _pcView3D->getGLWidget()->rect(); + if (dpr != 1.0) { + r.setHeight(r.height()*dpr); + r.setWidth(r.width()*dpr); + } if (!r.contains(clPoint)) { if (clPoint.x() < r.left())