summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile-widget/divepixmapitem.cpp26
-rw-r--r--profile-widget/divepixmapitem.h16
2 files changed, 13 insertions, 29 deletions
diff --git a/profile-widget/divepixmapitem.cpp b/profile-widget/divepixmapitem.cpp
index 08525fe34..0d1051dad 100644
--- a/profile-widget/divepixmapitem.cpp
+++ b/profile-widget/divepixmapitem.cpp
@@ -16,31 +16,26 @@ DivePixmapItem::DivePixmapItem(QGraphicsItem *parent) : QGraphicsPixmapItem(pare
{
}
-DiveButtonItem::DiveButtonItem(QGraphicsItem *parent): DivePixmapItem(parent)
-{
-}
-
-void DiveButtonItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- QGraphicsItem::mousePressEvent(event);
- emit clicked();
-}
-
-CloseButtonItem::CloseButtonItem(QGraphicsItem *parent): DiveButtonItem(parent)
+CloseButtonItem::CloseButtonItem(QGraphicsItem *parent): DivePixmapItem(parent)
{
static QPixmap p = QPixmap(":list-remove-icon");
setPixmap(p);
setFlag(ItemIgnoresTransformations);
}
+void CloseButtonItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ qgraphicsitem_cast<DivePictureItem*>(parentItem())->removePicture();
+}
+
void CloseButtonItem::hide()
{
- DiveButtonItem::hide();
+ DivePixmapItem::hide();
}
void CloseButtonItem::show()
{
- DiveButtonItem::show();
+ DivePixmapItem::show();
}
DivePictureItem::DivePictureItem(QGraphicsItem *parent): DivePixmapItem(parent),
@@ -96,7 +91,6 @@ void DivePictureItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
button->setOpacity(0);
button->show();
Animations::show(button);
- connect(button, SIGNAL(clicked()), this, SLOT(removePicture()));
}
void DivePictureItem::setFileUrl(const QString &s)
@@ -119,9 +113,9 @@ void DivePictureItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
-#ifndef SUBSURFACE_MOBILE
void DivePictureItem::removePicture()
{
+#ifndef SUBSURFACE_MOBILE
DivePictureModel::instance()->removePicture(fileUrl, true);
-}
#endif
+}
diff --git a/profile-widget/divepixmapitem.h b/profile-widget/divepixmapitem.h
index 16dbdf8fa..6abe410a6 100644
--- a/profile-widget/divepixmapitem.h
+++ b/profile-widget/divepixmapitem.h
@@ -15,20 +15,12 @@ public:
DivePixmapItem(QGraphicsItem *parent = 0);
};
-class DiveButtonItem : public DivePixmapItem {
+class CloseButtonItem : public DivePixmapItem {
Q_OBJECT
public:
- DiveButtonItem(QGraphicsItem *parent = 0);
+ CloseButtonItem(QGraphicsItem *parent = 0);
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
-signals:
- void clicked();
-};
-
-class CloseButtonItem : public DiveButtonItem {
- Q_OBJECT
-public:
- CloseButtonItem(QGraphicsItem *parent = 0);
public slots:
void hide();
void show();
@@ -42,9 +34,7 @@ public:
void setPixmap(const QPixmap& pix);
public slots:
void settingsChanged();
-#ifndef SUBSURFACE_MOBILE
void removePicture();
-#endif
void setFileUrl(const QString& s);
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
@@ -54,7 +44,7 @@ private:
QString fileUrl;
QGraphicsRectItem *canvas;
QGraphicsRectItem *shadow;
- DiveButtonItem *button;
+ CloseButtonItem *button;
};
#endif // DIVEPIXMAPITEM_H