Skip to content
Snippets Groups Projects
Commit f00c98f9 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Add ctrl + wheel zoom to scheduler GUI

parent e1a6bfb4
No related branches found
No related tags found
1 merge request!146Add ctrl + wheel zoom to scheduler GUI
Pipeline #88662 passed
...@@ -97,6 +97,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -97,6 +97,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
_debug_rects: QGraphicsItemGroup _debug_rects: QGraphicsItemGroup
_splitter_pos: int _splitter_pos: int
_splitter_min: int _splitter_min: int
_zoom: float
def __init__(self): def __init__(self):
"""Initialize Scheduler-gui.""" """Initialize Scheduler-gui."""
...@@ -105,6 +106,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -105,6 +106,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self._graph = None self._graph = None
self._scale = 75.0 self._scale = 75.0
self._debug_rects = None self._debug_rects = None
self._zoom = 1.0
self.setupUi(self) self.setupUi(self)
self._read_settings() self._read_settings()
...@@ -186,6 +188,13 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -186,6 +188,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self._graph._redraw_from_start() self._graph._redraw_from_start()
# self._printButtonPressed('callback_pushButton()') # self._printButtonPressed('callback_pushButton()')
def wheelEvent(self, event):
if event.modifiers() == Qt.KeyboardModifier.ControlModifier:
old_zoom = self._zoom
self._zoom += event.angleDelta().y() / 2500
self.view.scale(self._zoom, self._zoom)
self._zoom = old_zoom
@Slot() @Slot()
def _load_schedule_from_pyfile(self) -> None: def _load_schedule_from_pyfile(self) -> None:
"""SLOT() for SIGNAL(menu_load_from_file.triggered) """SLOT() for SIGNAL(menu_load_from_file.triggered)
......
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