Re: [Interest] how to get and purge events from queue?
that is exactly what i did and it worked like a charm. > On Nov 23, 2020, at 10:25 AM, Matthew Woehlke > wrote: > > On 05/11/2020 12.24, Jérôme Godbout wrote: >> 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. > This. Separate your logic that decides an update is needed from the logic > that actually does the update, and have the former *queue* (if not already > queued) an event to do the latter. > > I've used this technique on quite some occasions and IIUC Qt uses it > internally when repainting widgets (n.b. QWidget::update). > > If possible, also move some of that slow logic to a different thread... > > -- > Matthew ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] how to get and purge events from queue?
On 05/11/2020 12.24, Jérôme Godbout wrote: 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. This. Separate your logic that decides an update is needed from the logic that actually does the update, and have the former *queue* (if not already queued) an event to do the latter. I've used this technique on quite some occasions and IIUC Qt uses it internally when repainting widgets (n.b. QWidget::update). If possible, also move some of that slow logic to a different thread... -- Matthew ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
Re: [Interest] how to get and purge events from queue?
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 On Behalf Of Giuseppe D'Angelo via Interest Sent: November 5, 2020 5:06 AM To: interest@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.dang...@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 ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
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.dang...@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 smime.p7s Description: Firma crittografica S/MIME ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
[Interest] how to get and purge events from queue?
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. how can i do this? -dave ___ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest