Skip to content
Snippets Groups Projects
Commit c343b860 authored by Felix Goding's avatar Felix Goding
Browse files

Add ability to zoom and move workspace by dragging it

parent 2aa504d6
No related branches found
No related tags found
3 merge requests!67WIP: B-ASIC version 1.0.0 hotfix,!65B-ASIC version 1.0.0,!36Add ability to zoom and move workspace by dragging it
Pipeline #14419 passed
......@@ -32,7 +32,6 @@ class MainWindow(QMainWindow):
self.setWindowIcon(QIcon('small_logo.png'))
self.scene = None
self.init_ui()
self.add_counter = 0
self.sub_counter = 0
self.mul_counter = 0
......@@ -48,11 +47,10 @@ class MainWindow(QMainWindow):
self.input_counter = 0
self.output_counter = 0
self.reg_counter = 0
self.zoom = 1
self.operationList = []
self.signalList = []
self.pressed_button = []
self.source = None
def init_ui(self):
......@@ -63,9 +61,16 @@ class MainWindow(QMainWindow):
def create_graphics_view(self):
self.scene = QGraphicsScene()
graphic_view = QGraphicsView(self.scene, self)
graphic_view.setRenderHint(QPainter.Antialiasing)
graphic_view.setGeometry(250, 40, 600, 520)
self.graphic_view = QGraphicsView(self.scene, self)
self.graphic_view.setRenderHint(QPainter.Antialiasing)
self.graphic_view.setGeometry(250, 40, 600, 520)
self.graphic_view.setDragMode(QGraphicsView.ScrollHandDrag)
def wheelEvent(self, event):
old_zoom = self.zoom
self.zoom += event.angleDelta().y()/2500
self.graphic_view.scale(self.zoom, self.zoom)
self.zoom = old_zoom
def exit_app(self, checked):
QApplication.quit()
......@@ -120,7 +125,6 @@ class MainWindow(QMainWindow):
self.scene.addWidget(self.addition_operation)
self.operationList.append(self.addition_operation)
self.addition_operation.connectionRequested.connect(self.connectButton)
self.operationList.append(self.addition_operation)
self.add_ports(self.addition_operation)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment