diff options
author | Blaine | 2020-04-28 15:42:24 +0530 |
---|---|---|
committer | Blaine | 2020-04-28 15:42:24 +0530 |
commit | 4f47a375887aecb2778800f375f4c4e037bf26a6 (patch) | |
tree | c0b1ede6a43fc1758a17ed1ca3a008fe27a405d6 /src | |
parent | 19f5df0a0dff91ca775f7a05aec8d5199b7ca513 (diff) | |
download | Chemical-PFD-4f47a375887aecb2778800f375f4c4e037bf26a6.tar.gz Chemical-PFD-4f47a375887aecb2778800f375f4c4e037bf26a6.tar.bz2 Chemical-PFD-4f47a375887aecb2778800f375f4c4e037bf26a6.zip |
typo
Diffstat (limited to 'src')
-rw-r--r-- | src/main/python/utils/canvas.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py index ade0d03..b158b99 100644 --- a/src/main/python/utils/canvas.py +++ b/src/main/python/utils/canvas.py @@ -47,30 +47,31 @@ class canvas(QWidget): #helper function to resize canvas self.painter.setSceneRect(0, 0, w, h) # self.view.setSceneRect(0, 0, w - self.view.frameWidth() * 2, h) + # self.adjustView() def adjustView(self): #update view size width, height = self.dimensions + frameWidth = self.view.frameWidth() + self.view.setSceneRect(0, 0, width - frameWidth*2, height) # give the view some time to adjust itself QApplication.processEvents() - self.view.setSceneRect(0, 0, width, height) - prect = self.parent().parentWidget().size() - frameWidth = self.view.frameWidth() - width = min(prect.width() - frameWidth*2, width + frameWidth * 2) - height = min(prect.height() - frameWidth*2, height + frameWidth * 2) + prect = self.parent().parentWidget().parentWidget().size() + width = width + frameWidth*2 + height = height + frameWidth * 2 if self.view.verticalScrollBar().isVisible(): width += self.style().pixelMetric(QStyle.PM_ScrollBarExtent) if self.view.horizontalScrollBar().isVisible(): height += self.style().pixelMetric(QStyle.PM_ScrollBarExtent) - self.view.setFixedWidth(width) - self.view.setFixedHeight(height) - self.resize(width + frameWidth * 2, height + frameWidth * 2) - # def resizeEvent(self, event): - # #overloaded function to also view size on window update - # self.adjustView() - # # pass + self.view.setFixedWidth(min(prect.width() - frameWidth*2, width)) + self.view.setFixedHeight(min(prect.height() - frameWidth*2, height)) + # self.resize(width + frameWidth * 2, height + frameWidth * 2) + def resizeEvent(self, event): + #overloaded function to also view size on window update + self.adjustView() + # pass def setCanvasSize(self, size): """ |