diff options
-rw-r--r-- | src/main/python/utils/fileWindow.py | 10 | ||||
-rw-r--r-- | src/main/python/utils/graphics.py | 16 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index 24d6a6d..2fb6abb 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -142,11 +142,11 @@ class fileWindow(QMdiSubWindow): return False def moveSideViewCloseButton(self): - x = self.sideView.width() - 5 - print(x) - if self.sideView.verticalScrollBar().isVisible(): - x -= self.style().pixelMetric(QStyle.PM_ScrollBarExtent) - self.sideViewCloseButton.move(x, 5) + # x = self.rect().width()//2 - 5 + # if self.sideView.verticalScrollBar().isVisible(): + # x -= self.style().pixelMetric(QStyle.PM_ScrollBarExtent) + # self.sideViewCloseButton.move(x, 5) + self.sideViewCloseButton.move(5, 5) @property def sideViewTab(self): diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index aed7eed..8c87b96 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -8,19 +8,27 @@ class customView(QGraphicsView): super(customView, self).__init__(scene, parent) else: super(customView, self).__init__(parent) - self.zoom = 1 + self._zoom = 1 self.setDragMode(True) def wheelEvent(self, QWheelEvent): if Qt.ControlModifier: - temp = self.zoom if QWheelEvent.source() == Qt.MouseEventNotSynthesized: if self.zoom + QWheelEvent.angleDelta().y()/2880 > 0.1: self.zoom += QWheelEvent.angleDelta().y()/2880 else: if self.zoom + QWheelEvent.pixelDelta().y() > 0.1: self.zoom += QWheelEvent.angleDelta().y() - self.scale(self.zoom / temp, self.zoom / temp) QWheelEvent.accept() else: - return super().wheelEvent(self, QWheelEvent)
\ No newline at end of file + return super().wheelEvent(self, QWheelEvent) + + @property + def zoom(self): + return self._zoom + + @zoom.setter + def zoom(self, value): + temp = self.zoom + self._zoom = value + self.scale(self.zoom / temp, self.zoom / temp)
\ No newline at end of file |