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

Mauricius <mauriciosmit...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mauriciosmit...@gmail.com

--- Comment #7 from Mauricius <mauriciosmit...@gmail.com> ---
(In reply to Nate Graham from comment #6)
> Looks like it'll be more complicated here, as I don't see any public API to
> override the scroll behavior. We'll need to either override wheelEvent() for
> these controls in our QStyle to conditionally do nothing, or else make a Qt
> change to either do that or add API there that we can use downstream.

Hi, new guy here!

After a couple hours of toying with a dummy scrollception app, I think I found
a way to circumvent the problem in the classic QWidgets apps that doesn't break
the old functionality but prevents accidental inputs from happening. Instead of
messing with Breeze, I implemented an app wide event filter that redirects the
scroll events to the widget the user would expect to react.

So this is what user sees: if the mouse is moved into a scrollable field, it
should react by changing its value as normal. HOWEVER if the user keeps the
mouse still and simply scrolls over the field, it will not react, but the
widget that started scrolling would continue scrolling. This also applies to
scroll-areas within scroll-areas: scrolling over one will not affect it, just
like in browsers.

How it's done: with an event filter installed on QApp. It remembers one widget
as the scroll-active one and if the receiver of an event is not scroll-active,
the event will be resent to the scroll-active one. This is how it responds to
events:
QMouseMoveEvent:
* Reset scroll-active to 0 when the mouse moves
* This ensures that the next scroll event will be propagated to the widget
under cursor
* On the next scroll event the receiver object should be set as the
scroll-active widget

QWheelEvent
* If the scroll-active widget is not scrollable anymore (for example reached
the end), reset scroll-active to 0
* for example, allow scrolling parent scroll-area if the current one reached
its end

* In case the receiver widget is a non-scrollable widget inside a scrollable
area, find the first scrollable parent

* Change the scroll-active widget to the receiver (or its parent) only if the
scroll-active variable has been reset
* i.e. prevent changing the scroll-active variable unless explicitly required

* If the receiver isn't the scroll-active widget, redirect the event to the
scroll-active one


This of course isn't related to Breeze style but to Qt itself, but if we really
want to apply this globally the style could perhaps force the event filter on
the app it's used on.

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

Reply via email to