diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/python/main.py | 2 | ||||
-rw-r--r-- | src/main/python/utils/fileWindow.py | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py index 9fc08bf..6bd23c4 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -104,7 +104,7 @@ class appWindow(QMainWindow): def resizeEvent(self, event): #overload resize to also handle resize on file windows inside if self.mdi.activeSubWindow(): - self.mdi.activeSubWindow().resizeHandler(self.mdi) + self.mdi.activeSubWindow().resizeHandler() super(appWindow, self).resizeEvent(event) def closeEvent(self, event): diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index 99f1f70..c4cf128 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -32,6 +32,8 @@ class fileWindow(QMdiSubWindow): self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.contextMenu) + self.windowStateChanged.connect(self.stateChange) + def changeTab(self, currentIndex): #placeholder function to detect tab change self.resizeHandler() @@ -48,9 +50,9 @@ class fileWindow(QMdiSubWindow): diagram.setObjectName("New") self.tabber.addTab(diagram, "New") - def resizeHandler(self, parent = None): + def resizeHandler(self): # experimental resize Handler to handle resize on parent resize. - parentRect = parent.parentWidget().rect() if parent else self.parentWidget().parentWidget().rect() + parentRect = self.mdiArea().rect() current = self.tabber.currentWidget() width, height = current.dimensions width = min(parentRect.width(), width + 100) @@ -74,7 +76,18 @@ class fileWindow(QMdiSubWindow): def resizeEvent(self, event): self.resizeHandler() super(fileWindow, self).resizeEvent(event) - + + def stateChange(self, oldState, newState): + if newState == Qt.WindowMinimized: + print("minimized") + elif newState == Qt.WindowFullScreen: + print("maximized") + else: + if oldState == Qt.WindowMinimized: + print("min to full") + else: + print("max to full") + @property def tabList(self): #returns a list of tabs in the given window |