Просмотр исходного кода

- fixed the FullScreen option not working for the 3D graphic engine (due bug of Qt5 when OpenGL window is fullscreen) by creating a sort of fullscreen

Marius Stanciu 6 лет назад
Родитель
Сommit
5f6a7eebf5
2 измененных файлов с 28 добавлено и 14 удалено
  1. 27 14
      FlatCAMApp.py
  2. 1 0
      README.md

+ 27 - 14
FlatCAMApp.py

@@ -2484,6 +2484,12 @@ class App(QtCore.QObject):
         self.isHovering = False
         self.notHovering = True
 
+        # Window geometry
+        self.x_pos = None
+        self.y_pos = None
+        self.width = None
+        self.height = None
+
         # Event signals disconnect id holders
         self.mp = None
         self.mm = None
@@ -3773,6 +3779,16 @@ class App(QtCore.QObject):
         self.defaults["global_def_notebook_width"] = notebook_width
         self.save_defaults()
 
+    def restore_main_win_geom(self):
+        try:
+            self.ui.setGeometry(self.defaults["global_def_win_x"],
+                                self.defaults["global_def_win_y"],
+                                self.defaults["global_def_win_w"],
+                                self.defaults["global_def_win_h"])
+            self.ui.splitter.setSizes([self.defaults["global_def_notebook_width"], 0])
+        except KeyError as e:
+            log.debug("App.restore_main_win_geom() --> %s" % str(e))
+
     def message_dialog(self, title, message, kind="info"):
         """
         Builds and show a custom QMessageBox to be used in FlatCAM.
@@ -5545,15 +5561,22 @@ class App(QtCore.QObject):
         self.report_usage("on_fullscreen()")
 
         if self.toggle_fscreen is False:
-            if sys.platform == 'win32':
-                self.ui.showFullScreen()
+            # self.ui.showFullScreen()
+            self.ui.setWindowFlags(self.ui.windowFlags() | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
+            a = self.ui.geometry()
+            self.x_pos = a.x()
+            self.y_pos = a.y()
+            self.width = a.width()
+            self.height = a.height()
+            self.ui.showMaximized()
             for tb in self.ui.findChildren(QtWidgets.QToolBar):
                 tb.setVisible(False)
             self.ui.splitter_left.setVisible(False)
             self.toggle_fscreen = True
         else:
-            if sys.platform == 'win32':
-                self.ui.showNormal()
+            self.ui.setWindowFlags(self.ui.windowFlags() & ~Qt.WindowStaysOnTopHint & ~Qt.FramelessWindowHint)
+            self.ui.setGeometry(self.x_pos, self.y_pos, self.width, self.height)
+            self.ui.showNormal()
             self.restore_toolbar_view()
             self.ui.splitter_left.setVisible(True)
             self.toggle_fscreen = False
@@ -10508,16 +10531,6 @@ class App(QtCore.QObject):
                         if silent is False:
                             self.log.debug("  " + param + " OK!")
 
-    def restore_main_win_geom(self):
-        try:
-            self.ui.setGeometry(self.defaults["global_def_win_x"],
-                                self.defaults["global_def_win_y"],
-                                self.defaults["global_def_win_w"],
-                                self.defaults["global_def_win_h"])
-            self.ui.splitter.setSizes([self.defaults["global_def_notebook_width"], 0])
-        except KeyError as e:
-            log.debug("App.restore_main_win_geom() --> %s" % str(e))
-
     def plot_all(self, zoom=True):
         """
         Re-generates all plots from all objects.

+ 1 - 0
README.md

@@ -18,6 +18,7 @@ CAD program, and create G-Code for Isolation routing.
 - added a new TclCommand named "bounds" which will return a list of bounds values from a supplied list of objects names. For use in Tcl Scripts
 - updated strings in the translations and the .POT file
 - added the new keywords to the default keywords list
+- fixed the FullScreen option not working for the 3D graphic engine (due bug of Qt5 when OpenGL window is fullscreen) by creating a sort of fullscreen
 
 22.09.2019