Exemplo n.º 1
0
    def wheelEvent(self, event: QWheelEvent):
        """
        Zoom in or out of the view.
        """
        if event.modifiers() & Qt.ControlModifier or event.modifiers(
        ) & Qt.MetaModifier:
            zoomInFactor = 1.25
            zoomOutFactor = 1 / zoomInFactor

            # Save the scene pos
            oldPos = self.mapToScene(event.pos())

            # Zoom
            if event.angleDelta().y() > 0:
                zoomFactor = zoomInFactor
            else:
                zoomFactor = zoomOutFactor
            self.scale(zoomFactor, zoomFactor)

            # Get the new position
            newPos = self.mapToScene(event.pos())

            # Move scene to old position
            delta = newPos - oldPos
            self.translate(delta.x(), delta.y())
Exemplo n.º 2
0
 def on_wheel_turn(self, event: QtGui.QWheelEvent) -> None:
     if event.modifiers() & PAN_X_MODIFIER:
         self._api.video.view.pan_x += event.angleDelta().y() / 15 / 100
     elif event.modifiers() & PAN_Y_MODIFIER:
         self._api.video.view.pan_y += event.angleDelta().y() / 15 / 100
     else:
         self._api.video.view.zoom += event.angleDelta().y() / 15 / 100
Exemplo n.º 3
0
 def wheelEvent(self, a0: QtGui.QWheelEvent) -> None:
     if len(self.tdrWindow.td) == 0:
         a0.ignore()
         return
     chart_height = self.chartHeight
     chart_width = self.chartWidth
     do_zoom_x = do_zoom_y = True
     if a0.modifiers() == QtCore.Qt.ShiftModifier:
         do_zoom_x = False
     if a0.modifiers() == QtCore.Qt.ControlModifier:
         do_zoom_y = False
     if a0.angleDelta().y() > 0:
         # Zoom in
         a0.accept()
         # Center of zoom = a0.x(), a0.y()
         # We zoom in by 1/10 of the width/height.
         rate = a0.angleDelta().y() / 120
         if do_zoom_x:
             zoomx = rate * chart_width / 10
         else:
             zoomx = 0
         if do_zoom_y:
             zoomy = rate * chart_height / 10
         else:
             zoomy = 0
         absx = max(0, a0.x() - self.leftMargin)
         absy = max(0, a0.y() - self.topMargin)
         ratiox = absx / chart_width
         ratioy = absy / chart_height
         # TODO: Change zoom to center on the mouse if possible, or extend box to the side that has room if not.
         p1x = int(self.leftMargin + ratiox * zoomx)
         p1y = int(self.topMargin + ratioy * zoomy)
         p2x = int(self.leftMargin + chart_width - (1 - ratiox) * zoomx)
         p2y = int(self.topMargin + chart_height - (1 - ratioy) * zoomy)
         self.zoomTo(p1x, p1y, p2x, p2y)
     elif a0.angleDelta().y() < 0:
         # Zoom out
         a0.accept()
         # Center of zoom = a0.x(), a0.y()
         # We zoom out by 1/9 of the width/height, to match zoom in.
         rate = -a0.angleDelta().y() / 120
         if do_zoom_x:
             zoomx = rate * chart_width / 9
         else:
             zoomx = 0
         if do_zoom_y:
             zoomy = rate * chart_height / 9
         else:
             zoomy = 0
         absx = max(0, a0.x() - self.leftMargin)
         absy = max(0, a0.y() - self.topMargin)
         ratiox = absx / chart_width
         ratioy = absy / chart_height
         p1x = int(self.leftMargin - ratiox * zoomx)
         p1y = int(self.topMargin - ratioy * zoomy)
         p2x = int(self.leftMargin + chart_width + (1 - ratiox) * zoomx)
         p2y = int(self.topMargin + chart_height + (1 - ratioy) * zoomy)
         self.zoomTo(p1x, p1y, p2x, p2y)
     else:
         a0.ignore()
Exemplo n.º 4
0
 def wheelEvent(self, a0: QtGui.QWheelEvent) -> None:
     if len(self.data) == 0 and len(self.reference) == 0:
         a0.ignore()
         return
     do_zoom_x = do_zoom_y = True
     if a0.modifiers() == QtCore.Qt.ShiftModifier:
         do_zoom_x = False
     if a0.modifiers() == QtCore.Qt.ControlModifier:
         do_zoom_y = False
     if a0.angleDelta().y() > 0:
         # Zoom in
         a0.accept()
         # Center of zoom = a0.x(), a0.y()
         # We zoom in by 1/10 of the width/height.
         rate = a0.angleDelta().y() / 120
         if do_zoom_x:
             zoomx = rate * self.chartWidth / 10
         else:
             zoomx = 0
         if do_zoom_y:
             zoomy = rate * self.chartHeight / 10
         else:
             zoomy = 0
         absx = max(0, a0.x() - self.leftMargin)
         absy = max(0, a0.y() - self.topMargin)
         ratiox = absx / self.chartWidth
         ratioy = absy / self.chartHeight
         p1x = int(self.leftMargin + ratiox * zoomx)
         p1y = int(self.topMargin + ratioy * zoomy)
         p2x = int(self.leftMargin + self.chartWidth - (1 - ratiox) * zoomx)
         p2y = int(self.topMargin + self.chartHeight - (1 - ratioy) * zoomy)
         self.zoomTo(p1x, p1y, p2x, p2y)
     elif a0.angleDelta().y() < 0:
         # Zoom out
         a0.accept()
         # Center of zoom = a0.x(), a0.y()
         # We zoom out by 1/9 of the width/height, to match zoom in.
         rate = -a0.angleDelta().y() / 120
         if do_zoom_x:
             zoomx = rate * self.chartWidth / 9
         else:
             zoomx = 0
         if do_zoom_y:
             zoomy = rate * self.chartHeight / 9
         else:
             zoomy = 0
         absx = max(0, a0.x() - self.leftMargin)
         absy = max(0, a0.y() - self.topMargin)
         ratiox = absx / self.chartWidth
         ratioy = absy / self.chartHeight
         p1x = int(self.leftMargin - ratiox * zoomx)
         p1y = int(self.topMargin - ratioy * zoomy)
         p2x = int(self.leftMargin + self.chartWidth + (1 - ratiox) * zoomx)
         p2y = int(self.topMargin + self.chartHeight + (1 - ratioy) * zoomy)
         self.zoomTo(p1x, p1y, p2x, p2y)
     else:
         a0.ignore()
Exemplo n.º 5
0
    def wheelEvent(self, a0: QWheelEvent):
        if(a0.modifiers() == QtCore.Qt.NoModifier):
            dz = a0.angleDelta().y() * 0.01
            self.DistanceStack[self.activeCamStackIdx] *= math.pow(1.2, -dz)
            self.DistanceStack[self.activeCamStackIdx] = self.SceneUserLimit if (self.DistanceStack[self.activeCamStackIdx] > self.SceneUserLimit) else self.DistanceStack[self.activeCamStackIdx]

        if (a0.modifiers() == QtCore.Qt.ControlModifier):
            dz = a0.angleDelta().y() * 0.005
            Val = self.FOVYStack[self.activeCamStackIdx] * math.pow(1.2, -dz)
            if Val > 1 and Val < 360:
                self.FOVYStack[self.activeCamStackIdx] = Val

        self.update()
Exemplo n.º 6
0
 def wheelEvent(self, a0: QtGui.QWheelEvent) -> None:
     if ((len(self.data) == 0 and len(self.reference) == 0)
             or a0.angleDelta().y() == 0):
         a0.ignore()
         return
     do_zoom_x = do_zoom_y = True
     if a0.modifiers() == QtCore.Qt.ShiftModifier:
         do_zoom_x = False
     if a0.modifiers() == QtCore.Qt.ControlModifier:
         do_zoom_y = False
     self._wheel_zomm(a0, do_zoom_x, do_zoom_y,
                      math.copysign(1,
                                    a0.angleDelta().y()))
Exemplo n.º 7
0
    def wheelEvent(self, event):
        if self.control_scheme.wheel_zooms:
            dy = event.angleDelta().y()
            # Filter out horizontal wheel motion. We don't support this yet.
            if dy == 0:
                event.ignore()
                return
            self.zoom_camera(dy)
        else:
            if event.modifiers() & Qt.ShiftModifier:
                event = QWheelEvent(event.posF(),
                                    event.globalPosF(),
                                    event.pixelDelta(),
                                    event.angleDelta(),

                                    # Value magically chosen to approximate
                                    # what is happening on nirvana using
                                    # a steelseries mouse...
                                    event.angleDelta().y() / 8,

                                    Qt.Horizontal,  # Qt4 crap
                                    event.buttons(),
                                    event.modifiers(),
                                    event.phase())
            super().wheelEvent(event)
