From c7fedef8ae776744853f2c1e74a1ec6244f987ac Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Fri, 26 Nov 2021 15:57:17 +0100
Subject: [PATCH 01/27] premultiplies device_pixe_Ratio in the resize event in
 order to account for high dpi displays

---
 widgets/glWidget/QtGLGraphicsView.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/widgets/glWidget/QtGLGraphicsView.cc b/widgets/glWidget/QtGLGraphicsView.cc
index 862bc7e0..e909e4da 100644
--- a/widgets/glWidget/QtGLGraphicsView.cc
+++ b/widgets/glWidget/QtGLGraphicsView.cc
@@ -71,8 +71,9 @@ void QtGLGraphicsView::resizeEvent(QResizeEvent *_event) {
   QGraphicsView::resizeEvent(_event);
   if (scene())
   {
-    scene()->setSceneRect(QRect(QPoint(0, 0), _event->size()));
-    emit sceneRectChanged (QRectF (0, 0, _event->size().width(),_event->size().height()));
+
+    scene()->setSceneRect(QRect(QPoint(0, 0), screen()->devicePixelRatio() * _event->size()));
+    emit sceneRectChanged (QRectF (0, 0, _event->size().width() * screen()->devicePixelRatio(), _event->size().height() * screen()->devicePixelRatio()));
   }
   
 }
-- 
GitLab


From 6d903e032d411e542c36f0a5d0ca6a7e6275917f Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Fri, 26 Nov 2021 18:22:39 +0100
Subject: [PATCH 02/27] resets attempt at fix

---
 widgets/glWidget/QtGLGraphicsView.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/widgets/glWidget/QtGLGraphicsView.cc b/widgets/glWidget/QtGLGraphicsView.cc
index e909e4da..b2c224cf 100644
--- a/widgets/glWidget/QtGLGraphicsView.cc
+++ b/widgets/glWidget/QtGLGraphicsView.cc
@@ -71,9 +71,8 @@ void QtGLGraphicsView::resizeEvent(QResizeEvent *_event) {
   QGraphicsView::resizeEvent(_event);
   if (scene())
   {
-
-    scene()->setSceneRect(QRect(QPoint(0, 0), screen()->devicePixelRatio() * _event->size()));
-    emit sceneRectChanged (QRectF (0, 0, _event->size().width() * screen()->devicePixelRatio(), _event->size().height() * screen()->devicePixelRatio()));
+    scene()->setSceneRect(QRect(QPoint(0, 0), _event->size()));
+    emit sceneRectChanged (QRectF (0, 0, _event->size().width(), _event->size().height()));
   }
   
 }
-- 
GitLab


From 0868d9561b83c03e59a8a05569340fb423ba46b8 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Fri, 26 Nov 2021 18:23:03 +0100
Subject: [PATCH 03/27] makes glviewer aware of device pixel ratio

---
 widgets/coreWidget/CoreWidget.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc
index 8cc2e3ee..84f4418c 100644
--- a/widgets/coreWidget/CoreWidget.cc
+++ b/widgets/coreWidget/CoreWidget.cc
@@ -307,7 +307,8 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
       glViewer* newWidget = new glViewer(glScene_,
 					                               glWidget_,
                                          PluginFunctions::viewerProperties(i),
-                                         centerWidget_);
+                                         centerWidget_,
+                                         glView_->screen()->devicePixelRatio());
 
       examiner_widgets_.push_back(newWidget);
 
-- 
GitLab


From 46abfc9631e947adbe82da0c01798193e62a7194 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Fri, 26 Nov 2021 18:23:24 +0100
Subject: [PATCH 04/27] makes glviewer aware of device pixel ratio

---
 widgets/glWidget/QtBaseViewer.cc | 20 +++++++++++---------
 widgets/glWidget/QtBaseViewer.hh |  9 ++++++++-
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index 6b2509c4..58242777 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -121,7 +121,8 @@ static const char          COPY_PASTE_VIEW_START_STRING[] =
 glViewer::glViewer( QGraphicsScene* _scene,
                     OFGLWidget* _glWidget,
                     Viewer::ViewerProperties& _properties,
-                    QGraphicsWidget* _parent) :
+                    QGraphicsWidget* _parent,
+                    float devicePixelRatio) :
   QGraphicsWidget(_parent),
   glareaGrabbed_(false),
   projectionUpdateLocked_(false),
