[Development] MouseMoveEvent sluggishness on Qt5 vs Qt4

Renaud renaud.guezennec at gmail.com
Thu Dec 4 12:20:09 CET 2014


I have noticed that the mouseMoveEvents are no more compressed. So in Qt4,
if you perform long (update) task in response to mouseMoveEvent. The Qt
event loop stopped sending events until your job is finished. All events
you received in the meantime were dropped. Then, you may received another
mouseMoveEvent.
So, the lazy mode was made by the mouseMoveEvent behaviour.

In Qt5, the mouseMoveEvents are stored in the queue. So when you receive an
event and perform its task in response, the queue grows up. You will do an
updateGL for every event you received. Put "update" instead updateGL hides
the issue. I mean, the event compression is made at the level of update and
no longer on mouseMoveEvent.

Where you received may be 2 or 4 mouseMoveEvent in Qt4. You will receive 20
events in Qt5.

In my point of view, it is a bug in Qt5 and i'm not alone :
https://bugreports.qt-project.org/browse/QTBUG-40889?page=com.googlecode.jira-suite-utilities:transitions-summary-tabpanel



2014-11-22 22:16 GMT+01:00 Dov Grobgeld <dov.grobgeld at gmail.com>:

> Thanks Reaud and Mathew! The s/update/updateGL/ fixed the problem!
>
> Btw, I initially copied the use of updateGL() from
> .../examples/opengl/hellogl/glwidget.cpp, which still (git HEAD) uses it.
> Shouldn't this be changed for the same reason as well?
>
> Regards,
> Dov
>
> On Fri, Nov 21, 2014 at 11:39 PM, Matthew Woehlke <
> mw_triad at users.sourceforge.net> wrote:
>
>> On 2014-11-21 05:22, Renaud wrote:
>> > I saw in your small example  that you use "updateGL()", I suggest you to
>> > change it to "update()".
>> >
>> > It may help the performance on Qt5.
>>
>> Hoo boy... I'm not sure why this would work better on Qt4 (see possible
>> idea, below), but updateGL() *IMMEDIATELY* calls your paintGL, i.e.
>> forces an immediate render to occur and don't return until the render is
>> completed. You *almost never* want to do that (if you're about to grab
>> the buffer is probably the only time you would). If you do that in a
>> mouse event handler, then (referring to your original observation) you
>> will indeed get a render for every mouse event that is processed.
>>
>> update() on the other hand tells Qt that your widget needs to be
>> repainted "some time". In particular, "some time" generally means "when
>> you're done processing outstanding events". This will let you handle a
>> bunch of mouse events, do whatever changes you need, and then paint
>> (render) once all of them have been handled.
>>
>> It may be that in Qt4 there is some coalescing of mouse events happening
>> that is not happening in Qt5.
>>
>> At any rate, you will probably get much more similar performance with
>> update() vs. updateGL().
>>
>> --
>> Matthew
>>
>> _______________________________________________
>> Development mailing list
>> Development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
>>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20141204/56758cfc/attachment.html>


More information about the Development mailing list