public void mouseMoveEvent(QMouseEvent event) {
if (rightPressed) {
if (lastPan != null && !lastPan.isNull()) {
// Get how much we panned
QPointF s1 = mapToScene(new QPoint((int) lastPan.x(),
(int) lastPan.y()));
QPointF s2 = mapToScene(new QPoint((int) event.pos().x(),
(int) event.pos().y()));
QPointF delta = new QPointF(s1.x() - s2.x(), s1.y() - s2.y());
lastPan = event.pos();
// Scroll the scrollbars ie. do the pan
double zoom = this.matrix().m11();