Exemplo n.º 8
0
    def mouse_wheel_event(self, e: QWheelEvent):
        delta: QtCore.QPoint = e.pixelDelta()
        if delta is None or delta.y() == 0:
            delta = e.angleDelta() / 10
        modifiers = int(e.modifiers())

        if modifiers and modifiers & MOD_MASK == modifiers:
            keyname = QKeySequence(modifiers).toString()
            if keyname == "Ctrl+":
                oldpos = self.UI.graphicsView.mapToScene(e.pos())
                self.scale_display(delta.y() * 0.01)
                newpos = self.UI.graphicsView.mapToScene(e.pos())
                deltapos = newpos - oldpos
                self.UI.graphicsView.translate(deltapos.x(), deltapos.y())
            if keyname == "Ctrl+Shift+":
                value = self.UI.BrushSizeSlider.value() + delta.y()
                self.UI.BrushSizeSlider.setValue(value)
            if keyname == "Shift+":
                delta *= self.scroll_speed
                value = self.UI.graphicsView.horizontalScrollBar().value(
                ) + delta.y()
                self.UI.graphicsView.horizontalScrollBar().setValue(value)
        else:
            delta *= self.scroll_speed
            value = self.UI.graphicsView.verticalScrollBar().value() + delta.y(
            )
            self.UI.graphicsView.verticalScrollBar().setValue(value)

        if self.paint_mode == PMode.Brush:
            # Update cursor position
            r = int(self.brush_size / 2)
            curr_pos = self.UI.graphicsView.mapToScene(e.pos())
            curr_pos.setX(curr_pos.x() - r)
            curr_pos.setY(curr_pos.y() - r)
            self.brush_cursor.setPos(curr_pos)
Exemplo n.º 9
0
    def wheelEvent(self, a0: qg.QWheelEvent) -> None:
        """Zoom in or out when Ctrl+MouseWheel is used.

        Most mice send rotation in units of 1/8 of a degree and each notch goes
        15 degrees. I am changing the zoom as a
        """
        if a0.modifiers() == qc.Qt.ControlModifier:
            ndegrees = a0.angleDelta().y() / 8.0
            if ndegrees > 0:
                [self.zoomIn() for ii in range(int(ndegrees / 15))]
            else:
                [self.zoomOut() for ii in range(int(-ndegrees / 15))]
            # logging.debug('Angle %f degrees', a0.angleDelta().y() / 8)
            a0.accept()
        elif a0.modifiers() == qc.Qt.NoModifier:
            super(FrameView, self).wheelEvent(a0)
Exemplo n.º 10
0
    def wheelEvent(self, a0: QtGui.QWheelEvent) -> None:
        if self.selector.labels and self.pressHoldSel:
            return super().wheelEvent(a0)

        if a0.modifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier:
            c = self.hover.cats()
            if len(c) == 1:
                v = a0.angleDelta().y() or a0.angleDelta().x()
                self.hover.incr() if v > 0 else self.hover.decr()
                self.repaint()
            return super().wheelEvent(a0)

        lastScale = self.scale
        if a0.angleDelta().y() > 0:
            self.scale = min(
                self.scale < 1 and self.scale + 0.125 or self.scale + 1, 32)
        else:
            self.scale = max(
                self.scale <= 1 and self.scale - 0.125 or self.scale - 1, 0.25)

        c = a0.pos()
        self.viewOrigin[0] = int((self.viewOrigin[0] - c.x()) * self.scale /
                                 lastScale + c.x())
        self.viewOrigin[1] = int((self.viewOrigin[1] - c.y()) * self.scale /
                                 lastScale + c.y())
        self.pan(0, 0)
        return super().wheelEvent(a0)
Exemplo n.º 11
0
 def wheelEvent(self, a0: QWheelEvent) -> None:
     if a0.modifiers() & Qt.ControlModifier:
         # ctrl press + scroll
         delta = a0.angleDelta().y()
         self.ctrlWheelScrolled.emit(delta)
     else:
         super(BasicTreeView, self).wheelEvent(a0)
