QCustomPlot Discussion and Comments

Both axes zoom sometimesReturn to overview

After enabling axis pan and zoom options, I notice that sometimes both axes will zoom with the mouse wheel when only the x axis should. The mouse cursor is definitely in the area below the X axis when this happens. When this happens, it repeats as I continue to turn the mouse wheel until I move the cursor even a small distance. I also see this with the plots example code running the simple demo.

Windows 10
QCustomPlot 2.10
Qt 5.15.2 or 5.15.3
Visual C++ 2019

(It was amazing easy to enable pan and zoom.)

I think what's happening is: when the mouse cursor y coordinate is at the boundary between the tick labels and axis label (or at the bottom if there is no axis label), it's not detected as being in the axis area. Turning off the axis label makes it easy to trigger the problem.

I can't trigger this bug if I set QCPAxis::labelPadding to 0 or 1 (default seems to be 3). Anything larger is broken, and setting it to something really large, like 50, makes the problem easy to trigger.

The Y axis has the same problem (but for my current application, X zooming is much more likely to be used).

Thanks for the report!
I'll have a look. Most likely tweaking the hit boxes of the axis elements will fix it in an upcoming release.

Looks like this did not get fixed in 2.1.1. Otherwise, all seems well. You've taken away my excuse for not trying Qt 6...

Actually, the problem is worse in 2.1.1. Setting labelPadding to 0 or 1 doesn't help any more.