我正在使用QWheelEvent放大和缩小绘图。当我一个一个滚动时,程序运行良好,但是当使用多滚动(快速旋转鼠标滚轮(时,程序无法正常工作。我调试它并掌握当我多次滚动以放大时,某些事件是错误的(缩小(。谁能帮我!部分代码:
bool zoom_out_scope=false;
bool zoom_in_scope=false;
if(event->angleDelta().y()==120)
zoom_in_scope=true;
else
zoom_out_scope=true;
我在笔记本电脑上也注意到了这一点,angleDelta
值并不总是+/-120
。这是我笔记本电脑的日志。
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-11,0))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-5,0))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-5,0))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(0,3))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-7,1))
QWheelEvent(Qt::NoScrollPhase)
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-2,1))
QWheelEvent(Qt::NoScrollPhase)
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-4,3))
QWheelEvent(Qt::NoScrollPhase)
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-1,0))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-1,1))
QWheelEvent(Qt::NoScrollPhase)
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(0,1))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(-1,1))
QWheelEvent(Qt::NoScrollPhase)
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(0,3))
QWheelEvent(Qt::NoScrollPhase, pixelDelta=QPoint(0,0), angleDelta=QPoint(0,1))