Exemplo n.º 12
0
 def wheelEvent(self, event: QWheelEvent) -> None:
     """"""
     d_value = event.angleDelta().y() / 120
     d_value = -4 * d_value
     if event.modifiers() & Qt.ShiftModifier:
         horizontal_scrollbar = self.horizontalScrollBar()
         if horizontal_scrollbar.isVisible():
             value = horizontal_scrollbar.value()
             horizontal_scrollbar.setValue(value + d_value)
     elif event.modifiers() & Qt.ControlModifier:
         factor = 1.09 if d_value < 0 else 0.91
         self.zoom_by_given_factor(factor, factor)
     else:
         vertical_scrollbar = self.verticalScrollBar()
         if vertical_scrollbar.isVisible():
             value = vertical_scrollbar.value()
             vertical_scrollbar.setValue(value + d_value)
Exemplo n.º 13
0
    def wheelEvent(self, e: QWheelEvent):
        if e.modifiers() and Qt.ControlModifier:
            if e.angleDelta().y() > 0:
                self.view.zoomIn(6)
            else:
                self.view.zoomOut(6)

        else:
            super().wheelEvent(e)
Exemplo n.º 14
0
 def wheelEvent(self, event: QWheelEvent):
     if event.modifiers() == QtCore.Qt.ControlModifier:
         self.font_size = self.font_size + event.angleDelta().y() / 15
         if self.font_size < 5:
             self.font_size = 5
         #fnt = self.ui.CsvVisualizer.font()
         #fnt.setPointSize(self.font_size)
         #self.ui.CsvVisualizer.setFont(fnt)
     else:
         event.ignore()
Exemplo n.º 15
0
    def wheelEvent(self, evt: QtGui.QWheelEvent) -> None:
        if evt.modifiers() == Qt.ShiftModifier:
            offset = self.xOffset()
            offset -= 2 * evt.angleDelta().y()
            offset = min(self.maximumXOffset(), offset)
            offset = max(0, offset)
            self.setXOffset(offset)
            evt.accept()
            return

        elif evt.modifiers() == Qt.ControlModifier:
            offset = self.yOffset()
            offset -= evt.angleDelta().y()
            offset = min(self.maximumYOffset(), offset)
            offset = max(0, offset)
            self.setYOffset(offset)
            evt.accept()
            return

        super().wheelEvent(evt)
Exemplo n.º 16
0
 def wheelEvent(self, event: QWheelEvent) -> None:
     if event.modifiers() & Qt.KeyboardModifier.ControlModifier:
         distance = 1 if event.angleDelta().y() > 0 else -1
         new_size = self.font().pointSize() + distance
         if new_size < 5:
             return
         font = self.font()
         font.setPointSize(new_size)
         self.setFont(font)
         self._api.cfg.opt["gui"]["fonts"][
             self.objectName()] = self.font().toString()
Exemplo n.º 17
0
    def wheelEvent(self, event: QtGui.QWheelEvent):
        steps = qt_utils.get_wheel_steps(event)

        keys = event.modifiers()
        if keys & QtCore.Qt.ShiftModifier:
            self.tune_amplitude(self.settings.exact_step * steps)
        elif keys & QtCore.Qt.ControlModifier:
            self.tune_amplitude(self.settings.rough_step * steps)
        else:
            self.tune_amplitude(self.settings.common_step * steps)

        event.accept()
Exemplo n.º 18
0
    def wheelMeasureEvent(
            self, measure: measured_track_editor.BaseMeasureEditor, evt: QtGui.QWheelEvent) -> None:
        assert isinstance(measure, BeatMeasureEditor), type(measure).__name__

        if evt.modifiers() in (Qt.NoModifier, Qt.ShiftModifier):
            if evt.modifiers() == Qt.ShiftModifier:
                vel_delta = (1 if evt.angleDelta().y() > 0 else -1)
            else:
                vel_delta = (10 if evt.angleDelta().y() > 0 else -10)

            click_time = measure.xToTime(evt.pos().x())

            for beat in measure.measure.beats:
                if beat.time == click_time:
                    with self.project.apply_mutations(
                            '%s: Change beat velocity' % measure.track.name):
                        beat.velocity = max(0, min(127, beat.velocity + vel_delta))
                    evt.accept()
                    return

        super().wheelMeasureEvent(measure, evt)
