From 1f49608ce8b2f721c2ff1c8c792b0f5f1dec3a5a Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Wed, 29 Nov 2017 18:24:13 +0100 Subject: 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 --- desktop-widgets/divepicturewidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); + 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); } -- cgit v1.2.3-70-g09d2