|
@@ -27,6 +27,7 @@ ImageView::ImageView(QWidget* parent) :
|
|
|
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
|
|
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
+ this->resize(parent->size());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -61,7 +62,7 @@ void ImageView::setCurPixmap(const QPixmap& newPixmap) {
|
|
|
QRectF sceneRect(-pixmapCenter.x(), -pixmapCenter.y(), m_pixmap.width(), m_pixmap.height());
|
|
|
scene()->setSceneRect(sceneRect);
|
|
|
setSceneRect(scene()->itemsBoundingRect());
|
|
|
- this->resize(m_pixmap.width(), m_pixmap.height());
|
|
|
+ //this->resize(m_pixmap.width(), m_pixmap.height());
|
|
|
m_imageOffset = QPoint(0, 0); // 重置图片偏移量为(0, 0)
|
|
|
setCursor(Qt::ArrowCursor);
|
|
|
update(); // 触发重绘
|