m_view->centerOn(m_frameBorder);
}
-void MonitorScene::slotZoomOut()
+void MonitorScene::slotZoomOut(int by)
{
- slotZoom(qMax(0, (int)(m_zoom * 100 - 1)));
+ slotZoom(qMax(0, (int)(m_zoom * 100 - by)));
}
-void MonitorScene::slotZoomIn()
+void MonitorScene::slotZoomIn(int by)
{
- int newzoom = (100 * m_zoom + 0.5);
- newzoom++;
- slotZoom(qMin(300, newzoom));
+ slotZoom(qMin(300, (int)(m_zoom * 100 + by + 0.5)));
}
void MonitorScene::slotSetCursor(const QCursor &cursor)
emit addKeyframe();
}
+void MonitorScene::wheelEvent(QGraphicsSceneWheelEvent* event)
+{
+ if (event->modifiers() == Qt::ControlModifier) {
+ if (event->delta() > 0)
+ slotZoomIn(5);
+ else
+ slotZoomOut(5);
+
+ event->accept();
+ } else {
+ QGraphicsScene::wheelEvent(event);
+ }
+}
#include "monitorscene.moc"
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
/** @brief Adds a keyframe if scene is disabled. */
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
public slots:
/** @brief Sets the backgrounditem's pixmap to m_backgroundImage (only if a certain amount of time has passed since last update). */
void slotZoomFit();
/** @brief Shows the frame at it's original size and center. */
void slotZoomOriginal();
- /** @brief Zooms in by 1%. */
- void slotZoomIn();
- /** @brief Zooms out by 1%. */
- void slotZoomOut();
+ /** @brief Zooms in by @param by%. */
+ void slotZoomIn(int by = 1);
+ /** @brief Zooms out by @param by%. */
+ void slotZoomOut(int by = 1);
private slots:
/** @brief Sets m_backgroundImage to @param image and requests updating the background item. */