#Qt Transform setTransform()在鼠标拖动移动视角是一致在原地不动,无法变换视角(细微观察似乎视图有在原地抖动),不知道为什么
```c++
ViewControl::ViewControl(QWidget* parent)
: QGraphicsView(parent)
{
m_scene = new QGraphicsScene();
view_window = this;
this->setMouseTracking(true);
view_window->setScene(m_scene);
view_window->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view_window->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view_window->viewport()->installEventFilter(this);
view_window->setMouseTracking(true);
view_window->setFocusPolicy(Qt::StrongFocus);
_modifiers = Qt::ControlModifier;
_zoom_factor_base = 1.0015;
originalfactor = 1;
panSelectorDown = false;
mouseButtonDown = false;
m_scale = 1.0;
m_factor_st = 1.0;
qpix_image = nullptr;
image_item = new QGraphicsPixmapItem();
m_scene->setSceneRect(0, 0, 32768, 32768); // 设置场景矩形
last_offset_X = 0.0;
last_offset_Y = 0.0;
m_pixmap = nullptr;
setInteractive(false);
QGraphicsView::setAlignment(Qt::AlignLeft | Qt::AlignTop);
}
void ViewControl::mouseMoveEvent(QMouseEvent* e)
{
mouseLastXY = e->pos();
if (panSelectorDown || mouseButtonDown)
{
this->setCursor(Qt::ClosedHandCursor);
//Q_UNUSED(e)
QPointF currentMapPoint = view_window->mapToScene(e->pos());
QPointF startMapPoint = view_window->mapToScene(rubberStartPoint);
double dx = currentMapPoint.x() - startMapPoint.x();
double dy = currentMapPoint.y() - startMapPoint.y();
double offset_X = last_offset_X + dx;
double offset_Y = last_offset_Y + dy;
view_window->setTransformationAnchor(QGraphicsView::AnchorViewCenter);
view_window->setTransform(QTransform(1.0, 0, 0,
0, 1.0, 0,
offset_X, offset_Y, 1), true);
view_window->update();