summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlaine2020-04-29 11:44:33 +0530
committerBlaine2020-04-29 11:44:33 +0530
commit6b5859af7ae5097baa2401eb25816cc8a6191a77 (patch)
tree0d6abe9e952f9e88ed1a77e323e962b0d6bdce3d /src
parent6d3259d56837b172ce8957fd28c0fa3436066262 (diff)
downloadChemical-PFD-6b5859af7ae5097baa2401eb25816cc8a6191a77.tar.gz
Chemical-PFD-6b5859af7ae5097baa2401eb25816cc8a6191a77.tar.bz2
Chemical-PFD-6b5859af7ae5097baa2401eb25816cc8a6191a77.zip
add state change markers
Diffstat (limited to 'src')
-rw-r--r--src/main/python/main.py2
-rw-r--r--src/main/python/utils/fileWindow.py19
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