@@ -141,6 +142,7 @@ glViewer::glViewer( QGraphicsScene* _scene,
   flyAngle_(0.0),
   currentAnimationPos_(0.0),
   flyMoveBack_(false),
+  devicePixelRatio_(devicePixelRatio),
   postproc_(nullptr)
 {
 
@@ -1116,10 +1118,10 @@ void glViewer::paintGL(double _aspect)
 void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 {
   updateProjectionMatrix();
-  glstate_->viewport(scenePos().x(),
-                     scene()->height () - scenePos().y() - size().height (),
-                     size().width (), size().height (),
-                     scene()->width (), scene()->height ());
+  glstate_->viewport(scenePos().x() * getDevicePixelRatio(),
+        (scene()->height() - scenePos().y() - size().height()) * getDevicePixelRatio(),
+        size().width() * getDevicePixelRatio(), size().height() * getDevicePixelRatio(),
+        scene()->width() * getDevicePixelRatio(), scene()->height() * getDevicePixelRatio());
   update();
 
   emit viewChanged();
@@ -1127,10 +1129,10 @@ void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 
 void glViewer::moveEvent (QGraphicsSceneMoveEvent *)
 {
-  glstate_->viewport(scenePos().x(),
-                     scene()->height () - scenePos().y() - size().height (),
-                     size().width (), size().height (),
-                     scene()->width (), scene()->height ());
+  glstate_->viewport(scenePos().x() * getDevicePixelRatio(),
+        (scene()->height() - scenePos().y() - size().height()) * getDevicePixelRatio(),
+        size().width() * getDevicePixelRatio(), size().height() * getDevicePixelRatio(),
+        scene()->width() * getDevicePixelRatio(), scene()->height() * getDevicePixelRatio());
   update();
 
   emit viewChanged();
diff --git a/widgets/glWidget/QtBaseViewer.hh b/widgets/glWidget/QtBaseViewer.hh
index 9db3d828..94c52e4f 100644
--- a/widgets/glWidget/QtBaseViewer.hh
+++ b/widgets/glWidget/QtBaseViewer.hh
@@ -144,7 +144,8 @@ public:
   glViewer( QGraphicsScene*           _scene,
             OFGLWidget*                _glWidget,
             Viewer::ViewerProperties& _properties,
-            QGraphicsWidget*          _parent = 0 );
+            QGraphicsWidget*          _parent = 0,
+            float devicePixelRatio = 1.f);
 
   /// Destructor.
   virtual ~glViewer();
@@ -1081,6 +1082,12 @@ private:
     /// Flag for fly in orthogonal mode if we move back or forward
     bool flyMoveBack_;
 
+    /// Viewer has to be aware of device pixel ratio to adapt viewportsize properly
+    float devicePixelRatio_ = 1.f;
+
+    /// get device pixel ratio
+    float getDevicePixelRatio() const { return devicePixelRatio_; }
+
   signals:
     /// Emitted when the currentAnimationPosition changed
     void currentAnimationPosChanged(double _currentAnimationPos);
-- 
GitLab


From df097a52e0f092172a88e885eea65e0b2a15f383 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Mon, 6 Dec 2021 10:49:35 +0100
Subject: [PATCH 05/27] move getting of DPR into viewport method

---
 widgets/coreWidget/CoreWidget.cc |  3 +--
 widgets/glWidget/QtBaseViewer.cc | 19 ++++++++++---------
 widgets/glWidget/QtBaseViewer.hh |  6 ------
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc
index 84f4418c..8cc2e3ee 100644
--- a/widgets/coreWidget/CoreWidget.cc
+++ b/widgets/coreWidget/CoreWidget.cc
@@ -307,8 +307,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
       glViewer* newWidget = new glViewer(glScene_,
 					                               glWidget_,
                                          PluginFunctions::viewerProperties(i),
-                                         centerWidget_,
-                                         glView_->screen()->devicePixelRatio());
+                                         centerWidget_);
 
       examiner_widgets_.push_back(newWidget);
 
diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index 58242777..4e361df1 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -142,7 +142,6 @@ glViewer::glViewer( QGraphicsScene* _scene,
   flyAngle_(0.0),
   currentAnimationPos_(0.0),
   flyMoveBack_(false),
-  devicePixelRatio_(devicePixelRatio),
   postproc_(nullptr)
 {
 
@@ -1117,11 +1116,12 @@ void glViewer::paintGL(double _aspect)
 
 void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 {
+  const auto ratio = QGuiApplication::screens()[0]->devicePixelRatio();
   updateProjectionMatrix();
-  glstate_->viewport(scenePos().x() * getDevicePixelRatio(),
-        (scene()->height() - scenePos().y() - size().height()) * getDevicePixelRatio(),
-        size().width() * getDevicePixelRatio(), size().height() * getDevicePixelRatio(),
-        scene()->width() * getDevicePixelRatio(), scene()->height() * getDevicePixelRatio());
+  glstate_->viewport(scenePos().x() * ratio,
+        (scene()->height() - scenePos().y() - size().height()) * ratio,
+        size().width() * ratio, size().height() * ratio,
+        scene()->width() * ratio, scene()->height() * ratio);
   update();
 
   emit viewChanged();
@@ -1129,10 +1129,11 @@ void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 
 void glViewer::moveEvent (QGraphicsSceneMoveEvent *)
 {
-  glstate_->viewport(scenePos().x() * getDevicePixelRatio(),
-        (scene()->height() - scenePos().y() - size().height()) * getDevicePixelRatio(),
-        size().width() * getDevicePixelRatio(), size().height() * getDevicePixelRatio(),
-        scene()->width() * getDevicePixelRatio(), scene()->height() * getDevicePixelRatio());
+  const auto ratio = QGuiApplication::screens()[0]->devicePixelRatio();
+  glstate_->viewport(scenePos().x() * ratio,
+        (scene()->height() - scenePos().y() - size().height()) * ratio,
+        size().width() * ratio, size().height() * ratio,
+        scene()->width() * ratio, scene()->height() * ratio);
   update();
 
   emit viewChanged();
diff --git a/widgets/glWidget/QtBaseViewer.hh b/widgets/glWidget/QtBaseViewer.hh
index 94c52e4f..c7692b7e 100644
--- a/widgets/glWidget/QtBaseViewer.hh
+++ b/widgets/glWidget/QtBaseViewer.hh
@@ -1082,12 +1082,6 @@ private:
     /// Flag for fly in orthogonal mode if we move back or forward
     bool flyMoveBack_;
 
-    /// Viewer has to be aware of device pixel ratio to adapt viewportsize properly
-    float devicePixelRatio_ = 1.f;
-
-    /// get device pixel ratio
-    float getDevicePixelRatio() const { return devicePixelRatio_; }
-
   signals:
     /// Emitted when the currentAnimationPosition changed
     void currentAnimationPosChanged(double _currentAnimationPos);
-- 
GitLab


From 9a4578b9ef2042c7ff4ebb0343bc9e901fde52ee Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Mon, 6 Dec 2021 12:10:56 +0100
Subject: [PATCH 06/27] grabs current screen by QGraphicsWidget center and
 adapts dpi acoordingly. needs testing on system with regular/highdpi monitor

---
 widgets/glWidget/QtBaseViewer.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index 4e361df1..9b804ee7 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -1116,7 +1116,9 @@ void glViewer::paintGL(double _aspect)
 
 void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 {
-  const auto ratio = QGuiApplication::screens()[0]->devicePixelRatio();
+  const auto current_screen = QGuiApplication::screenAt(geometry().center().toPoint());
+  const auto ratio = current_screen->devicePixelRatio();
+  std::cout << "screend dpr: " << ratio << std::endl;
   updateProjectionMatrix();
   glstate_->viewport(scenePos().x() * ratio,
         (scene()->height() - scenePos().y() - size().height()) * ratio,
@@ -1129,7 +1131,9 @@ void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 
 void glViewer::moveEvent (QGraphicsSceneMoveEvent *)
 {
-  const auto ratio = QGuiApplication::screens()[0]->devicePixelRatio();
+  const auto current_screen = QGuiApplication::screenAt(geometry().center().toPoint());
+  const auto ratio = current_screen->devicePixelRatio();
+  std::cout << "screend dpr: " << ratio << std::endl;
   glstate_->viewport(scenePos().x() * ratio,
         (scene()->height() - scenePos().y() - size().height()) * ratio,
         size().width() * ratio, size().height() * ratio,
-- 
GitLab


From be477da93beb0191bb1adbfdb10278c6392d2331 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 15:54:50 +0100
Subject: [PATCH 07/27] moves devicepixelratio to viewerproperties, where it
 can be accessed from any plugin via pluginfunctions::viewerproperties...

---
 common/ViewerProperties.hh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/ViewerProperties.hh b/common/ViewerProperties.hh
index 6ad52559..115e8205 100644
--- a/common/ViewerProperties.hh
+++ b/common/ViewerProperties.hh
@@ -445,7 +445,13 @@ namespace Viewer {
       
       /// Set trackball radius   (rotation sphere when using mouse)
       void trackballRadius(double _radius );
-      
+
+      /// get device pixel ratio
+      float getDevicePixelRatio() const { return device_pixel_ratio_; };
+
+      /// set device pixel ratio
+      void setDevicePixelRatio(float dpr) { device_pixel_ratio_ = dpr; };
+
     private:
       
       /// Width of the gl scene in orthogonal mode ( defaults to 2.0 )
@@ -468,6 +474,10 @@ namespace Viewer {
       
       /// trackball radius   (rotation sphere when using mouse)
       double trackballRadius_;
+
+      /// by default the device pixel ratio is 1
+      float device_pixel_ratio_ = 1.f;
+
       
     /** @} */
 
-- 
GitLab


From 9b0b5868cbd59e8e4dcf9fc3b2f67ad83f164846 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 15:57:31 +0100
Subject: [PATCH 08/27] changes scene()-> width/height by wrapper which already
 takes DPR into account

---
 widgets/glWidget/QtBaseViewerPicking.cc | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewerPicking.cc b/widgets/glWidget/QtBaseViewerPicking.cc
index e4a17280..311b17c9 100644
--- a/widgets/glWidget/QtBaseViewerPicking.cc
+++ b/widgets/glWidget/QtBaseViewerPicking.cc
@@ -83,7 +83,9 @@ bool glViewer::pick( ACG::SceneGraph::PickTarget _pickTarget,
 
     // cache will return -1 if a update is needed or caching is not supported
     if (rv < 0)
+    {
       rv = pickColor (_pickTarget, _mousePos, _nodeIdx, _targetIdx, _hitPointPtr);
+    }
 
     // printf ("ColorPicking took %d msec\n",time.restart ());
 
@@ -106,10 +108,10 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
 {
   GLint         w = glWidth(),
                 h = glHeight(),
-                l = scenePos().x(),
-                b = scene()->height () - scenePos().y() - h,
+                l = scenePosX(),
+                b = sceneHeight() - scenePosY() - h,
                 x = _mousePos.x(),
-                y = scene()->height () - _mousePos.y(),
+                y = sceneHeight() - _mousePos.y(),
                 pW = 1,
                 pH = 1;
   GLubyte       pixels[9][4];
@@ -148,8 +150,8 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
       // the viewport for the framebuffer object
       l = 0;
       b = 0;
-      x = _mousePos.x() - scenePos().x();
-      y = glHeight() - (_mousePos.y() - scenePos().y());
+      x = _mousePos.x() - scenePosX();
+      y = glHeight() - (_mousePos.y() - scenePosY());
 
       // we can only pick inside of our window
       if (x < 0 || y < 0 || x >= (int)glWidth() || y >= (int)glHeight())
@@ -301,7 +303,7 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
   if (_hitPointPtr)
   {
     *_hitPointPtr = properties_.glState().unproject (
-      ACG::Vec3d(_mousePos.x(), scene()->height () - _mousePos.y(),depths[hit]));
+      ACG::Vec3d(_mousePos.x(), sceneHeight() - _mousePos.y(),depths[hit]));
   }
 
   return 1;
@@ -320,8 +322,8 @@ int glViewer::pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
       pickCacheTarget_ != _pickTarget)
     return -1;
 
-  GLint         x = _mousePos.x() - scenePos().x(),
-                y = glHeight() - (_mousePos.y() - scenePos().y()),
+  GLint         x = _mousePos.x() - scenePosX(),
+                y = glHeight() - (_mousePos.y() - scenePosY()),
                 pW = 1,
                 pH = 1;
   GLubyte       pixels[9][4];
@@ -413,7 +415,7 @@ int glViewer::pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
   if (_hitPointPtr)
   {
     *_hitPointPtr = properties_.glState().unproject(
-      ACG::Vec3d(_mousePos.x(), scene()->height () - _mousePos.y(),depths[hit]));
+      ACG::Vec3d(_mousePos.x(), sceneHeight () - _mousePos.y(),depths[hit]));
   }
 
   return 1;
@@ -438,7 +440,6 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget                _pickTarg
   GLubyte* buffer = 0;
   GLfloat* depths = 0;
 
-  
   // prepare GL state
   makeCurrent();
   
-- 
GitLab


From 90256396adede464ed22363950601b75bec43b98 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 15:57:58 +0100
Subject: [PATCH 09/27] adds convenience wrapper for scene resolution and
 position

---
 widgets/glWidget/QtBaseViewer.hh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/widgets/glWidget/QtBaseViewer.hh b/widgets/glWidget/QtBaseViewer.hh
index c7692b7e..c4b2a510 100644
--- a/widgets/glWidget/QtBaseViewer.hh
+++ b/widgets/glWidget/QtBaseViewer.hh
@@ -256,6 +256,12 @@ public:
 		    GLenum _buffer );
 
 
+  /// get width of scene
+  qreal sceneWidth() const;
+  qreal sceneHeight() const;
+  qreal scenePosX() const;
+  qreal scenePosY() const;
+
   /// get width of QGLWidget
   unsigned int glWidth() const;
   /// get height of QGLWidget
-- 
GitLab


From c5fd722d75d8937f58783c31ed485e6065669640 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 15:58:33 +0100
Subject: [PATCH 10/27] adds convenience wrapper for scene resolution and
 position and introduce their usage everywhere

---
 widgets/glWidget/QtBaseViewer.cc | 54 ++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 16 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index 9b804ee7..b02c6f6d 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -1117,13 +1117,15 @@ void glViewer::paintGL(double _aspect)
 void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 {
   const auto current_screen = QGuiApplication::screenAt(geometry().center().toPoint());
-  const auto ratio = current_screen->devicePixelRatio();
-  std::cout << "screend dpr: " << ratio << std::endl;
+  /// update device pixel ratio. getters in this class will make use of it
+  /// so we only need to multiply scene information
+  properties()->setDevicePixelRatio(current_screen->devicePixelRatio());
+
   updateProjectionMatrix();
-  glstate_->viewport(scenePos().x() * ratio,
-        (scene()->height() - scenePos().y() - size().height()) * ratio,
-        size().width() * ratio, size().height() * ratio,
-        scene()->width() * ratio, scene()->height() * ratio);
+  glstate_->viewport(scenePosX(),
+      (sceneHeight() - scenePosY() - glHeight()),
+      glWidth(), glHeight(),
+      sceneWidth(), sceneHeight());
   update();
 
   emit viewChanged();
@@ -1131,13 +1133,16 @@ void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
 
 void glViewer::moveEvent (QGraphicsSceneMoveEvent *)
 {
-  const auto current_screen = QGuiApplication::screenAt(geometry().center().toPoint());
-  const auto ratio = current_screen->devicePixelRatio();
-  std::cout << "screend dpr: " << ratio << std::endl;
-  glstate_->viewport(scenePos().x() * ratio,
-        (scene()->height() - scenePos().y() - size().height()) * ratio,
-        size().width() * ratio, size().height() * ratio,
-        scene()->width() * ratio, scene()->height() * ratio);
+    const auto current_screen = QGuiApplication::screenAt(geometry().center().toPoint());
+    /// update device pixel ratio. getters in this class will make use of it
+    /// so it is not necessary to manually multiply values here with it
+    properties()->setDevicePixelRatio(current_screen->devicePixelRatio());
+
+    updateProjectionMatrix();
+    glstate_->viewport(scenePosX(),
+       (sceneHeight() - scenePosY() - glHeight()),
+       glWidth(), glHeight(),
+       sceneWidth(), sceneHeight());
   update();
 
   emit viewChanged();
@@ -1460,15 +1465,32 @@ void glViewer::rotate(const ACG::Vec3d&  _axis,
 
 //-----------------------------------------------------------------------------
 
+qreal glViewer::sceneWidth() const
+{
+    return scene()->width() * properties()->getDevicePixelRatio();
+}
+
+qreal glViewer::sceneHeight() const
+{
+    return scene()->height() * properties()->getDevicePixelRatio();
+}
+
+qreal glViewer::scenePosX() const{
+    return scenePos().x() * properties()->getDevicePixelRatio();
+}
+
+qreal glViewer::scenePosY() const{
+    return scenePos().y() * properties()->getDevicePixelRatio();
+}
 
 unsigned int glViewer::glWidth() const {
-  return size().width();
+  return size().width() * properties()->getDevicePixelRatio();
 }
 unsigned int glViewer::glHeight() const {
-  return size().height();
+  return size().height() * properties()->getDevicePixelRatio();
 }
 QSize glViewer::glSize() const {
-  return QSize(size().width(),size().height());
+  return QSize(glHeight(),glHeight());
 }
 QPoint glViewer::glMapFromGlobal( const QPoint& _pos ) const {
   QPoint p (scene()->views().front()->mapFromGlobal(_pos));
-- 
GitLab


From f9148eb226329918bb999c1a36c826937fef58c4 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 15:59:05 +0100
Subject: [PATCH 11/27] introduces converter from regular pixel coordinates to
 DPR adjusted coordinates

---
 BasePlugin/PluginFunctions.hh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/BasePlugin/PluginFunctions.hh b/BasePlugin/PluginFunctions.hh
index 6172b00f..844d607f 100644
--- a/BasePlugin/PluginFunctions.hh
+++ b/BasePlugin/PluginFunctions.hh
@@ -416,6 +416,9 @@ QStringList collectObjectMaterials(bool visibleOnly, bool targetedOnly);
 DLLEXPORT
 ViewObjectMarker* defaultViewObjectMarker ();
 
+DLLEXPORT
+QPoint adjustForDevicePixelRatio(QPoint const & point);
+
 /** @} */
 
 
-- 
GitLab


From 8e4f4c269d038e40783be066de26c8f03358530b Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 15:59:13 +0100
Subject: [PATCH 12/27] introduces converter from regular pixel coordinates to
 DPR adjusted coordinates

---
 BasePlugin/PluginFunctions.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/BasePlugin/PluginFunctions.cc b/BasePlugin/PluginFunctions.cc
index 846c578a..99bff5d2 100644
--- a/BasePlugin/PluginFunctions.cc
+++ b/BasePlugin/PluginFunctions.cc
@@ -955,6 +955,14 @@ ViewObjectMarker * defaultViewObjectMarker()
   return defaultMarker_;
 }
 
+QPoint adjustForDevicePixelRatio(const QPoint &point)
+{
+    return QPoint{
+        int(point.x() * viewerProperties().getDevicePixelRatio()),
+        int(point.y() * viewerProperties().getDevicePixelRatio())
+    };
+}
+
 
 ACG::SceneGraph::BaseNode* getSceneGraphRootNode() {
    return PluginFunctions::sceneGraphRootNode_;
-- 
GitLab


From 454cf99acf51c3f0df46a6d574e45943c47c0d52 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 16:24:27 +0100
Subject: [PATCH 13/27] fixes identification mode

---
 Core/Core.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Core/Core.cc b/Core/Core.cc
index c0b80bbe..e091129e 100644
--- a/Core/Core.cc
+++ b/Core/Core.cc
@@ -804,7 +804,8 @@ Core::slotMouseEventIdentify( QMouseEvent* _event )
   size_t   node_idx, target_idx;
   ACG::Vec3d     hit_point;
 
-  if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point)) {
+  const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
+  if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, event_pos, node_idx, target_idx, &hit_point)) {
 
     BaseObjectData* object = 0;
 
@@ -813,7 +814,7 @@ Core::slotMouseEventIdentify( QMouseEvent* _event )
       InformationInterface* infoPlugin = 0;
       infoPlugin = getInfoPlugin(object->dataType());
       if(infoPlugin != 0)
-          infoPlugin->slotInformationRequested(_event->pos(), object->dataType());
+          infoPlugin->slotInformationRequested(event_pos, object->dataType());
     }
   }
 }
-- 
GitLab


From 4a9582df16b383e85b740f2587ff6622aea39905 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 16:46:30 +0100
Subject: [PATCH 14/27] fixes navigation focussing

---
 widgets/glWidget/QtBaseViewer.cc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index b02c6f6d..ee1d8789 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -1890,8 +1890,9 @@ void glViewer::viewMouseEvent(QMouseEvent* _event) {
 
 void glViewer::handleFirstPersonNavigation( QMouseEvent* _event) {
 
+  const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
   // Ego-shooter navigation mode is selected
-  QPointF f(mapFromScene(QPointF(_event->pos().x(), _event->pos().y())));
+  QPointF f(mapFromScene(QPointF(event_pos.x(), event_pos.y())));
   QPoint pos(f.x(), f.y());
 
   switch (_event->type()) {
@@ -1903,7 +1904,7 @@ void glViewer::handleFirstPersonNavigation( QMouseEvent* _event) {
   }
 
   case QEvent::MouseButtonDblClick: {
-    flyTo(_event->pos(), _event->button() == Qt::MiddleButton);
+    flyTo(event_pos, _event->button() == Qt::MiddleButton);
     break;
   }
 
@@ -1955,8 +1956,11 @@ void glViewer::handleFirstPersonNavigation( QMouseEvent* _event) {
 void glViewer::handleNormalNavigation( QMouseEvent* _event ) {
 
   makeCurrent();
+
+  const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
+
   // Normal navigation mode is selected
-  QPointF f(mapFromScene(QPointF(_event->pos().x(), _event->pos().y())));
+  QPointF f(mapFromScene(QPointF(event_pos.x(), event_pos.y())));
   QPoint pos(f.x(), f.y());
 
   switch (_event->type()) {
@@ -1990,7 +1994,7 @@ void glViewer::handleNormalNavigation( QMouseEvent* _event ) {
     }
 
     case QEvent::MouseButtonDblClick: {
-      flyTo(_event->pos(), _event->button() == Qt::MiddleButton);
+      flyTo(event_pos, _event->button() == Qt::MiddleButton);
       break;
     }
 
-- 
GitLab


From 26df9880ef691cf557aa818db2d993bd586b7cd0 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Tue, 7 Dec 2021 17:39:31 +0100
Subject: [PATCH 15/27] adds convenience wrapper adjusting of DPR

---
 BasePlugin/PluginFunctions.cc | 10 ++++------
 common/ViewerProperties.hh    | 13 +++++++++++--
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/BasePlugin/PluginFunctions.cc b/BasePlugin/PluginFunctions.cc
index 99bff5d2..29d2cd65 100644
--- a/BasePlugin/PluginFunctions.cc
+++ b/BasePlugin/PluginFunctions.cc
@@ -512,8 +512,9 @@ bool scenegraphPick( const unsigned int          _examiner ,
     if ( _refine && (_hitPointPtr != 0) ) {
 
       // Map to correct coordinates in OpenGL
-      double x = _mousePos.x();
-      double y = examiner_widget_->glHeight() - _mousePos.y();
+      const QPoint mouse_pos = PluginFunctions::adjustForDevicePixelRatio(_mousePos);
+      double x = mouse_pos.x();
+      double y = examiner_widget_->glHeight() - mouse_pos.y();
 
       ACG::Vec3d mousePoint3d;
       ACG::Vec3d direction;
@@ -957,10 +958,7 @@ ViewObjectMarker * defaultViewObjectMarker()
 
 QPoint adjustForDevicePixelRatio(const QPoint &point)
 {
-    return QPoint{
-        int(point.x() * viewerProperties().getDevicePixelRatio()),
-        int(point.y() * viewerProperties().getDevicePixelRatio())
-    };
+    return viewerProperties().adjustForDevicePixelRatio(point);
 }
 
 
diff --git a/common/ViewerProperties.hh b/common/ViewerProperties.hh
index 115e8205..de709fa4 100644
--- a/common/ViewerProperties.hh
+++ b/common/ViewerProperties.hh
@@ -447,10 +447,19 @@ namespace Viewer {
       void trackballRadius(double _radius );
 
       /// get device pixel ratio
-      float getDevicePixelRatio() const { return device_pixel_ratio_; };
+      float getDevicePixelRatio() const { return device_pixel_ratio_; }
 
       /// set device pixel ratio
-      void setDevicePixelRatio(float dpr) { device_pixel_ratio_ = dpr; };
+      void setDevicePixelRatio(float dpr) { device_pixel_ratio_ = dpr; }
+
+      /// adjust point for DPR
+      QPoint adjustForDevicePixelRatio(QPoint const & point) const
+      {
+          return QPoint{
+              int(point.x() * getDevicePixelRatio()),
+              int(point.y() * getDevicePixelRatio())
+          };
+      }
 
     private:
       
-- 
GitLab


From db84c4648c1b8bda3acfda4cbad63c469fc319fc Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 11:41:42 +0100
Subject: [PATCH 16/27] moves recalc of cursor pose up into Core.cc. so far
 only the context menu does not get its event from there, so we recalc it
 there manually

---
 Core/Core.cc                      | 148 +++++++++++++++---------------
 widgets/coreWidget/ContextMenu.cc |   8 +-
 2 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/Core/Core.cc b/Core/Core.cc
index e091129e..c7fdf34e 100644
--- a/Core/Core.cc
+++ b/Core/Core.cc
@@ -122,21 +122,21 @@ Core() :
 
   //init nodes
   root_node_scenegraph_ = new ACG::SceneGraph::SeparatorNode(0, "SceneGraph Root Node");
-  
+
   // init global data node
   root_node_scenegraph_global_ = new ACG::SceneGraph::SeparatorNode(root_node_scenegraph_ , "SceneGraph Rendered Root Node");
-  
+
   // This separator will manage the cores nodes
   core_nodes_ = new ACG::SceneGraph::SeparatorNode(root_node_scenegraph_global_, "Core Nodes");
-  
+
   // Coordsys rendering nodes
   coordsysMaterialNode_ = new ACG::SceneGraph::MaterialNode(core_nodes_,"Coordsys Material Node");
-  coordsysNode_ = new ACG::SceneGraph::CoordsysNode(coordsysMaterialNode_,"Core Coordsys Node");  
+  coordsysNode_ = new ACG::SceneGraph::CoordsysNode(coordsysMaterialNode_,"Core Coordsys Node");
   coordsysNode_->setTraverseMode (BaseNode::NodeFirst | BaseNode::SecondPass);
-  
+
   // Separator handling the nodes for data
   dataSeparatorNode_ = new ACG::SceneGraph::SeparatorNode(root_node_scenegraph_global_, "Data Separator Root Node");
-  
+
   // Separator handling the nodes for data
   dataRootNode_      = new ACG::SceneGraph::SeparatorNode(dataSeparatorNode_, "Data Root Node");
 
@@ -171,10 +171,10 @@ Core() :
 
   // set discriptions for scriptable slots
   setDescriptions();
-  
+
   // Initialize the build in dataTypes
   initializeTypes();
-  
+
   // Initialize the build in updateTypes
   initializeUpdateTypes();
 }
@@ -190,7 +190,7 @@ Core() :
  */
 void
 Core::init() {
-  
+
   // Check library versions
   checkLibraryVersions();
 
@@ -199,7 +199,7 @@ Core::init() {
 
   // Topmost node of the scenegraph
   PluginFunctions::setSceneGraphRootNode( root_node_scenegraph_ );
-  
+
   // Node below the global status nodes. All nodes with global rendering
   // will be attached here.
   PluginFunctions::setSceneGraphRootNodeGlobal(root_node_scenegraph_global_);
@@ -207,10 +207,10 @@ Core::init() {
   // Initialize the first object as the root Object for the object tree
   objectRoot_ =  dynamic_cast< BaseObject* > ( new GroupObject("ObjectRoot") );
   PluginFunctions::setDataRoot( objectRoot_ );
-  
+
   // Bring up the object manager ( has to be done after the rootobject is created)
   connect(getObjectManager(),SIGNAL(newObject(int)), this ,SLOT(newObject(int)));
-  
+
   connect(getObjectManager(),SIGNAL(deletedObject(int)), this ,SLOT(deletedObject(int)));
 
   if ( OpenFlipper::Options::gui() ) {
@@ -267,7 +267,7 @@ Core::init() {
     connect(coreWidget_, SIGNAL(showPlugins())       , this, SLOT(slotShowPlugins()));
 
     connect(coreWidget_, SIGNAL(call(QString,bool&)), this, SLOT(slotCall(QString,bool&)));
-    
+
     connect( coreWidget_->logWidget_->openMeshFilterAction_,SIGNAL(toggled(bool)), this, SLOT(enableOpenMeshErrorLog(bool)) );
 
     QScreen *screen = QGuiApplication::primaryScreen();
@@ -416,11 +416,11 @@ Core::init() {
   // connect signal to logger
   connect(this,SIGNAL(scriptLog(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection);
 
-  
+
   // ======================================================================
   // Set up QtScript Environment
   // ======================================================================
-  
+
 #if QT_VERSION_MAJOR < 6
 
   connect(&scriptEngine_, SIGNAL( signalHandlerException(const QScriptValue &) ), this, SLOT( slotScriptError(const QScriptValue &) ));
@@ -446,10 +446,10 @@ Core::init() {
 
   // Register IdList Type to scripting Engine
   qScriptRegisterSequenceMetaType< IdList >(&scriptEngine_);
-  
+
   // Register Vector of ints Type to scripting Engine
   qScriptRegisterSequenceMetaType< QVector< int > >(&scriptEngine_);
-  
+
   //==========================================================================
   // Register the 3d Vector Type to the core ( is Vec3d )
   //==========================================================================
@@ -457,7 +457,7 @@ Core::init() {
                           toScriptValueVector,
                           fromScriptValueVector,
                           scriptEngine_.newQObject(&vec3dPrototype_));
-                          
+
   // set a constructor to allow creation via Vector(x,y,z)
   QScriptValue ctorVec3 = scriptEngine_.newFunction(createVector);
   scriptEngine_.globalObject().setProperty("Vector", ctorVec3);
@@ -473,7 +473,7 @@ Core::init() {
   // set a constructor to allow creation via Vector(x,y,z)
   QScriptValue ctorVec4 = scriptEngine_.newFunction(createVector4);
   scriptEngine_.globalObject().setProperty("Vector4", ctorVec4);
-                          
+
   //==========================================================================
   // Register the DataType Class to the core
   //==========================================================================
@@ -483,11 +483,11 @@ Core::init() {
                           toScriptValueDataType,
                           fromScriptValueDataType,
                           scriptEngine_.newQObject(&DataTypePrototype_));
-                          
+
   // set a constructor to allow creation via DataType(uint)
   QScriptValue dataTypector = scriptEngine_.newFunction(createDataType);
-  scriptEngine_.globalObject().setProperty("DataType", dataTypector);     
-  
+  scriptEngine_.globalObject().setProperty("DataType", dataTypector);
+
   //==========================================================================
   // Register the Matrix Class to the core
   //==========================================================================
@@ -712,7 +712,7 @@ Core::init() {
 
   // System is ready now.
   OpenFlipper::Options::finishedStartup();
-  
+
   QTimer::singleShot(100, this, SLOT(slotExecuteAfterStartup()));
 
   // Initialize and connect the logging of the Python interpreter to the core logging facilities
@@ -861,6 +861,8 @@ Core::slotMouseEvent( QMouseEvent* _event )
   const QObject* senderPointer = sender();
   unsigned int examinerId = 0;
 
+  QMouseEvent * new_event = new QMouseEvent{_event->type(), PluginFunctions::adjustForDevicePixelRatio(_event->pos()),_event->button(),_event->buttons(),_event->modifiers()};
+
   if ( senderPointer == 0 ) {
     std::cerr << "Error : slotMouseEvent directly called! This should only be called by an examiner" << std::endl;
   } else {
@@ -893,7 +895,7 @@ Core::slotMouseEvent( QMouseEvent* _event )
 
   PluginFunctions::setActiveExaminer( examinerId );
 
-  emit PluginMouseEvent(_event );
+  emit PluginMouseEvent( new_event );
 }
 
 //-----------------------------------------------------------------------------
@@ -1018,7 +1020,7 @@ void Core::checkScenegraphDirty() {
     // This is a single pass traversal as we only need to check if there is still one node dirty in the graph
     ACG::SceneGraph::CheckDirtyAction action;
     ACG::SceneGraph::traverse( root_node_scenegraph_, action );
-    
+
     // If the scenegraph is dirty, we have to redraw
     if ( action.isDirty () )
       emit updateView ();
@@ -1028,14 +1030,14 @@ void Core::checkScenegraphDirty() {
 //-----------------------------------------------------------------------------
 
 void Core::restrictFrameRate( bool _enable ) {
-  OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",_enable); 
+  OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",_enable);
 }
 
 //-----------------------------------------------------------------------------
 
 void Core::setMaxFrameRate( int _rate ) {
   OpenFlipperSettings().setValue("Core/Gui/glViewer/maxFrameRate",_rate);
-  OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",true); 
+  OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",true);
 
   // update Timer to new framerate
   scenegraphCheckTimer_->setInterval (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
@@ -1066,7 +1068,7 @@ Core::exitApplication()
   QTimer* timer = new QTimer();
   connect(timer, SIGNAL(timeout()), this, SLOT(slotExit()));
   timer->start(100);
-  
+
 
   QApplication::quit();
 }
@@ -1101,23 +1103,23 @@ void Core::loggerState(int _state) {
 
 void Core::enableOpenMeshErrorLog(bool _state) {
   std::cerr << "Script" << std::endl;
-  
+
   // Set the state on openmesh stream
   if ( _state ) {
     omerr().enable();
   } else {
     omerr().disable();
   }
-  
+
   if ( OpenFlipper::Options::gui() ) {
     // store in application settings
     OpenFlipperSettings().setValue("Core/Gui/LogWindow/OpenMeshErrors",_state);
-    
+
     coreWidget_->logWidget_->openMeshFilterAction_->blockSignals(true);
     coreWidget_->logWidget_->openMeshFilterAction_->setChecked(_state);
     coreWidget_->logWidget_->openMeshFilterAction_->blockSignals(false);
   }
-  
+
 }
 
 //-----------------------------------------------------------------------------
@@ -1221,7 +1223,7 @@ Core::writeOnExit() {
 void Core::slotExit() {
   // Write all information on application exit
   writeOnExit();
-  
+
   // Call clearAll() before closing application
   // in order to call all object's destructors...
   clearAll();
@@ -1238,7 +1240,7 @@ void Core::slotExit() {
   // Delete Plugins to actually call their destructor
   for(PluginInfo p : plugins())
     delete p.plugin;
-  
+
   // close the log file to ensure everything is writeen correctly
   if (logFile_)
     logFile_->close();
@@ -1250,13 +1252,13 @@ void Core::slotExit() {
   // If so, delete it...
   if(OpenFlipper::Options::deleteIniFile()) {
       bool success = true;
-    
+
       // Iterate over all ini files and clear them
       QStringList optionFiles = OpenFlipper::Options::optionFiles();
       for ( int i = 0 ; i < (int)optionFiles.size(); ++i) {
           success &= QFile::remove(optionFiles[i]);
       }
-      
+
       if(!success) {
           QMessageBox::warning(0, tr("Warning"),
                                tr("One or more files could not be removed.\nDelete files manually."),
@@ -1264,10 +1266,10 @@ void Core::slotExit() {
                                QMessageBox::Ok);
       }
   }
-  
+
   // Cleanup the widgets here
   delete coreWidget_;
-  
+
   qApp->quit();
 }
 
@@ -1477,16 +1479,16 @@ void Core::snapshotBaseFileName(QString _fname, unsigned int _viewerId ){
 }
 
 void Core::snapshotFileType(QString _type, unsigned int _viewerId ){
-  
+
   if ( OpenFlipper::Options::gui() ) {
     if ( _viewerId >= OpenFlipper::Options::examinerWidgets() ) {
       emit log(LOGERR,tr("Unable to snapshotFileType for viewer ") + QString::number(_viewerId) );
       return;
     }
-    
+
     PluginFunctions::viewerProperties(_viewerId).snapshotFileType( _type );
   }
-  
+
 }
 
 
@@ -1497,10 +1499,10 @@ void Core::snapshotCounterStart(const int _counter, unsigned int _viewerId ){
       emit log(LOGERR,tr("Unable to snapshotFileType for viewer ") + QString::number(_viewerId) );
       return;
     }
-    
+
     PluginFunctions::viewerProperties(_viewerId).snapshotCounter( _counter );
   }
-  
+
 }
 
 void Core::snapshot( unsigned int _viewerId, int _width, int _height, bool _alpha, bool _hideCoordsys, int _numSamples ){
@@ -1637,7 +1639,7 @@ void Core::setDescriptions(){
                            QStringList(tr("Enable or disable fullscreen mode")));
   emit setSlotDescription("showViewModeControls(bool)", tr("Show or hide the view mode control box"),
                            QStringList(tr("Show?")) ,
-                           QStringList());                           
+                           QStringList());
   emit setSlotDescription("loggerState(int)", tr("Change the logger window state"), QStringList(tr("Change the logger window state")), QStringList());
   emit setSlotDescription("enableOpenMeshErrorLog(bool)", tr("Enable or disable OpenMesh error logging"), QStringList(tr("OpenMesh error logging enabled")), QStringList());
   emit setSlotDescription("showToolbox(bool)", tr("Show or hide toolbox"), QStringList(tr("Show or hide the toolbox")), QStringList());
@@ -1765,14 +1767,14 @@ void Core::setDescriptions(){
   emit setSlotDescription("addViewModeToolbars(QString,QString)", tr("Set toolbars for a viewmode (This automatically adds the view mode if it does not exist)"),
                           QString(tr("Name,Toolbar List")).split(","),
                           QString(tr("Name of the Viewmode,seperated list of toolbars visible in this viewmode")).split(","));
-                          
+
   emit setSlotDescription("addViewModeContextMenus(QString,QString)", tr("Set context Menus for a viewmode (This automatically adds the view mode if it does not exist)"),
                           QString(tr("Name,Context Menu List")).split(","),
-                          QString(tr("Name of the Viewmode,seperated list of Context Menus visible in this viewmode")).split(","));    
-                          
+                          QString(tr("Name of the Viewmode,seperated list of Context Menus visible in this viewmode")).split(","));
+
   emit setSlotDescription("addViewModeIcon(QString,QString)", tr("Set Icon for a viewmode (This automatically adds the view mode if it does not exist)"),
                           QString(tr("Name,Icon filename")).split(","),
-                          QString(tr("Name of the Viewmode,filename of the icon (will be taken from OpenFlippers icon directory)")).split(","));                                                    
+                          QString(tr("Name of the Viewmode,filename of the icon (will be taken from OpenFlippers icon directory)")).split(","));
 
   emit setSlotDescription("objectList(QString,QStringList)", tr("Returns object list"),
                           QString(tr("Selection type,Object types")).split(","),
@@ -1803,7 +1805,7 @@ void Core::deleteObject( int _id ){
     std::cerr << "Error while deleting object, does not exist!!" << std::endl;
     return;
   }
-  
+
   emit objectDeleted(_id);
 
   // remove the whole subtree below this item
@@ -1910,7 +1912,7 @@ void Core::slotDeleteAllObjects( ){
     ids.push_back( current->id() );
     current = current->next();
   }
-  
+
   for ( uint i = 0 ; i < ids.size(); ++i ) {
     emit objectDeleted(ids[i]);
   }
@@ -1929,22 +1931,22 @@ bool Core::checkLibraryVersions()  {
   
 //  bool ok   = true;
 //  bool warn = false;
-  
+
   QString messages;
-  
+
   QString qtCompiledVersion = QString( QT_VERSION_STR );
   QString qtCurrentVersion = qVersion();
-  
+
   if ( qtCompiledVersion != qtCurrentVersion ) {
     messages += tr("QT Library Version mismatch!\n");
-    
+
     messages += tr("Currently used QT Version:\t") + qVersion() + "\n";
     messages += tr("Link time QT Version:\t\t") + QString( QT_VERSION_STR ) + "\n";
     messages += tr("This inconsistency may lead to an unstable behavior of OpenFlipper!");
-    
+
 //    warn = true;
   }
-  
+
 //  if ( !ok ) {
 //    QString message = tr("Error! Library tests failed!\n");
 //    message += tr("The following problems have been found:\n\n");
@@ -1962,7 +1964,7 @@ bool Core::checkLibraryVersions()  {
 //    exitFailure();
 //
 //  } else if ( warn ) {
-    
+
 //    QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n");
 //    message += tr("The following checks failed:\n\n");
 //    message += messages;
@@ -1982,7 +1984,7 @@ bool Core::checkLibraryVersions()  {
     return true;
   }
   #endif
-  
+
   return true;
 }
 
@@ -1990,17 +1992,17 @@ bool Core::checkLibraryVersions()  {
 
 
 bool Core::checkOpenGLCapabilities()  {
-  
+
   // No gui->no OpenGL
   if ( OpenFlipper::Options::nogui() )
     return true;
-  
+
   // Status ok?
   bool ok   = true;
   bool warn = false;
-  
+
   QString missing;
-  
+
   QOpenGLContext* context = QOpenGLContext::currentContext();
   if ( context ) {
 
@@ -2028,39 +2030,39 @@ bool Core::checkOpenGLCapabilities()  {
     #ifdef APPLE
       message += tr("If you have more than one GPU (e.g. MacBook) don't use the internal one!\n");
     #endif
-    
+
     std::cerr << message.toStdString() << std::endl;
-    
-    
+
+
     finishSplash();
     QMessageBox::StandardButton button = StaysOnTopMessageBox::critical ( 0, tr( "Insufficient OpenGL Capabilities!"),message,QMessageBox::Abort|QMessageBox::Ignore , QMessageBox::Abort);
-    
+
     // Unsafe operation, so quit the application
     if ( button == QMessageBox::Abort )
       exitFailure();
     else {
       StaysOnTopMessageBox::warning(0,tr( "Insufficient OpenGL Capabilities!"),tr("Ignoring OpenGL capabilities might lead to unstable Operation! Do it at your own risk!"));
     }
-    
-    
-    
+
+
+
   } else if ( warn ) {
     finishSplash();
     QString message = tr("Warning! Automatic system environment checks discovered some possible problems!\n\n");
     message += tr("The following checks failed:\n\n");
     message += missing;
-        
+
     std::cerr << message.toStdString() << std::endl;
-    
+
     StaysOnTopMessageBox::warning ( 0, tr( "Detected possible problems!"),message );
-    
+
   }
   #ifndef NDEBUG
   else {
     std::cerr << "OpenGL Version Check succeeded" << std::endl;
   }
   #endif
-  
+
   return ok;
 }
 
diff --git a/widgets/coreWidget/ContextMenu.cc b/widgets/coreWidget/ContextMenu.cc
index 5eff316b..dc514e1c 100644
--- a/widgets/coreWidget/ContextMenu.cc
+++ b/widgets/coreWidget/ContextMenu.cc
@@ -59,13 +59,11 @@
 
 void CoreWidget::slotCustomContextMenu( const QPoint& _point ) {
 
-  QPoint   popupPosition;
-  QPoint   scenePos;
 
   // Calculate popup position. Use the position from the viewer which was clicked on.
-  popupPosition =  examiner_widgets_[PluginFunctions::activeExaminer()]->glMapToGlobal(_point);
-  QPointF f = examiner_widgets_[PluginFunctions::activeExaminer()]->mapToScene(QPointF(_point.x(), _point.y()));
-  scenePos = QPoint (f.x(), f.y());
+  const QPoint popupPosition = examiner_widgets_[PluginFunctions::activeExaminer()]->glMapToGlobal(_point);
+  const QPointF scenePosF = examiner_widgets_[PluginFunctions::activeExaminer()]->mapToScene(QPointF(_point.x(), _point.y()));
+  const QPoint scenePos = PluginFunctions::adjustForDevicePixelRatio(QPoint (scenePosF.x(), scenePosF.y()));
 
   // Call function to adapt the menu to the currently used contex.
   updatePopupMenu(scenePos);
-- 
GitLab


From 1805f67be00d0755ceae64d28f57758911facb3f Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 12:28:16 +0100
Subject: [PATCH 17/27] adds recalc for mousewheel, PluginMouseEventLight

---
 Core/Core.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Core/Core.cc b/Core/Core.cc
index c7fdf34e..ecf5dd38 100644
--- a/Core/Core.cc
+++ b/Core/Core.cc
@@ -827,6 +827,7 @@ Core::slotMouseEventLight( QMouseEvent* _event )
   const QObject* senderPointer = sender();
   unsigned int examinerId = 0;
 
+
   if ( senderPointer == 0 ) {
     std::cerr << "Error : slotMouseEventLight directly called! This should only be called by an examiner" << std::endl;
   } else {
@@ -843,7 +844,8 @@ Core::slotMouseEventLight( QMouseEvent* _event )
 
   PluginFunctions::setActiveExaminer( examinerId );
 
-  emit PluginMouseEventLight( _event );
+  QMouseEvent * new_event = new QMouseEvent{_event->type(), PluginFunctions::adjustForDevicePixelRatio(_event->pos()),_event->button(),_event->buttons(),_event->modifiers()};
+  emit PluginMouseEventLight( new_event );
 
 
 }
@@ -861,7 +863,6 @@ Core::slotMouseEvent( QMouseEvent* _event )
   const QObject* senderPointer = sender();
   unsigned int examinerId = 0;
 
-  QMouseEvent * new_event = new QMouseEvent{_event->type(), PluginFunctions::adjustForDevicePixelRatio(_event->pos()),_event->button(),_event->buttons(),_event->modifiers()};
 
   if ( senderPointer == 0 ) {
     std::cerr << "Error : slotMouseEvent directly called! This should only be called by an examiner" << std::endl;
@@ -895,6 +896,7 @@ Core::slotMouseEvent( QMouseEvent* _event )
 
   PluginFunctions::setActiveExaminer( examinerId );
 
+  QMouseEvent * new_event = new QMouseEvent{_event->type(), PluginFunctions::adjustForDevicePixelRatio(_event->pos()),_event->button(),_event->buttons(),_event->modifiers()};
   emit PluginMouseEvent( new_event );
 }
 
@@ -920,7 +922,8 @@ Core::slotWheelEvent( QWheelEvent * _event, const std::string & _mode)
 
   PluginFunctions::setActiveExaminer( examinerId );
 
-  emit PluginWheelEvent(_event , _mode );
+  QWheelEvent * new_event = new QWheelEvent{PluginFunctions::adjustForDevicePixelRatio(_event->position()), _event->globalPosition(), _event->pixelDelta(), _event->angleDelta(), _event->buttons(), _event->modifiers(), _event->phase(), _event->inverted(), _event->source()};
+  emit PluginWheelEvent(new_event , _mode );
 }
 
 //-----------------------------------------------------------------------------
-- 
GitLab


From 6958b1486772ebce040b257807976bd4c8fdf197 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 12:28:30 +0100
Subject: [PATCH 18/27] adds method for QPointF as well

---
 common/ViewerProperties.hh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/ViewerProperties.hh b/common/ViewerProperties.hh
index de709fa4..4cb55621 100644
--- a/common/ViewerProperties.hh
+++ b/common/ViewerProperties.hh
@@ -460,6 +460,13 @@ namespace Viewer {
               int(point.y() * getDevicePixelRatio())
           };
       }
+      QPointF adjustForDevicePixelRatio(QPointF const & point) const
+      {
+          return QPointF{
+              point.x() * getDevicePixelRatio(),
+              point.y() * getDevicePixelRatio()
+          };
+      }
 
     private:
       
-- 
GitLab


From 518bdc911bc098d73b3d080be512c4a8b66e26c0 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 12:28:48 +0100
Subject: [PATCH 19/27] adds method for QPointF as well

---
 BasePlugin/PluginFunctions.cc | 4 ++++
 BasePlugin/PluginFunctions.hh | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/BasePlugin/PluginFunctions.cc b/BasePlugin/PluginFunctions.cc
index 29d2cd65..56cc5b5a 100644
--- a/BasePlugin/PluginFunctions.cc
+++ b/BasePlugin/PluginFunctions.cc
@@ -960,6 +960,10 @@ QPoint adjustForDevicePixelRatio(const QPoint &point)
 {
     return viewerProperties().adjustForDevicePixelRatio(point);
 }
+QPointF adjustForDevicePixelRatio(const QPointF &point)
+{
+    return viewerProperties().adjustForDevicePixelRatio(point);
+}
 
 
 ACG::SceneGraph::BaseNode* getSceneGraphRootNode() {
diff --git a/BasePlugin/PluginFunctions.hh b/BasePlugin/PluginFunctions.hh
index 844d607f..559a5a2d 100644
--- a/BasePlugin/PluginFunctions.hh
+++ b/BasePlugin/PluginFunctions.hh
@@ -416,8 +416,17 @@ QStringList collectObjectMaterials(bool visibleOnly, bool targetedOnly);
 DLLEXPORT
 ViewObjectMarker* defaultViewObjectMarker ();
 
+/// regular monitors have a devicePixelRatio (DPR) of 1
+/// i.e. one pixel displayed will consist of one "physical" pixel
+/// for high dpi monitors, Qt automatically increases the DPR i.e. to 2
+/// i.e. one pixel on the screen will consist of 2x2 "physical" pixels
+/// this results in an upscaled version of the interface, to avoid obtaining small visual elements
+/// unfortunately this also happens for the rendering area, where this behavior is undesired
+/// for all interactions in the rendering area, this method will perform this conversion for you
+/// usually there is no need to use this manually, as the Core mouseeventhandling performs this conversion
 DLLEXPORT
 QPoint adjustForDevicePixelRatio(QPoint const & point);
+QPointF adjustForDevicePixelRatio(QPointF const & point);
 
 /** @} */
 
-- 
GitLab


From d5a9f5bcb2a9f1ada45edcbd3d43e0c8c61eed82 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 12:29:08 +0100
Subject: [PATCH 20/27] removes unused parameters

---
 widgets/glWidget/QtBaseViewer.cc | 3 +--
 widgets/glWidget/QtBaseViewer.hh | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index ee1d8789..383b2545 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -121,8 +121,7 @@ static const char          COPY_PASTE_VIEW_START_STRING[] =
 glViewer::glViewer( QGraphicsScene* _scene,
                     OFGLWidget* _glWidget,
                     Viewer::ViewerProperties& _properties,
-                    QGraphicsWidget* _parent,
-                    float devicePixelRatio) :
+                    QGraphicsWidget* _parent) :
   QGraphicsWidget(_parent),
   glareaGrabbed_(false),
   projectionUpdateLocked_(false),
diff --git a/widgets/glWidget/QtBaseViewer.hh b/widgets/glWidget/QtBaseViewer.hh
index c4b2a510..acab879e 100644
--- a/widgets/glWidget/QtBaseViewer.hh
+++ b/widgets/glWidget/QtBaseViewer.hh
@@ -144,8 +144,7 @@ public:
   glViewer( QGraphicsScene*           _scene,
             OFGLWidget*                _glWidget,
             Viewer::ViewerProperties& _properties,
-            QGraphicsWidget*          _parent = 0,
-            float devicePixelRatio = 1.f);
+            QGraphicsWidget*          _parent = 0);
 
   /// Destructor.
   virtual ~glViewer();
-- 
GitLab


From 7088576640f66aa3b19e4d0fbde29c40271dbf84 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 12:52:07 +0100
Subject: [PATCH 21/27] moves implementation into .cc

---
 common/ViewerProperties.cc | 20 ++++++++++++++++++++
 common/ViewerProperties.hh | 21 +++++----------------
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/common/ViewerProperties.cc b/common/ViewerProperties.cc
index 38881640..eb7c077a 100644
--- a/common/ViewerProperties.cc
+++ b/common/ViewerProperties.cc
@@ -395,6 +395,26 @@ namespace Viewer {
     trackballRadius_ = _radius; emit updated();
   }
 
+  float ViewerProperties::getDevicePixelRatio() const { return device_pixel_ratio_; }
+
+  /// set device pixel ratio
+  void ViewerProperties::setDevicePixelRatio(float dpr) { device_pixel_ratio_ = dpr; }
+
+  QPoint ViewerProperties::adjustForDevicePixelRatio(QPoint const & point) const {
+      return QPoint{
+          int(point.x() * getDevicePixelRatio()),
+          int(point.y() * getDevicePixelRatio())
+      };
+  }
+
+  QPointF ViewerProperties::adjustForDevicePixelRatio(QPointF const & point) const
+  {
+      return QPointF{
+          point.x() * getDevicePixelRatio(),
+          point.y() * getDevicePixelRatio()
+      };
+  }
+
   void ViewerProperties::stereo(bool _stereo) {
     stereo_ = _stereo;
     emit updated();
diff --git a/common/ViewerProperties.hh b/common/ViewerProperties.hh
index 4cb55621..4ec09a1d 100644
--- a/common/ViewerProperties.hh
+++ b/common/ViewerProperties.hh
@@ -447,26 +447,15 @@ namespace Viewer {
       void trackballRadius(double _radius );
 
       /// get device pixel ratio
-      float getDevicePixelRatio() const { return device_pixel_ratio_; }
+      float getDevicePixelRatio() const;
 
       /// set device pixel ratio
-      void setDevicePixelRatio(float dpr) { device_pixel_ratio_ = dpr; }
+      void setDevicePixelRatio(float dpr);
 
       /// adjust point for DPR
-      QPoint adjustForDevicePixelRatio(QPoint const & point) const
-      {
-          return QPoint{
-              int(point.x() * getDevicePixelRatio()),
-              int(point.y() * getDevicePixelRatio())
-          };
-      }
-      QPointF adjustForDevicePixelRatio(QPointF const & point) const
-      {
-          return QPointF{
-              point.x() * getDevicePixelRatio(),
-              point.y() * getDevicePixelRatio()
-          };
-      }
+      QPoint adjustForDevicePixelRatio(QPoint const & point) const;
+
+      QPointF adjustForDevicePixelRatio(QPointF const & point) const;
 
     private:
       
-- 
GitLab


From 101a14a788fdcbe4e4acdf525f24075e929f32de Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Wed, 8 Dec 2021 15:38:15 +0100
Subject: [PATCH 22/27] adds debug output

---
 widgets/glWidget/QtBaseViewer.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc
index 383b2545..65a0b5ae 100644
--- a/widgets/glWidget/QtBaseViewer.cc
+++ b/widgets/glWidget/QtBaseViewer.cc
@@ -1120,6 +1120,11 @@ void glViewer::resizeEvent(QGraphicsSceneResizeEvent *)
   /// so we only need to multiply scene information
   properties()->setDevicePixelRatio(current_screen->devicePixelRatio());
 
+  for(auto const & screen : QGuiApplication::screens())
+    std::cout << "screen DPR: " << screen->devicePixelRatio() << std::endl;
+  std::cout << "curr screen: " << current_screen->geometry().width() << " " << current_screen->geometry().height() << std::endl;
+  std::cout << "ratio: " << current_screen->devicePixelRatio() << std::endl;
+
   updateProjectionMatrix();
   glstate_->viewport(scenePosX(),
       (sceneHeight() - scenePosY() - glHeight()),
-- 
GitLab


From abc142bbd9d3dccfcacef83873d75910b2877433 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20M=C3=B6bius?= <moebius@cs.rwth-aachen.de>
Date: Thu, 9 Dec 2021 10:19:34 +0100
Subject: [PATCH 23/27] Adjust toolbar position to device pixel ratio

---
 widgets/coreWidget/picking.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/widgets/coreWidget/picking.cc b/widgets/coreWidget/picking.cc
index 723acf85..3c70caac 100644
--- a/widgets/coreWidget/picking.cc
+++ b/widgets/coreWidget/picking.cc
@@ -207,8 +207,9 @@ void CoreWidget::setActivePickToolBar(QToolBar* _tool) {
           // Add widget to the gl scene
           QGraphicsProxyWidget* item = glScene_->addWidget(_tool);
 
+
           // Put it into center of the screen
-          int midP = (glScene_->width() / 2) - (int)(_tool->width() / 2);
+          int midP = (glScene_->width() * screen()->devicePixelRatio() / 2) - (int)(_tool->width() / 2);
           item->setPos(midP, 3);
 
           item->show();
-- 
GitLab


From d6f20a9b71d5ae174caaeb2920abd5a3355bc124 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Thu, 9 Dec 2021 11:22:57 +0100
Subject: [PATCH 24/27] adjusts region picking scene resolution

---
 widgets/glWidget/QtBaseViewerPicking.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewerPicking.cc b/widgets/glWidget/QtBaseViewerPicking.cc
index 311b17c9..b274d298 100644
--- a/widgets/glWidget/QtBaseViewerPicking.cc
+++ b/widgets/glWidget/QtBaseViewerPicking.cc
@@ -433,9 +433,9 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget                _pickTarg
   GLint    w = glWidth(),
            h = glHeight(),
            l = scenePos().x(),
-           b = scene()->height () - scenePos().y() - h,
+           b = sceneHeight() - scenePos().y() - h,
            x = rect.x(),
-           y = scene()->height () - rect.bottom();
+           y = sceneHeight() - rect.bottom();
 
   GLubyte* buffer = 0;
   GLfloat* depths = 0;
-- 
GitLab


From 418a637600f1e50a0045705a3d6b6b7e52a074b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20M=C3=B6bius?= <moebius@cs.rwth-aachen.de>
Date: Thu, 9 Dec 2021 11:26:39 +0100
Subject: [PATCH 25/27] Revert

---
 widgets/coreWidget/picking.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/widgets/coreWidget/picking.cc b/widgets/coreWidget/picking.cc
index 3c70caac..b2f9a198 100644
--- a/widgets/coreWidget/picking.cc
+++ b/widgets/coreWidget/picking.cc
@@ -209,7 +209,7 @@ void CoreWidget::setActivePickToolBar(QToolBar* _tool) {
 
 
           // Put it into center of the screen
-          int midP = (glScene_->width() * screen()->devicePixelRatio() / 2) - (int)(_tool->width() / 2);
+          int midP = (glScene_->width() / 2) - (int)(_tool->width() / 2);
           item->setPos(midP, 3);
 
           item->show();
-- 
GitLab


From d00a1c0209fc2fe7ac5e3ff326c151ebe08241f3 Mon Sep 17 00:00:00 2001
From: zaza <zain.selman@rwth-aachen.de>
Date: Thu, 9 Dec 2021 18:20:40 +0100
Subject: [PATCH 26/27] fixed region picking

---
 widgets/glWidget/QtBaseViewerPicking.cc | 33 ++++++++++++-------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/widgets/glWidget/QtBaseViewerPicking.cc b/widgets/glWidget/QtBaseViewerPicking.cc
index b274d298..6add347c 100644
--- a/widgets/glWidget/QtBaseViewerPicking.cc
+++ b/widgets/glWidget/QtBaseViewerPicking.cc
@@ -432,8 +432,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget                _pickTarg
   QRect    rect = _region.boundingRect();
   GLint    w = glWidth(),
            h = glHeight(),
-           l = scenePos().x(),
-           b = sceneHeight() - scenePos().y() - h,
+           l = scenePosX(),
+           b = sceneHeight() - scenePosY() - h,
            x = rect.x(),
            y = sceneHeight() - rect.bottom();
 
@@ -468,8 +468,8 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget                _pickTarg
       // the viewport for the framebuffer object
       l = 0;
       b = 0;
-      x = rect.x() - scenePos().x();
-      y = glHeight() - (rect.bottom() - scenePos().y());
+      x = rect.x() - scenePosX();
+      y = glHeight() - (rect.bottom() - scenePosY());
 
       // we can only pick inside of our window
       if (x < 0 || y < 0 || x >= (int)glWidth() || y >= (int)glHeight())
@@ -534,22 +534,21 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget                _pickTarg
     depths = new GLfloat[ rect.width() * rect.height() ];
     glReadPixels (x, y, rect.width(), rect.height(), GL_DEPTH_COMPONENT, GL_FLOAT, depths);
 
-    /*  Debug code, writing out the depth image
-    QImage depthmapimage(rect.width(), rect.height(), QImage::Format_Indexed8);
+  }
+//  // Debug code, writing out the depth image
+//    QImage depthmapimage(rect.width(), rect.height(), QImage::Format_Indexed8);
 
-    // color map
-    for ( int i = 0 ; i <= 255 ; i++ )
-      depthmapimage.setColor( i, qRgb( i, i, i ) );
+//  // color map
+//  for ( int i = 0 ; i <= 255 ; i++ )
+//      depthmapimage.setColor( i, qRgb( i, i, i ) );
 
-    for ( int i = 0 ; i < rect.width() ; i++ )
-      for ( int j = 0 ; j < rect.height() ; j++ )
-      {
-        depthmapimage.setPixel(i,rect.height()-j-1, (unsigned int)(depths[j*rect.width()+i]*255));
-      }
+//  for ( int i = 0 ; i < rect.width() ; i++ )
+//      for ( int j = 0 ; j < rect.height() ; j++ )
+//      {
+//          depthmapimage.setPixel(i,rect.height()-j-1, (unsigned int)(buffer[j*rect.width()+i]*255));
+//      }
 
-    depthmapimage.save("test.png");
-    */
-  }
+//  depthmapimage.save("test.png");
 
   // Iterate over the bounding rectangle of the region
   for (int y_rect = 0; y_rect < rect.height (); y_rect++)
-- 
GitLab


From 37c81cd4404fb560ae8a192606259566c30e7ec5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20M=C3=B6bius?= <moebius@cs.rwth-aachen.de>
Date: Fri, 10 Dec 2021 09:46:14 +0100
Subject: [PATCH 27/27] Force CXX Standard 17 for qt6 and higher

---
 cmake/CMakeLists.txt | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index dd05c522..c57842d5 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -23,9 +23,6 @@ endif()
 # Select appropriate C++ version.
 set(OPENFLIPPER_CXX_STANDARD 11 CACHE STRING "C++ standard version to use")
 set_property(CACHE OPENFLIPPER_CXX_STANDARD PROPERTY STRINGS 11 14 17 20 23)
-set(CMAKE_CXX_STANDARD ${OPENFLIPPER_CXX_STANDARD})
-set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
-set(CMAKE_CXX_EXTENSIONS FALSE)
 
 # ACG Environment default settings
 # This is ugly but currently we need to work around the default installed on debian
@@ -113,6 +110,8 @@ endif()
 # Qt setup
 include(VCIQt)
 
+
+
 set(QT_REQUIRED_PACKAGES
   Core
   Widgets
@@ -142,6 +141,18 @@ set(QT6_REQUIRED_PACKAGES
 
 vci_qt ()
 
+# Force a minimal cxx standard for qt6 and higher
+if ( "${QT_VERSION_MAJOR}" GREATER_EQUAL "6" )
+  if ( ${OPENFLIPPER_CXX_STANDARD} LESS 17 )
+     message("QT6 requires CXX Standard to be 17 or higher. Setting it to 17 in OPENFLIPPER_CXX_STANDARD")
+     set(OPENFLIPPER_CXX_STANDARD 17)
+  endif()
+endif()
+
+set(CMAKE_CXX_STANDARD ${OPENFLIPPER_CXX_STANDARD})
+set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+set(CMAKE_CXX_EXTENSIONS FALSE)
+
 if (NOT QT_FOUND)
   message(FATAL_ERROR "Could not find any QT Version. Please specify QT_INSTALL_PATH (path to bin and include dir) to build with QT. Note that this error is also shown if not all required qt modules were found.")
 endif()
-- 
GitLab