summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divepixmapitem.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-27 18:00:42 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-27 20:37:11 -0700
commit3f98f024e484764e2bfa648d9eb072ce7472acf6 (patch)
treed04771bf8a78c6f4127e70fedeeff826ac91c9c9 /qt-ui/profile/divepixmapitem.cpp
parent259b73335f3ba0597eb2bb21d948d33fcd61bbbe (diff)
downloadsubsurface-3f98f024e484764e2bfa648d9eb072ce7472acf6.tar.gz
Open picture manager when clicking on the picture at the profile
This patch makes the click on pic == open picture browser works also on the profile instead of only on the list view.. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/divepixmapitem.cpp')
-rw-r--r--qt-ui/profile/divepixmapitem.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/qt-ui/profile/divepixmapitem.cpp b/qt-ui/profile/divepixmapitem.cpp
index 263a8023b..e0ce4f90a 100644
--- a/qt-ui/profile/divepixmapitem.cpp
+++ b/qt-ui/profile/divepixmapitem.cpp
@@ -1,21 +1,25 @@
#include "divepixmapitem.h"
#include "animationfunctions.h"
+#include <divepicturewidget.h>
#include <QPen>
#include <QBrush>
#include <QGraphicsDropShadowEffect>
+#include <QDesktopServices>
+#include <QUrl>
DivePixmapItem::DivePixmapItem(QObject *parent) : QObject(parent), QGraphicsPixmapItem()
{
}
-DivePictureItem::DivePictureItem(QObject *parent): DivePixmapItem(parent)
+DivePictureItem::DivePictureItem(int row, QObject *parent): DivePixmapItem(parent)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
setAcceptsHoverEvents(true);
#else
setAcceptHoverEvents(true);
#endif
+ rowOnModel = row;
setScale(0.2);
}
@@ -56,3 +60,9 @@ void DivePictureItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Animations::scaleTo(this, 0.2);
this->setZValue(0);
}
+
+void DivePictureItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ QString filePath = DivePictureModel::instance()->index(rowOnModel,0).data(Qt::ToolTipRole).toString();
+ QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
+}