[Interest] how to get and purge events from queue?
David M. Cotter
dave at kjams.com
Mon Nov 23 22:05:33 CET 2020
that is exactly what i did and it worked like a charm.
> On Nov 23, 2020, at 10:25 AM, Matthew Woehlke <mwoehlke.floss at gmail.com> 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
More information about the Interest
mailing list