1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00
vcmi/mapeditor/mapview.h
Tomasz Zieliński d3da75eece - Erase operation (hotkey: DELETE)
- Interface is updated when there is an object selected or not
- Undo for erase object
2022-09-06 08:05:34 +02:00

78 lines
1.4 KiB
C++

#ifndef MAPVIEW_H
#define MAPVIEW_H
#include <QGraphicsScene>
#include <QGraphicsView>
#include "scenelayer.h"
#include "../lib/int3.h"
class CGObjectInstance;
class MainWindow;
class MapController;
class MapScene : public QGraphicsScene
{
Q_OBJECT;
public:
MapScene(int lev);
void updateViews();
void initialize(MapController &);
GridLayer gridView;
PassabilityLayer passabilityView;
SelectionTerrainLayer selectionTerrainView;
TerrainLayer terrainView;
ObjectsLayer objectsView;
SelectionObjectsLayer selectionObjectsView;
const int level;
signals:
void selected(bool anything);
public slots:
void terrainSelected(bool anything);
void objectSelected(bool anything);
private:
std::list<AbstractLayer *> getAbstractLayers();
bool isTerrainSelected;
bool isObjectSelected;
};
class MapView : public QGraphicsView
{
Q_OBJECT
public:
enum class SelectionTool
{
None, Brush, Brush2, Brush4, Area, Lasso
};
public:
MapView(QWidget * parent);
void setController(MapController *);
SelectionTool selectionTool;
public slots:
void mouseMoveEvent(QMouseEvent * mouseEvent) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
signals:
void openObjectProperties(CGObjectInstance *);
private:
MapController * controller = nullptr;
QPointF mouseStart;
int3 tileStart;
int3 tilePrev;
bool pressedOnSelected;
};
#endif // MAPVIEW_H