https://bugs.kde.org/show_bug.cgi?id=462864

--- Comment #10 from Andreas Schleth <[email protected]> ---
Hi Johannes,

unfortunately the bug is still there in v5.9.1-106-gd908ac10 ...
But at least we know where to look for it.

So I added some diagnostic print:

    std::cout << "check deltax" << pxDelta.x() << "   deltay" << pxDelta.y() <<
"\n";

Which recorded on one forward and backward increment:

 check deltax0   deltay0
 check deltax0   deltay0

The effect on screen was the older next picture for each event. 
Then I did some digging in the docs and found in
https://doc.qt.io/qt-5/qwheelevent.html :
"There are two ways to read the wheel event delta: angleDelta() returns the
deltas in wheel degrees. These values are always provided. pixelDelta() returns
the deltas in screen pixels, and is available on platforms that have
high-resolution trackpads, such as macOS."

Improving my test output to:
    const auto anDelta = event->angleDelta();
    std::cout << "check deltax " << pxDelta.x() << "   deltay " << pxDelta.y()
<< "\n";
    std::cout << "check anglex " << anDelta.x() << "   angley " << anDelta.y()
<< "\n";
produced:
check deltax 0   deltay 0
check anglex 0   angley 120
check deltax 0   deltay 0
check anglex 0   angley -120

So, my suggestion would be to use the angleDelta instead of the pixelDelta like
this:
...
    const auto anDelta = event->angleDelta();
    const bool isHorizontal = (qAbs(anDelta.x()) > qAbs(anDelta.y()));
    if ((!isHorizontal && anDelta.y() < 0) || (isHorizontal && anDelta.x() <
0)) {
...
I did the same test output on the Ubuntu machine: there the pixelDelta showed
"120" / "-120" - the same as angleDelta on my openSuse.
So we might assume, that the Qt-guys did change something in between the last
minor releases.

The suggested fix works on both my platforms :-)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to