diff options
author | Blaine | 2020-04-30 16:07:33 +0530 |
---|---|---|
committer | Blaine | 2020-04-30 16:07:33 +0530 |
commit | 8d479352c448247be8b7e080048dd588094d98b0 (patch) | |
tree | e24f6c346fe9962c00d9ef3e41cfb9b3356783a8 /src/main/python/utils/canvas.py | |
parent | 3d75d12cb5f90b3af03e7408cbdb805426485a1c (diff) | |
download | Chemical-PFD-8d479352c448247be8b7e080048dd588094d98b0.tar.gz Chemical-PFD-8d479352c448247be8b7e080048dd588094d98b0.tar.bz2 Chemical-PFD-8d479352c448247be8b7e080048dd588094d98b0.zip |
rebase
Diffstat (limited to 'src/main/python/utils/canvas.py')
-rw-r--r-- | src/main/python/utils/canvas.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py index 8bbe99b..2c99ff2 100644 --- a/src/main/python/utils/canvas.py +++ b/src/main/python/utils/canvas.py @@ -32,11 +32,7 @@ class canvas(QWidget): self.layout = QHBoxLayout(self) #create the layout of the canvas, the canvas could just subclass QGView instead self.layout.addWidget(self.view, alignment=Qt.AlignCenter) - # self.spacer = QSpacerItem(1, self.height()) #Horizonatal spacer to force view to not expand to fill widget - # self.layout.addSpacerItem(self.spacer) - # self.layout.addSpacing(0) - self.layout.setContentsMargins(0, 0, 0 ,0) - self.layout.setSpacing(0) + self.layout.setContentsMargins(0, 0, 0, 0) #set layout and background color self.setLayout(self.layout) @@ -54,20 +50,20 @@ class canvas(QWidget): def adjustView(self): #update view size width, height = self.dimensions - frameWidth = self.view.frameWidth() + frameWidth = self.view.frameWidth() self.view.setSceneRect(0, 0, width - frameWidth*2, height) # give the view some time to adjust itself prect = self.parent().parentWidget().parentWidget().parentWidget().rect() - width = width + 50 - height = height + 100 + width = width + 20 + height = height + 60 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(min(prect.width() - 50, width)) - self.view.setFixedHeight(min(prect.height() - 100, height)) + self.view.setFixedWidth(min(prect.width() - 20, width)) + self.view.setFixedHeight(min(prect.height() - 60, height)) # self.resize(width + frameWidth * 2, height + frameWidth * 2) def resizeEvent(self, event): |