From 44f59b60222af70d913fc531ac5cd8164b36552c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 7 Aug 2014 16:53:17 -0300 Subject: [PATCH] Move the Trash bin to the topRight on the pictures It was too easy to remove a picture by mistake, not anymore. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/divepixmapitem.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qt-ui/profile/divepixmapitem.cpp b/qt-ui/profile/divepixmapitem.cpp index a73473a1f..ce5d3c404 100644 --- a/qt-ui/profile/divepixmapitem.cpp +++ b/qt-ui/profile/divepixmapitem.cpp @@ -93,7 +93,9 @@ void DivePictureItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) button->setZValue(7); scene()->addItem(button); } - button->setPos(mapToScene(0,0)); + button->setParentItem(this); + button->setPos(boundingRect().width() - button->boundingRect().width() * 0.2, + boundingRect().height() - button->boundingRect().height() * 0.2); button->setOpacity(0); button->show(); Animations::show(button); @@ -110,13 +112,17 @@ void DivePictureItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Animations::scaleTo(this, 0.2); setZValue(0); - if(button) - button->hide(); + if(button){ + button->setParentItem(NULL); + Animations::hide(button); + } } DivePictureItem::~DivePictureItem(){ - if(button) + if(button){ + button->setParentItem(NULL); Animations::hide(button); + } } void DivePictureItem::mousePressEvent(QGraphicsSceneMouseEvent *event)