Exemplo n.º 19
0
    def wheelEvent(self, evt: QtGui.QWheelEvent) -> None:
        self.__mouse_pos = evt.pos()

        measure_editor = self.track.measureEditorAt(evt.pos())
        if isinstance(measure_editor, MeasureEditor):
            measure_evt = QtGui.QWheelEvent(
                evt.pos() - measure_editor.topLeft(), evt.globalPos(),
                evt.pixelDelta(), evt.angleDelta(), 0, Qt.Horizontal,
                evt.buttons(), evt.modifiers(), evt.phase(), evt.source())
            measure_evt.setAccepted(False)
            self.wheelMeasureEvent(measure_editor, measure_evt)
            evt.setAccepted(measure_evt.isAccepted())
Exemplo n.º 20
0
    def wheelEvent(self, event: QtGui.QWheelEvent):
        if not event.modifiers() & QtCore.Qt.ControlModifier:
            return

        delta = event.angleDelta().y()

        if delta > 0:
            zoomFactor = self.ZOOM_FACTOR
        else:
            zoomFactor = 1. / self.ZOOM_FACTOR

        self.scale(zoomFactor, zoomFactor)
Exemplo n.º 21
0
 def wheelEvent(self, event: QtGui.QWheelEvent) -> None:
     modifiers = event.modifiers()
     angle = event.angleDelta()
     print(f'common angle = {angle}')
     if modifiers == QtCore.Qt.ControlModifier:
         print(f'mods = {modifiers}')
         angle = event.angleDelta()
         if angle.y() > 0:
             self.zoom_in()
         elif angle.y() < 0:
             self.zoom_out()
         event.accept()
