mirror of
https://github.com/huderlem/porymap.git
synced 2026-06-22 23:59:46 -05:00
24 lines
609 B
C++
24 lines
609 B
C++
#include "mapsceneeventfilter.h"
|
|
#include <QEvent>
|
|
#include <QGraphicsSceneWheelEvent>
|
|
|
|
MapSceneEventFilter::MapSceneEventFilter(QObject *parent) : QObject(parent)
|
|
{
|
|
|
|
}
|
|
|
|
bool MapSceneEventFilter::eventFilter(QObject *obj, QEvent *event)
|
|
{
|
|
if (event->type() == QEvent::GraphicsSceneWheel)
|
|
{
|
|
QGraphicsSceneWheelEvent *wheelEvent = static_cast<QGraphicsSceneWheelEvent *>(event);
|
|
if (wheelEvent->modifiers() & Qt::ControlModifier)
|
|
{
|
|
emit zoom(wheelEvent->delta() > 0 ? 1 : -1);
|
|
event->accept();
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|