mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Added support for scrolling in source+destination canvases by mid-button clicking.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user