fix scale center and mouse scroll issue

This commit is contained in:
Gary Wang 2019-10-07 14:46:22 +08:00
parent b1260c0b41
commit 3576235d14

View File

@ -15,6 +15,7 @@ GraphicsView::GraphicsView(QWidget *parent)
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setResizeAnchor(QGraphicsView::AnchorUnderMouse); setResizeAnchor(QGraphicsView::AnchorUnderMouse);
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
setStyleSheet("background-color: rgba(0, 0, 0, 220);" setStyleSheet("background-color: rgba(0, 0, 0, 220);"
"border-radius: 3px;"); "border-radius: 3px;");
setAcceptDrops(true); setAcceptDrops(true);
@ -180,8 +181,7 @@ void GraphicsView::mouseReleaseEvent(QMouseEvent *event)
void GraphicsView::wheelEvent(QWheelEvent *event) void GraphicsView::wheelEvent(QWheelEvent *event)
{ {
event->ignore(); event->ignore();
// blumia: no need for calling parent method.
return QGraphicsView::wheelEvent(event);
} }
void GraphicsView::resizeEvent(QResizeEvent *event) void GraphicsView::resizeEvent(QResizeEvent *event)