Salome HOME
Merge remote-tracking branch 'remotes/origin/master' into CEA_2019
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index eb66062e82e26fbb0d6736af81e64fbedfdf31e8..83d25c2ad8093b04cf335a8a458b206c748a9b7d 100644 (file)
@@ -82,6 +82,8 @@
 #include <QMessageBox>
 #include <QAction>
 #include <QTextCodec>
+#include <QWindow>
+#include <QScreen>
 
 #include <sstream>
 #include <string>
@@ -152,7 +154,6 @@ void activateWindow(QWidget* theWidget, const QString& theInfo)
 
 void setFocus(QWidget* theWidget, const QString& theInfo)
 {
-  activateWindow(theWidget);
   theWidget->setFocus();
   // rectangle of focus is not visible on tool button widgets
   theWidget->update();
@@ -1320,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