• Hi,

    Seems like event compression has change between versions 4.7.1 and 5.3.0.

    I've implemented a basic widget that handles mouse move events and process some code in it.
    Here is a basic example of what it looks like. (no matter what the function does)

    @void MyLabel::mouseMoveEvent(QMouseEvent* /event/)
    //do something long
    int k = 1;
    for(int i = 0; i < 100000000; ++i)
    k = sqrt(k) + sqrt(k) + sqrt(k);

    The same code has been compiled using both version 4.7.1 and 5.3.0.

    Version 4.7.1 seems to properly compress events as the event is treated a few time while I click and move the mouse on the widget but 5.3.0 seems to treat every events so I have to wait to get any feedback.

    Is their an explanation to that change and is there a way to get a proper event compression?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I remember reading some posts about the mouse event handling having changed but IIRC it was more about the handling of the clicked/double clicked events.

    Anyway, from a pure design point of view, having long operations taking place in a mouse event (or events in general) is not a good idea. Triggering a long operation from an event handler in a secondary thread is OK though

  • Hi SGaist,

    Thanks for answering.

    The long operation was just an example to highlight the difference between both versions.

    The thing is that sometimes, one need to precisely track the mouse, like a drawing operation in a paint software, but sometimes the final result is the only thing needed, then avoiding in-between events is not an issue.

  • Lifetime Qt Champion

    I see what you mean. To discuss difference of implementation between Qt 4 and Qt 5's event compression, you should contact the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

Log in to reply