fix: drag on image transparent pixels for panning viewport

This commit is contained in:
Gary Wang 2020-09-26 10:47:28 +08:00
parent 36c7eb1891
commit 5ff49f4885

View File

@ -24,7 +24,9 @@ GraphicsScene::~GraphicsScene()
void GraphicsScene::showImage(const QPixmap &pixmap) void GraphicsScene::showImage(const QPixmap &pixmap)
{ {
this->clear(); this->clear();
m_theThing = this->addPixmap(pixmap); QGraphicsPixmapItem * pixmapItem = this->addPixmap(pixmap);
pixmapItem->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
m_theThing = pixmapItem;
this->setSceneRect(m_theThing->boundingRect()); this->setSceneRect(m_theThing->boundingRect());
} }