Display 'prefab selected' tooltip when selecting a prefab for painting

This commit is contained in:
Marcus Huderle 2022-09-27 18:22:08 -05:00
parent fa76e22508
commit ddf0fe4e11
2 changed files with 4 additions and 7 deletions

View file

@ -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);
}

View file

@ -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.