From 5b063a1f845c930d472a63610fa3e04d723c4c0f Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 19 Jul 2012 16:53:13 +0300 Subject: [PATCH] Pixmaps with size less than 100px doesn't crashes sankore on mouse click. --- src/domain/UBGraphicsPixmapItem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/domain/UBGraphicsPixmapItem.cpp b/src/domain/UBGraphicsPixmapItem.cpp index 60ce4b2b..2df5c6fc 100644 --- a/src/domain/UBGraphicsPixmapItem.cpp +++ b/src/domain/UBGraphicsPixmapItem.cpp @@ -65,8 +65,9 @@ void UBGraphicsPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) QMimeData* pMime = new QMimeData(); pMime->setImageData(pixmap().toImage()); mDelegate->setMimeData(pMime); - int k = pixmap().width() / 100; - QSize newSize(pixmap().width() / k, pixmap().height() / k); + qreal k = (qreal)pixmap().width() / 100.0; + + QSize newSize((int)(pixmap().width() / k), (int)(pixmap().height() / k)); mDelegate->setDragPixmap(pixmap().scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));