[Interest] how to get and purge events from queue?

Jérôme Godbout godboutj at amotus.ca
Thu Nov 5 18:24:17 CET 2020


Maybe you can add an event filter and remove some of the events if they are happening too close to each others. But I thing doing that logic into the event handler is a betetr idea, where you can either cumulate and delay execution of the behavior.

-----Original Message-----
From: Interest <interest-bounces at qt-project.org> On Behalf Of Giuseppe D'Angelo via Interest
Sent: November 5, 2020 5:06 AM
To: interest at qt-project.org
Subject: Re: [Interest] how to get and purge events from queue?

Il 05/11/20 05:38, David M. Cotter ha scritto:
> when scrolling, the scroll for my app is a bit sluggish (do not ask 
> about that) which means that mouse wheel scroll events can pile up in the queue while the first scroll event is being processed.
> meaning that a dozen more*slow*  events get handled after the user stops scrolling.
> 
> what i want to do is: when i get a wheel scroll event, at that moment i see if there are MORE scroll events in the queue. if not, i just handle this event. but if there ARE i want to get the most recent one, and handle only that ONE event, while purging the rest.

There is some sort of input event compression available through application flags. For the rest, you could just not act on events that happen too close together (either wait a bit before acting, so to get N events, or act on the first one and ignore the subsequent ones in a short time frame).

But there's just no public access to the pending event queue.

HTH,

--
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts



More information about the Interest mailing list