1 #include <QGraphicsScene>
3 #include "ViewPreview.h"
8 QGraphicsView (scene, parent),
9 m_viewAspectRatio (viewAspectRatio)
11 setMouseTracking(
true);
16 QPointF pos = mapToScene (event->pos ());
23 if (m_viewAspectRatio == VIEW_ASPECT_RATIO_ONE_TO_ONE) {
25 fitInView (scene()->sceneRect(),
31 fitInView (scene()->itemsBoundingRect ());
33 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.