Added support for scrolling in source+destination canvases by mid-button clicking.

This commit is contained in:
Tats
2015-07-13 16:45:03 -06:00
parent 8f13597451
commit 3303e07056
2 changed files with 19 additions and 0 deletions
+18
View File
@@ -391,6 +391,24 @@ void MapperGLCanvas::wheelEvent(QWheelEvent *event)
event->accept();
}
void MapperGLCanvas::mouseMoveEvent(QMouseEvent *event)
{
static QPoint lastPos;
// Click-and-drag translate view.
if (event->buttons() & Qt::MiddleButton)
{
QPoint pos = event->pos();
QPointF diff = mapToScene(pos) - mapToScene(lastPos);
QGraphicsView* view = scene()->views().first();
view->translate(diff.x(), diff.y());
view->update();
lastPos = pos;
}
QGraphicsView::mouseMoveEvent(event);
}
bool MapperGLCanvas::eventFilter(QObject *target, QEvent *event)
{
if (event->type() == QEvent::KeyPress)