summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divepicturewidget.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-29 18:24:13 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2017-12-01 09:44:34 +0100
commit1f49608ce8b2f721c2ff1c8c792b0f5f1dec3a5a (patch)
treef7725730c8ee5455453c93fe3d2feb12c889e899 /desktop-widgets/divepicturewidget.cpp
parentfb008120e102df72abf2feb3a5813639d65955ba (diff)
downloadsubsurface-1f49608ce8b2f721c2ff1c8c792b0f5f1dec3a5a.tar.gz
Dive picture drag&drop decrease size of pixmaps
Decrease the size of the pixmaps during drag&drop to the final unzoomed size in the profile widget. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets/divepicturewidget.cpp')
-rw-r--r--desktop-widgets/divepicturewidget.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop-widgets/divepicturewidget.cpp b/desktop-widgets/divepicturewidget.cpp
index eadc493e8..a6864a5d9 100644
--- a/desktop-widgets/divepicturewidget.cpp
+++ b/desktop-widgets/divepicturewidget.cpp
@@ -35,7 +35,11 @@ void DivePictureWidget::mousePressEvent(QMouseEvent *event)
QString filename = model()->data(indexAt(event->pos()), Qt::DisplayPropertyRole).toString();
if (!filename.isEmpty()) {
+ int dim = lrint(defaultIconMetrics().sz_pic * 0.2);
+
QPixmap pixmap = model()->data(indexAt(event->pos()), Qt::DecorationRole).value<QPixmap>();
+ pixmap = pixmap.scaled(dim, dim, Qt::KeepAspectRatio);
+
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
dataStream << filename << event->pos();
@@ -46,7 +50,6 @@ void DivePictureWidget::mousePressEvent(QMouseEvent *event)
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setPixmap(pixmap);
- drag->setHotSpot(event->pos() - rectForIndex(indexAt(event->pos())).topLeft());
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
}