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>
This commit is contained in:
Tomaz Canabrava 2014-06-27 18:00:42 -03:00 committed by Dirk Hohndel
parent 259b73335f
commit 3f98f024e4
4 changed files with 18 additions and 7 deletions

View file

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