Move map cursor UI and grid to foreground
This commit is contained in:
parent
39cd1d335b
commit
36dc1c6649
13 changed files with 118 additions and 75 deletions
|
@ -344,7 +344,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="GraphicsView" name="graphicsView_Map">
|
||||
<widget class="MapView" name="graphicsView_Map">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
|
|
@ -102,6 +102,8 @@ public:
|
|||
void duplicateSelectedEvents();
|
||||
void redrawObject(DraggablePixmapItem *item);
|
||||
QList<DraggablePixmapItem *> getObjects();
|
||||
void updateCursorRectPos(int x, int y);
|
||||
void setCursorRectVisible(bool visible);
|
||||
|
||||
QGraphicsScene *scene = nullptr;
|
||||
QGraphicsPixmapItem *current_view = nullptr;
|
||||
|
|
|
@ -41,10 +41,10 @@ public:
|
|||
}
|
||||
|
||||
painter->setPen(this->color);
|
||||
painter->drawRect(-1, -1, width + 2, height + 2);
|
||||
painter->drawRect(x() - 1, y() - 1, width + 2, height + 2);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
painter->drawRect(-2, -2, width + 4, height + 4);
|
||||
painter->drawRect(0, 0, width, height);
|
||||
painter->drawRect(x() - 2, y() - 2, width + 4, height + 4);
|
||||
painter->drawRect(x(), y(), width, height);
|
||||
}
|
||||
void initAnchor(int coordX, int coordY);
|
||||
void stopAnchor();
|
||||
|
@ -58,10 +58,10 @@ public:
|
|||
void stopSingleTileMode();
|
||||
void updateLocation(int x, int y);
|
||||
void updateSelectionSize(int width, int height);
|
||||
void setVisibility(bool visible);
|
||||
void setActive(bool active);
|
||||
bool *enabled;
|
||||
private:
|
||||
bool visible;
|
||||
bool active;
|
||||
int width;
|
||||
int height;
|
||||
bool anchored;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef GRAPHICSVIEW_H
|
||||
#define GRAPHICSVIEW_H
|
||||
|
||||
#include "overlay.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
|
||||
|
@ -12,23 +11,14 @@ class GraphicsView : public QGraphicsView
|
|||
public:
|
||||
GraphicsView() : QGraphicsView() {}
|
||||
GraphicsView(QWidget *parent) : QGraphicsView(parent) {}
|
||||
Overlay * getOverlay(int layer);
|
||||
void clearOverlays();
|
||||
void setOverlaysHidden(bool hidden);
|
||||
void setOverlaysX(int x);
|
||||
void setOverlaysY(int y);
|
||||
void setOverlaysPosition(int x, int y);
|
||||
void moveOverlays(int deltaX, int deltaY);
|
||||
|
||||
public:
|
||||
// GraphicsView_Object object;
|
||||
Editor *editor;
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void drawForeground(QPainter *painter, const QRectF &rect);
|
||||
void moveEvent(QMoveEvent *event);
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
bool prevStraightPathState;
|
||||
int straight_path_initial_x;
|
||||
int straight_path_initial_y;
|
||||
QPoint metatilePos;
|
||||
enum Axis {
|
||||
None = 0,
|
||||
X,
|
||||
|
|
26
include/ui/mapview.h
Normal file
26
include/ui/mapview.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef MAPVIEW_H
|
||||
#define MAPVIEW_H
|
||||
|
||||
#include "graphicsview.h"
|
||||
#include "overlay.h"
|
||||
|
||||
class MapView : public GraphicsView
|
||||
{
|
||||
public:
|
||||
MapView() : GraphicsView() {}
|
||||
MapView(QWidget *parent) : GraphicsView(parent) {}
|
||||
Overlay * getOverlay(int layer);
|
||||
void clearOverlays();
|
||||
void setOverlaysHidden(bool hidden);
|
||||
void setOverlaysX(int x);
|
||||
void setOverlaysY(int y);
|
||||
void setOverlaysPosition(int x, int y);
|
||||
void moveOverlays(int deltaX, int deltaY);
|
||||
|
||||
public:
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
protected:
|
||||
void drawForeground(QPainter *painter, const QRectF &rect);
|
||||
};
|
||||
|
||||
#endif // GRAPHICSVIEW_H
|
|
@ -20,11 +20,12 @@ public:
|
|||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
|
||||
{
|
||||
if (!(*enabled)) return;
|
||||
painter->setPen(this->color);
|
||||
painter->drawRect(-2, -2, this->width + 3, this->height + 3);
|
||||
painter->drawRect(x() - 2, y() - 2, this->width + 3, this->height + 3);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
painter->drawRect(-3, -3, this->width + 5, this->height + 5);
|
||||
painter->drawRect(-1, -1, this->width + 1, this->height + 1);
|
||||
painter->drawRect(x() - 3, y() - 3, this->width + 5, this->height + 5);
|
||||
painter->drawRect(x() - 1, y() - 1, this->width + 1, this->height + 1);
|
||||
}
|
||||
void updateLocation(int x, int y);
|
||||
bool *enabled;
|
||||
|
|
|
@ -96,7 +96,7 @@ void Editor::setEditingMap() {
|
|||
setBorderItemsVisible(ui->checkBox_ToggleBorder->isChecked());
|
||||
setConnectionItemsVisible(false);
|
||||
this->cursorMapTileRect->stopSingleTileMode();
|
||||
this->cursorMapTileRect->setVisibility(true);
|
||||
this->cursorMapTileRect->setActive(true);
|
||||
|
||||
setMapEditingButtonsEnabled(true);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void Editor::setEditingCollision() {
|
|||
setBorderItemsVisible(ui->checkBox_ToggleBorder->isChecked());
|
||||
setConnectionItemsVisible(false);
|
||||
this->cursorMapTileRect->setSingleTileMode();
|
||||
this->cursorMapTileRect->setVisibility(true);
|
||||
this->cursorMapTileRect->setActive(true);
|
||||
|
||||
setMapEditingButtonsEnabled(true);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void Editor::setEditingObjects() {
|
|||
setBorderItemsVisible(ui->checkBox_ToggleBorder->isChecked());
|
||||
setConnectionItemsVisible(false);
|
||||
this->cursorMapTileRect->setSingleTileMode();
|
||||
this->cursorMapTileRect->setVisibility(false);
|
||||
this->cursorMapTileRect->setActive(false);
|
||||
|
||||
setMapEditingButtonsEnabled(false);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ void Editor::setEditingConnections() {
|
|||
setBorderItemsVisible(true, 0.4);
|
||||
setConnectionItemsVisible(true);
|
||||
this->cursorMapTileRect->setSingleTileMode();
|
||||
this->cursorMapTileRect->setVisibility(false);
|
||||
this->cursorMapTileRect->setActive(false);
|
||||
}
|
||||
|
||||
void Editor::displayWildMonTables() {
|
||||
|
@ -985,9 +985,26 @@ void Editor::scaleMapView(int s) {
|
|||
ui->graphicsView_Connections->setTransform(transform);
|
||||
}
|
||||
|
||||
void Editor::updateCursorRectPos(int x, int y) {
|
||||
if (this->playerViewRect)
|
||||
this->playerViewRect->updateLocation(x, y);
|
||||
if (this->cursorMapTileRect)
|
||||
this->cursorMapTileRect->updateLocation(x, y);
|
||||
if (ui->graphicsView_Map->scene())
|
||||
ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
|
||||
void Editor::setCursorRectVisible(bool visible) {
|
||||
if (this->playerViewRect)
|
||||
this->playerViewRect->setVisible(visible);
|
||||
if (this->cursorMapTileRect)
|
||||
this->cursorMapTileRect->setVisible(visible);
|
||||
if (ui->graphicsView_Map->scene())
|
||||
ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
|
||||
void Editor::onHoveredMapMetatileChanged(const QPoint &pos) {
|
||||
this->playerViewRect->updateLocation(pos.x(), pos.y());
|
||||
this->cursorMapTileRect->updateLocation(pos.x(), pos.y());
|
||||
this->updateCursorRectPos(pos.x(), pos.y());
|
||||
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
|
||||
&& pos.x() >= 0 && pos.x() < map->getWidth() && pos.y() >= 0 && pos.y() < map->getHeight()) {
|
||||
int blockIndex = pos.y() * map->getWidth() + pos.x();
|
||||
|
@ -1007,8 +1024,7 @@ void Editor::onHoveredMapMetatileChanged(const QPoint &pos) {
|
|||
}
|
||||
|
||||
void Editor::onHoveredMapMetatileCleared() {
|
||||
this->playerViewRect->setVisible(false);
|
||||
this->cursorMapTileRect->setVisible(false);
|
||||
this->setCursorRectVisible(false);
|
||||
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
|
||||
|| map_item->paintingMode == MapPixmapItem::PaintMode::EventObjects) {
|
||||
this->ui->statusBar->clearMessage();
|
||||
|
@ -1016,8 +1032,7 @@ void Editor::onHoveredMapMetatileCleared() {
|
|||
}
|
||||
|
||||
void Editor::onHoveredMapMovementPermissionChanged(int x, int y) {
|
||||
this->playerViewRect->updateLocation(x, y);
|
||||
this->cursorMapTileRect->updateLocation(x, y);
|
||||
this->updateCursorRectPos(x, y);
|
||||
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
|
||||
&& x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) {
|
||||
int blockIndex = y * map->getWidth() + x;
|
||||
|
@ -1032,8 +1047,7 @@ void Editor::onHoveredMapMovementPermissionChanged(int x, int y) {
|
|||
}
|
||||
|
||||
void Editor::onHoveredMapMovementPermissionCleared() {
|
||||
this->playerViewRect->setVisible(false);
|
||||
this->cursorMapTileRect->setVisible(false);
|
||||
this->setCursorRectVisible(false);
|
||||
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
|
||||
this->ui->statusBar->clearMessage();
|
||||
}
|
||||
|
@ -1243,8 +1257,6 @@ void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item
|
|||
}
|
||||
}
|
||||
}
|
||||
this->playerViewRect->updateLocation(pos.x(), pos.y());
|
||||
this->cursorMapTileRect->updateLocation(pos.x(), pos.y());
|
||||
}
|
||||
|
||||
void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item) {
|
||||
|
@ -1291,8 +1303,6 @@ void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixm
|
|||
}
|
||||
item->shift(event);
|
||||
}
|
||||
this->playerViewRect->updateLocation(pos.x(), pos.y());
|
||||
this->cursorMapTileRect->updateLocation(pos.x(), pos.y());
|
||||
}
|
||||
|
||||
bool Editor::displayMap() {
|
||||
|
@ -1307,8 +1317,6 @@ bool Editor::displayMap() {
|
|||
if (map_item && scene) {
|
||||
scene->removeItem(map_item);
|
||||
delete map_item;
|
||||
scene->removeItem(this->playerViewRect);
|
||||
scene->removeItem(this->cursorMapTileRect);
|
||||
scene->removeItem(this->map_ruler);
|
||||
}
|
||||
|
||||
|
@ -1324,11 +1332,7 @@ bool Editor::displayMap() {
|
|||
displayMapGrid();
|
||||
displayWildMonTables();
|
||||
|
||||
this->playerViewRect->setZValue(1000);
|
||||
this->cursorMapTileRect->setZValue(1001);
|
||||
this->map_ruler->setZValue(1002);
|
||||
scene->addItem(this->playerViewRect);
|
||||
scene->addItem(this->cursorMapTileRect);
|
||||
this->map_ruler->setZValue(1000);
|
||||
scene->addItem(this->map_ruler);
|
||||
|
||||
if (map_item) {
|
||||
|
@ -1670,14 +1674,13 @@ int Editor::getBorderDrawDistance(int dimension) {
|
|||
|
||||
void Editor::onToggleGridClicked(bool checked) {
|
||||
porymapConfig.setShowGrid(checked);
|
||||
if (ui->graphicsView_Map->scene())
|
||||
ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
|
||||
void Editor::displayMapGrid() {
|
||||
for (QGraphicsLineItem* item : gridLines) {
|
||||
if (item && item->scene()) {
|
||||
item->scene()->removeItem(item);
|
||||
}
|
||||
delete item;
|
||||
if (item) delete item;
|
||||
}
|
||||
gridLines.clear();
|
||||
ui->checkBox_ToggleGrid->disconnect();
|
||||
|
@ -1686,14 +1689,14 @@ void Editor::displayMapGrid() {
|
|||
int pixelHeight = map->getHeight() * 16;
|
||||
for (int i = 0; i <= map->getWidth(); i++) {
|
||||
int x = i * 16;
|
||||
QGraphicsLineItem *line = scene->addLine(x, 0, x, pixelHeight);
|
||||
QGraphicsLineItem *line = new QGraphicsLineItem(x, 0, x, pixelHeight);
|
||||
line->setVisible(ui->checkBox_ToggleGrid->isChecked());
|
||||
gridLines.append(line);
|
||||
connect(ui->checkBox_ToggleGrid, &QCheckBox::toggled, [=](bool checked){line->setVisible(checked);});
|
||||
}
|
||||
for (int j = 0; j <= map->getHeight(); j++) {
|
||||
int y = j * 16;
|
||||
QGraphicsLineItem *line = scene->addLine(0, y, pixelWidth, y);
|
||||
QGraphicsLineItem *line = new QGraphicsLineItem(0, y, pixelWidth, y);
|
||||
line->setVisible(ui->checkBox_ToggleGrid->isChecked());
|
||||
gridLines.append(line);
|
||||
connect(ui->checkBox_ToggleGrid, &QCheckBox::toggled, [=](bool checked){line->setVisible(checked);});
|
||||
|
|
|
@ -1674,8 +1674,7 @@ void MainWindow::setMapViewTabInternal(int index)
|
|||
} else if (index == 1) {
|
||||
editor->setEditingCollision();
|
||||
}
|
||||
editor->playerViewRect->setVisible(false);
|
||||
editor->cursorMapTileRect->setVisible(false);
|
||||
editor->setCursorRectVisible(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Exit_triggered()
|
||||
|
@ -1738,6 +1737,7 @@ void MainWindow::on_actionPlayer_View_Rectangle_triggered()
|
|||
this->editor->settings->playerViewRectEnabled = enabled;
|
||||
if (this->editor->map_item->has_mouse) {
|
||||
this->editor->playerViewRect->setVisible(enabled);
|
||||
ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1747,7 +1747,8 @@ void MainWindow::on_actionCursor_Tile_Outline_triggered()
|
|||
porymapConfig.setShowCursorTile(enabled);
|
||||
this->editor->settings->cursorTileRectEnabled = enabled;
|
||||
if (this->editor->map_item->has_mouse) {
|
||||
this->editor->cursorMapTileRect->setVisibility(enabled);
|
||||
this->editor->cursorMapTileRect->setVisible(enabled);
|
||||
ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
CursorTileRect::CursorTileRect(bool *enabled, QRgb color)
|
||||
{
|
||||
this->enabled = enabled;
|
||||
this->visible = true;
|
||||
this->active = true;
|
||||
this->color = color;
|
||||
this->width = 16;
|
||||
this->height = 16;
|
||||
|
@ -19,9 +19,9 @@ CursorTileRect::CursorTileRect(bool *enabled, QRgb color)
|
|||
this->selectionHeight = 1;
|
||||
}
|
||||
|
||||
void CursorTileRect::setVisibility(bool visible)
|
||||
void CursorTileRect::setActive(bool active)
|
||||
{
|
||||
this->visible = visible;
|
||||
this->active = active;
|
||||
}
|
||||
|
||||
void CursorTileRect::initAnchor(int coordX, int coordY)
|
||||
|
@ -105,5 +105,5 @@ void CursorTileRect::updateLocation(int coordX, int coordY)
|
|||
coordY = qMax(coordY, 0);
|
||||
this->setX(coordX * 16);
|
||||
this->setY(coordY * 16);
|
||||
this->setVisible(*this->enabled && this->visible);
|
||||
this->setVisible(*this->enabled && this->active);
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ void DraggablePixmapItem::moveTo(const QPoint &pos) {
|
|||
void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) {
|
||||
if (active) {
|
||||
QPoint pos = Metatile::coordFromPixmapCoord(mouse->scenePos());
|
||||
emit this->editor->map_item->hoveredMapMetatileChanged(pos);
|
||||
if (pos.x() != last_x || pos.y() != last_y) {
|
||||
emit this->editor->map_item->hoveredMapMetatileChanged(pos);
|
||||
QList <Event *> selectedEvents;
|
||||
if (editor->selected_events->contains(this)) {
|
||||
for (DraggablePixmapItem *item : *editor->selected_events) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "graphicsview.h"
|
||||
#include "mapview.h"
|
||||
#include "editor.h"
|
||||
|
||||
void GraphicsView::mousePressEvent(QMouseEvent *event) {
|
||||
|
@ -16,12 +17,31 @@ void GraphicsView::mouseReleaseEvent(QMouseEvent *event) {
|
|||
QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void GraphicsView::drawForeground(QPainter *painter, const QRectF&) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->renderItems(painter);
|
||||
void GraphicsView::moveEvent(QMoveEvent *event) {
|
||||
QGraphicsView::moveEvent(event);
|
||||
QLabel *label_MapRulerStatus = findChild<QLabel *>("label_MapRulerStatus", Qt::FindDirectChildrenOnly);
|
||||
if (label_MapRulerStatus && label_MapRulerStatus->isVisible())
|
||||
label_MapRulerStatus->move(mapToGlobal(QPoint(6, 6)));
|
||||
}
|
||||
|
||||
void GraphicsView::clearOverlays() {
|
||||
void MapView::drawForeground(QPainter *painter, const QRectF&) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->renderItems(painter);
|
||||
|
||||
if (!editor) return;
|
||||
|
||||
QStyleOptionGraphicsItem option;
|
||||
for (QGraphicsLineItem* line : editor->gridLines) {
|
||||
if (line && line->isVisible())
|
||||
line->paint(painter, &option, this);
|
||||
}
|
||||
if (editor->playerViewRect && editor->playerViewRect->isVisible())
|
||||
editor->playerViewRect->paint(painter, &option, this);
|
||||
if (editor->cursorMapTileRect && editor->cursorMapTileRect->isVisible())
|
||||
editor->cursorMapTileRect->paint(painter, &option, this);
|
||||
}
|
||||
|
||||
void MapView::clearOverlays() {
|
||||
foreach (Overlay * overlay, this->overlayMap) {
|
||||
overlay->clearItems();
|
||||
delete overlay;
|
||||
|
@ -29,32 +49,32 @@ void GraphicsView::clearOverlays() {
|
|||
this->overlayMap.clear();
|
||||
}
|
||||
|
||||
void GraphicsView::setOverlaysHidden(bool hidden) {
|
||||
void MapView::setOverlaysHidden(bool hidden) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->setHidden(hidden);
|
||||
}
|
||||
|
||||
void GraphicsView::setOverlaysX(int x) {
|
||||
void MapView::setOverlaysX(int x) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->setX(x);
|
||||
}
|
||||
|
||||
void GraphicsView::setOverlaysY(int y) {
|
||||
void MapView::setOverlaysY(int y) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->setY(y);
|
||||
}
|
||||
|
||||
void GraphicsView::setOverlaysPosition(int x, int y) {
|
||||
void MapView::setOverlaysPosition(int x, int y) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->setPosition(x, y);
|
||||
}
|
||||
|
||||
void GraphicsView::moveOverlays(int deltaX, int deltaY) {
|
||||
void MapView::moveOverlays(int deltaX, int deltaY) {
|
||||
foreach (Overlay * overlay, this->overlayMap)
|
||||
overlay->move(deltaX, deltaY);
|
||||
}
|
||||
|
||||
Overlay * GraphicsView::getOverlay(int layer) {
|
||||
Overlay * MapView::getOverlay(int layer) {
|
||||
Overlay * overlay = this->overlayMap.value(layer, nullptr);
|
||||
if (!overlay) {
|
||||
overlay = new Overlay();
|
||||
|
@ -62,10 +82,3 @@ Overlay * GraphicsView::getOverlay(int layer) {
|
|||
}
|
||||
return overlay;
|
||||
}
|
||||
|
||||
void GraphicsView::moveEvent(QMoveEvent *event) {
|
||||
QGraphicsView::moveEvent(event);
|
||||
QLabel *label_MapRulerStatus = findChild<QLabel *>("label_MapRulerStatus", Qt::FindDirectChildrenOnly);
|
||||
if (label_MapRulerStatus && label_MapRulerStatus->isVisible())
|
||||
label_MapRulerStatus->move(mapToGlobal(QPoint(6, 6)));
|
||||
}
|
||||
|
|
|
@ -675,7 +675,10 @@ void MapPixmapItem::draw(bool ignoreCache) {
|
|||
|
||||
void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
|
||||
QPoint pos = Metatile::coordFromPixmapCoord(event->pos());
|
||||
emit this->hoveredMapMetatileChanged(pos);
|
||||
if (pos != this->metatilePos) {
|
||||
this->metatilePos = pos;
|
||||
emit this->hoveredMapMetatileChanged(pos);
|
||||
}
|
||||
if (this->settings->betterCursors && this->paintingMode != MapPixmapItem::PaintMode::Disabled) {
|
||||
setCursor(this->settings->mapCursor);
|
||||
}
|
||||
|
@ -699,7 +702,10 @@ void MapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
|||
}
|
||||
void MapPixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
||||
QPoint pos = Metatile::coordFromPixmapCoord(event->pos());
|
||||
emit this->hoveredMapMetatileChanged(pos);
|
||||
if (pos != this->metatilePos) {
|
||||
this->metatilePos = pos;
|
||||
emit this->hoveredMapMetatileChanged(pos);
|
||||
}
|
||||
emit mouseEvent(event, this);
|
||||
}
|
||||
void MapPixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||
|
|
Loading…
Reference in a new issue