From 5ff49f4885de312f13fa864dddb23d018db13f5c Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Sat, 26 Sep 2020 10:47:28 +0800 Subject: [PATCH] fix: drag on image transparent pixels for panning viewport --- graphicsscene.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphicsscene.cpp b/graphicsscene.cpp index 2569b5c..321d0d9 100644 --- a/graphicsscene.cpp +++ b/graphicsscene.cpp @@ -24,7 +24,9 @@ GraphicsScene::~GraphicsScene() void GraphicsScene::showImage(const QPixmap &pixmap) { this->clear(); - m_theThing = this->addPixmap(pixmap); + QGraphicsPixmapItem * pixmapItem = this->addPixmap(pixmap); + pixmapItem->setShapeMode(QGraphicsPixmapItem::BoundingRectShape); + m_theThing = pixmapItem; this->setSceneRect(m_theThing->boundingRect()); }