C++ (Qt)bool DisplayWin::DragPan( QMouseEvent * e ){ QPointF org = mImageArea->widget()->mapFrom(mImageArea, QPoint(1, 1)); QPointF ofs = e->localPos() - org; QPointF scroll = mDragPos - ofs; HScroll()->setValue(scroll.x()); VScroll()->setValue(scroll.y()); return true;}