void ZoomTool::wheelEvent(QWheelEvent *event) { if (event->orientation() != Qt::Vertical) return; Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier; if (event->modifiers() & smoothZoomModifier) { int numDegrees = event->delta() / 8; m_currentScale += m_smoothZoomMultiplier * (numDegrees / 15.0f); scaleView(view()->mapToScene(m_mousePos)); } else if (!event->modifiers()) { if (event->delta() > 0) { m_currentScale = nextZoomScale(ZoomIn); } else if (event->delta() < 0) { m_currentScale = nextZoomScale(ZoomOut); } scaleView(view()->mapToScene(m_mousePos)); } }
void ZoomTool::zoomOut() { m_currentScale = nextZoomScale(ZoomOut); scaleView(view()->mapToScene(m_mousePos)); }
void InspectTool::zoomOut() { qreal newScale = nextZoomScale(ZoomOut); scaleView(newScale / m_contentItem->scale(), m_mousePosition, m_mousePosition); }