mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
fb008120e1
commit
1f49608ce8
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue