(self, event)
Control zooming in and out if CTRL is pressed.
Control zooming in and out if CTRL is pressed.
Control zooming in and out if CTRL is pressed .
def wheelEvent(self, event):
        """Control zooming in and out if CTRL is pressed."""
        modifiers = QtWidgets.QApplication.keyboardModifiers()
        if modifiers & QtCore.Qt.ControlModifier:
            delta = event.delta()
            zoom_speed = self.zoomSpeed() + 1
            if delta > 0:
                grid_size = self._gridSize * zoom_speed
            else:
                grid_size = self._gridSize / zoom_speed
            self.setGridSize(grid_size)
        else:
            super(AutoGrid, self).wheelEvent(event)
def wheelEvent ( self , event ) : modifiers = QtWidgets . QApplication . keyboardModifiers ( ) if modifiers & QtCore . Qt . ControlModifier : delta = event . delta ( ) zoom_speed = self . zoomSpeed ( ) + 1 if delta > 0 : grid_size = self . _gridSize * zoom_speed else : grid_size = self . _gridSize / zoom_speed self . setGridSize ( grid_size ) else : super ( AutoGrid , self ) . wheelEvent ( event )