1

I am using QWheelEvent for zoom in and zoom out in a plot. When I scroll one by one, the program works good, but when multi scroll is used(rotate mouse wheel fast) the program does not work fine. I debug it and grasp that when I multi scroll to zoom in, some of events are false(zooming out). can any one help me! part of code:

bool zoom_out_scope=false;
bool zoom_in_scope=false;
if(event->angleDelta().y()==120)
   zoom_in_scope=true;
else
    zoom_out_scope=true;
Donald Duck
  • 8,409
  • 22
  • 75
  • 99
javad
  • 83
  • 2
  • 7

1 Answers1

0

I've also noticed this on my laptop, angleDelta values are not always +/-120. Here are is a log from my laptop.

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))
user1095108
  • 14,119
  • 9
  • 58
  • 116