From ddf0fe4e11be7fad8ba311658d99ab7aa37590b9 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 27 Sep 2022 18:22:08 -0500 Subject: [PATCH] Display 'prefab selected' tooltip when selecting a prefab for painting --- include/ui/graphicsview.h | 8 ++------ src/ui/prefab.cpp | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/ui/graphicsview.h b/include/ui/graphicsview.h index e9b87326..cee19293 100644 --- a/include/ui/graphicsview.h +++ b/include/ui/graphicsview.h @@ -12,12 +12,8 @@ public: ClickableGraphicsView(QWidget *parent) : QGraphicsView(parent) {} public: - void mousePressEvent(QMouseEvent *event) { - QGraphicsView::mousePressEvent(event); - emit this->clicked(event); - } - void mouseDoubleClickEvent(QMouseEvent *event) { - QGraphicsView::mouseDoubleClickEvent(event); + void mouseReleaseEvent(QMouseEvent *event) override { + QGraphicsView::mouseReleaseEvent(event); emit this->clicked(event); } diff --git a/src/ui/prefab.cpp b/src/ui/prefab.cpp index 3a78f2f5..054e6daa 100644 --- a/src/ui/prefab.cpp +++ b/src/ui/prefab.cpp @@ -208,8 +208,9 @@ void Prefab::updatePrefabUi(Map *map) { parentFrame->layout()->addWidget(frame); // Clicking on the prefab graphics item selects it for painting. - QObject::connect(frame->ui->graphicsView_Prefab, &ClickableGraphicsView::clicked, [this, item](){ + QObject::connect(frame->ui->graphicsView_Prefab, &ClickableGraphicsView::clicked, [this, item](QMouseEvent *event){ selector->setPrefabSelection(item.selection); + QToolTip::showText(event->globalPosition().toPoint(), "Selected prefab!", nullptr, {}, 1000); }); // Clicking the delete button removes it from the list of known prefabs and updates the UI.