7 #include <QGraphicsScene>
9 #include "ViewPreview.h"
14 QGraphicsView (scene, parent),
15 m_viewAspectRatio (viewAspectRatio)
17 setMouseTracking(
true);
22 QPointF pos = mapToScene (event->pos ());
29 if (m_viewAspectRatio == VIEW_ASPECT_RATIO_ONE_TO_ONE) {
31 fitInView (scene()->sceneRect(),
37 fitInView (scene()->itemsBoundingRect ());
39 QGraphicsView::resizeEvent (event);
void signalMouseMove(QPointF pos)
Forward the mouse move events.
ViewAspectRatio
Prevent aspect ratio distortion in certain previews by providing fixed 1:1 aspect ratio option...
virtual void mouseMoveEvent(QMouseEvent *event)
Intercept cursor move events and forward them.
virtual void resizeEvent(QResizeEvent *event)
Intercept resize events so we can rescale to the graphics items just fit into the resized window...
ViewPreview(QGraphicsScene *scene, ViewAspectRatio viewAspectRatio, QWidget *parent=0)
Single constructor.