diff options
author | Blaine | 2020-05-06 16:51:02 +0530 |
---|---|---|
committer | Blaine | 2020-05-06 16:51:02 +0530 |
commit | 97b304ea746d3ad380fa1ac31409cadc4dbb139b (patch) | |
tree | 18c1bc1b275a4b9373bc7db002470a9a8fbadd21 /src/main/python/utils/graphics.py | |
parent | 708835a4859a0c5d81a34b26442962e727a0035b (diff) | |
download | Chemical-PFD-97b304ea746d3ad380fa1ac31409cadc4dbb139b.tar.gz Chemical-PFD-97b304ea746d3ad380fa1ac31409cadc4dbb139b.tar.bz2 Chemical-PFD-97b304ea746d3ad380fa1ac31409cadc4dbb139b.zip |
scroll wheel init
Diffstat (limited to 'src/main/python/utils/graphics.py')
-rw-r--r-- | src/main/python/utils/graphics.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index fc80254..9e1f690 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -1 +1,15 @@ -pass
\ No newline at end of file +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QGraphicsView +class customView(QGraphicsView): + + def __init__(self, scene, parent=None): + super(customView, self).__init__(scene, parent) + self.zoom = 1 + + def wheelEvent(self, QWheelEvent): + if Qt.ControlModifier: + self.zoom += QWheelEvent.angleDelta().y()/2880 + self.scale(self.zoom, self.zoom) + QWheelEvent.accept() + else: + return super().wheelEvent(self, QWheelEvent)
\ No newline at end of file |