Salome HOME
Issue #3009: Adapt the application to HD screen
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index ca1d2950bf06693c1e563aa5762185cc74a60e71..a3c4d0ebdbf3c7c874d2abc25315c6594763d22d 100644 (file)
@@ -82,6 +82,8 @@
 #include <QMessageBox>
 #include <QAction>
 #include <QTextCodec>
+#include <QWindow>
+#include <QScreen>
 
 #include <sstream>
 #include <string>
@@ -1319,6 +1321,14 @@ bool isSameShape(const TopoDS_Shape& theShape1, const TopoDS_Shape& theShape2)
   return true;
 }
 
+qreal currentPixelRatio()
+{
+  QWindowList aWnds = qApp->topLevelWindows();
+  if (aWnds.size() > 0)
+    return aWnds.first()->devicePixelRatio();
+  return qApp->primaryScreen()->devicePixelRatio();
+}
+
 
 } // namespace ModuleBase_Tools