Exemplo n.º 22
0
 def wheelEvent(self, event:QWheelEvent) -> None:
     """ Change the font size if Ctrl is held down, otherwise scroll the list as usual. """
     if not event.modifiers() & Qt.ControlModifier:
         return super().wheelEvent(event)
     delta = event.angleDelta().y()
     sign = (delta // abs(delta)) if delta else 0
     font = self.font()
     new_size = font.pointSize() + sign
     if self._min_font_size <= new_size <= self._max_font_size:
         font.setPointSize(new_size)
         self.setFont(font)
     event.accept()
Exemplo n.º 23
0
    def wheelEvent(self, event: QWheelEvent):
        def checkDate(newdate):
            """
                Check newdate doesn't go over bounds
            """
            date = self.dtFrom.date()
            firstdate = self.product.result.ohcl(
                self.cmbOHCLDuration.itemData(
                    self.cmbOHCLDuration.currentIndex())).first().datetime(
                    ).date()
            if newdate > date:
                if newdate > datetime.date.today():
                    return date
                else:
                    return newdate
            else:  #newdate<=date
                if newdate < firstdate:
                    return date
                else:
                    return newdate

        ##############################
        event.accept()  #If I dont use this makes two events
        if event.modifiers() == Qt.ControlModifier:
            step = 30
        elif event.modifiers() == Qt.ShiftModifier:
            step = 7
        else:
            step = 365

        if event.angleDelta().y() < 0:
            self.dtFrom.setDate(
                checkDate(self.dtFrom.date().toPyDate() -
                          datetime.timedelta(days=step)))
        else:
            self.dtFrom.setDate(
                checkDate(self.dtFrom.date().toPyDate() +
                          datetime.timedelta(days=step)))
Exemplo n.º 24
0
 def wheelEvent(self, event: QWheelEvent):
     if event.modifiers() == Qt.ControlModifier:
         font = QFont()
         if event.angleDelta().y() > 0:
             self.fontSize += 2
             print(self.fontSize)
             font.setPointSize(self.fontSize)
             self.setFont(font)
         else:
             if self.fontSize > 2:
                 self.fontSize -= 2
                 print(self.fontSize)
                 font.setPointSize(self.fontSize)
                 self.setFont(font)
         self.update()
Exemplo n.º 25
0
 def wheelEvent(self, event: QWheelEvent) -> None:
     if event.modifiers() & Qt.KeyboardModifier.ControlModifier:
         distance = 1 if event.angleDelta().y() > 0 else -1
         font = self._syntax_highlight.get_font()
         new_size = font.pointSize() + distance
         if new_size < 5:
             return
         font.setPointSize(new_size)
         self._syntax_highlight.set_font(font)
         self._api.cfg.opt["gui"]["fonts"]["console"] = font.toString()
     else:
         super().wheelEvent(event)
         maximum = self.verticalScrollBar().maximum()
         current = self.verticalScrollBar().value()
         delta = maximum - current
         self.scroll_lock = delta > 5
Exemplo n.º 26
0
    def wheelEvent(self, e: QtGui.QWheelEvent) -> None:
        pDelta = e.pixelDelta()
        aDelta = e.angleDelta() / 8
        alt = int(e.modifiers()) & Qt.AltModifier
        steps = QPoint(0, 0)

        if not pDelta.isNull():
            # TODO: test this
            steps = pDelta
        elif not aDelta.isNull():
            steps = aDelta / 15

        fac = steps.x() if alt else steps.y()
        if fac > 0:
            self.scale(1.25, 1.25)
        else:
            self.scale(.8, .8)
Exemplo n.º 27
0
 def wheelEvent(self, event: QtGui.QWheelEvent) -> None:
     if (event.modifiers() & QtCore.Qt.ControlModifier
             or settings.IMAGE_VIEW_SCROLL_DEFAULT_ZOOM.get_value()):
         transform = self.transform()
         x_scale, y_scale = transform.m11(), transform.m22()
         delta = event.angleDelta().y() / 2000
         x_scale, y_scale = [
             max(.1, min(4, scale + delta)) for scale in (x_scale, y_scale)
         ]
         old_position = self.mapToScene(event.pos())
         self.resetTransform()
         self.scale(x_scale, y_scale)
         new_position = self.mapToScene(event.pos())
         position_delta = new_position - old_position
         self.translate(position_delta.x(), position_delta.y())
     else:
         super().wheelEvent(event)
Exemplo n.º 28
0
    def wheelEvent(self, event: QWheelEvent):
        if not (self.ui.measure_table.underMouse()
                and self.settings.disable_scroll_on_table):
            steps = qt_utils.get_wheel_steps(event)
            steps = -steps if self.settings.mouse_inversion else steps

            keys = event.modifiers()
            if (keys & Qt.ControlModifier) and (keys & Qt.ShiftModifier):
                self.set_amplitude(self.calibrator.amplitude +
                                   (self.fixed_step * steps))
            elif keys & Qt.ShiftModifier:
                self.tune_amplitude(self.settings.exact_step * steps)
            elif keys & Qt.ControlModifier:
                self.tune_amplitude(self.settings.rough_step * steps)
            else:
                self.tune_amplitude(self.settings.common_step * steps)

        event.accept()
Exemplo n.º 29
0
    def eventFilter(self, object, event):
        if (event.type() == QEvent.Wheel and not self.__d_ignoreWheelEvent):

            we = QWheelEvent(event)

            pos = self.wheelRect().center()

            wheelEvent = QWheelEvent(pos, QWidget.mapToGlobal(self, pos),
                                     we.pixelDelta(), we.angleDelta(),
                                     we.buttons(), we.modifiers(), we.phase(),
                                     we.inverted(), we.source())

            self.__d_ignoreWheelEvent = True
            QApplication.sendEvent(self, wheelEvent)
            self.__d_ignoreWheelEvent = False

            return True

        return Qwt.QwtWheel.eventFilter(object, event)
Exemplo n.º 30
0
    def wheelEvent(self, event: QWheelEvent):
        """
        Zoom in/out on the mouse cursor
        """
        # zoom only when CTRL key pressed
        if (event.modifiers() & Qt.ControlModifier) == Qt.ControlModifier:
            steps = event.angleDelta().y() / 15 / 8

            if steps == 0:
                event.ignore()
                return

            # scale factor 1.25
            sc = pow(1.25, steps)
            self.scale(sc, sc)
            self.centerOn(self.mapToScene(event.pos()))
            event.accept()
        #  act normally on scrollbar
        else:
            # transmit event to parent class wheelevent
            super(QGraphicsView, self).wheelEvent(event)
Exemplo n.º 31
0
    def wheelEvent(self, event: QWheelEvent):
        """
        Zoom in/out on the mouse cursor
        """
        # zoom only when CTRL key pressed
        if (event.modifiers() & Qt.ControlModifier) == Qt.ControlModifier:
            steps = event.angleDelta().y() / 15 / 8

            if steps == 0:
                event.ignore()
                return

            # scale factor 1.25
            sc = pow(1.25, steps)
            self.scale(sc, sc)
            self.centerOn(self.mapToScene(event.pos()))
            event.accept()
        #  act normally on scrollbar
        else:
            # transmit event to parent class wheelevent
            super(QGraphicsView, self).wheelEvent(event)