23 : QGraphicsView(parent)
31 : QGraphicsView(scene, parent)
40 setCursor(Qt::ClosedHandCursor);
44 QGraphicsItem *item = this->itemAt(event->pos());
47 QPointF sceneCoord(mapToScene(event->pos()));
48 QPointF imageCoord(item->mapFromParent(sceneCoord));
50 int volume = (int)imageCoord.y();
51 int slice = (int)imageCoord.x();
60 setCursor(Qt::OpenHandCursor);
67 QPointF delta = mapToScene(
m_LastPanPoint) - mapToScene(event->pos());
77 QPointF before(mapToScene(event->pos()));
82 if(event->delta() > 0)
84 scale(factor, factor);
88 scale(1.0 / factor, 1.0 / factor);
92 QPointF after(mapToScene(event->pos()));
95 QPointF
offset = before - after;
98 QPointF newCenter = screenCenter +
offset;
114 QRectF visibleArea = mapToScene(rect()).boundingRect();
115 QRectF sceneBounds = sceneRect();
117 double boundX = visibleArea.width() / 2.0 ;
118 double boundY = visibleArea.height() / 2.0;
119 double boundWidth = sceneBounds.width() -2.0 * boundX;
120 double boundHeight = sceneBounds.height() - 2.0 * boundY;
123 QRectF bounds(boundX, boundY, boundWidth, boundHeight);
125 if(bounds.contains(center))
132 if(visibleArea.contains(sceneBounds))
142 if(center.x() > bounds.x() + bounds.width())
146 else if(center.x() < bounds.x()) {
150 if(center.y() > bounds.y() + bounds.height())
154 else if(center.y() < bounds.y())