remove redundant mapsceneeventfilter file
This commit is contained in:
parent
2ea0590f6e
commit
ff086a6fe6
7 changed files with 33 additions and 51 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
|
||||
|
||||
/// Prevent wheel scroll
|
||||
class WheelFilter : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -10,3 +11,18 @@ public:
|
|||
virtual ~WheelFilter() {}
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// Ctrl+Wheel = zoom
|
||||
class MapSceneEventFilter : public QObject {
|
||||
Q_OBJECT
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
public:
|
||||
explicit MapSceneEventFilter(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
signals:
|
||||
void wheelZoom(int delta);
|
||||
public slots:
|
||||
};
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef MAPSCENEEVENTFILTER_H
|
||||
#define MAPSCENEEVENTFILTER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class MapSceneEventFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
public:
|
||||
explicit MapSceneEventFilter(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void wheelZoom(int delta);
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // MAPSCENEEVENTFILTER_H
|
|
@ -66,7 +66,6 @@ SOURCES += src/core/block.cpp \
|
|||
src/ui/prefabcreationdialog.cpp \
|
||||
src/ui/regionmappixmapitem.cpp \
|
||||
src/ui/citymappixmapitem.cpp \
|
||||
src/ui/mapsceneeventfilter.cpp \
|
||||
src/ui/metatilelayersitem.cpp \
|
||||
src/ui/metatileselector.cpp \
|
||||
src/ui/movablerect.cpp \
|
||||
|
@ -158,7 +157,6 @@ HEADERS += include/core/block.h \
|
|||
include/ui/prefabcreationdialog.h \
|
||||
include/ui/regionmappixmapitem.h \
|
||||
include/ui/citymappixmapitem.h \
|
||||
include/ui/mapsceneeventfilter.h \
|
||||
include/ui/metatilelayersitem.h \
|
||||
include/ui/metatileselector.h \
|
||||
include/ui/movablerect.h \
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "log.h"
|
||||
#include "mapconnection.h"
|
||||
#include "currentselectedmetatilespixmapitem.h"
|
||||
#include "mapsceneeventfilter.h"
|
||||
#include "eventfilters.h"
|
||||
#include "metatile.h"
|
||||
#include "montabwidget.h"
|
||||
#include "encountertablemodel.h"
|
||||
|
|
|
@ -1376,12 +1376,6 @@ void Project::updateLayout(Layout *layout) {
|
|||
mapLayoutsTableMaster.append(layout->id);
|
||||
}
|
||||
|
||||
// !TODO: why is[was] this a deep copy??
|
||||
// Deep copy
|
||||
// Layout *layout = mapLayouts.value(map->layoutId);
|
||||
// Layout *newLayout = new Layout();
|
||||
// *newLayout = *layout;
|
||||
// mapLayoutsMaster.insert(map->layoutId, newLayout);
|
||||
if (mapLayoutsMaster.contains(layout->id)) {
|
||||
mapLayoutsMaster[layout->id]->copyFrom(layout);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "eventfilters.h"
|
||||
|
||||
#include <QGraphicsSceneWheelEvent>
|
||||
|
||||
|
||||
|
||||
bool WheelFilter::eventFilter(QObject *, QEvent *event) {
|
||||
|
@ -8,3 +10,17 @@ bool WheelFilter::eventFilter(QObject *, QEvent *event) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool MapSceneEventFilter::eventFilter(QObject*, QEvent *event) {
|
||||
if (event->type() == QEvent::GraphicsSceneWheel) {
|
||||
QGraphicsSceneWheelEvent *wheelEvent = static_cast<QGraphicsSceneWheelEvent *>(event);
|
||||
if (wheelEvent->modifiers() & Qt::ControlModifier) {
|
||||
emit wheelZoom(wheelEvent->delta() > 0 ? 1 : -1);
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#include "mapsceneeventfilter.h"
|
||||
#include <QEvent>
|
||||
#include <QGraphicsSceneWheelEvent>
|
||||
|
||||
MapSceneEventFilter::MapSceneEventFilter(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MapSceneEventFilter::eventFilter(QObject*, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::GraphicsSceneWheel)
|
||||
{
|
||||
QGraphicsSceneWheelEvent *wheelEvent = static_cast<QGraphicsSceneWheelEvent *>(event);
|
||||
if (wheelEvent->modifiers() & Qt::ControlModifier)
|
||||
{
|
||||
emit wheelZoom(wheelEvent->delta() > 0 ? 1 : -1);
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
Loading…
Reference in a new issue